ParkingLotEquipmentDriverMapper.xml 9.11 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zteits.park.mapper.ParkingLotEquipmentDriverMapper">
  <resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkingLotEquipmentDriver">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="equipment_type_code" jdbcType="INTEGER" property="equipmentTypeCode" />
    <result column="driver_code" jdbcType="VARCHAR" property="driverCode" />
    <result column="driver_type" jdbcType="INTEGER" property="driverType" />
    <result column="driver_description" jdbcType="VARCHAR" property="driverDescription" />
    <result column="parent_driver_code" jdbcType="VARCHAR" property="parentDriverCode" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, equipment_type_code, driver_code, driver_type, driver_description, parent_driver_code
  </sql>
  <select id="selectByExample" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriverExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from parking_lot_equipment_driver
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from parking_lot_equipment_driver
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from parking_lot_equipment_driver
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriverExample">
    delete from parking_lot_equipment_driver
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriver">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into parking_lot_equipment_driver (equipment_type_code, driver_code, driver_type, 
      driver_description, parent_driver_code)
    values (#{equipmentTypeCode,jdbcType=INTEGER}, #{driverCode,jdbcType=VARCHAR}, #{driverType,jdbcType=INTEGER}, 
      #{driverDescription,jdbcType=VARCHAR}, #{parentDriverCode,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriver">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into parking_lot_equipment_driver
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="equipmentTypeCode != null">
        equipment_type_code,
      </if>
      <if test="driverCode != null">
        driver_code,
      </if>
      <if test="driverType != null">
        driver_type,
      </if>
      <if test="driverDescription != null">
        driver_description,
      </if>
      <if test="parentDriverCode != null">
        parent_driver_code,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="equipmentTypeCode != null">
        #{equipmentTypeCode,jdbcType=INTEGER},
      </if>
      <if test="driverCode != null">
        #{driverCode,jdbcType=VARCHAR},
      </if>
      <if test="driverType != null">
        #{driverType,jdbcType=INTEGER},
      </if>
      <if test="driverDescription != null">
        #{driverDescription,jdbcType=VARCHAR},
      </if>
      <if test="parentDriverCode != null">
        #{parentDriverCode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriverExample" resultType="java.lang.Long">
    select count(*) from parking_lot_equipment_driver
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update parking_lot_equipment_driver
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.equipmentTypeCode != null">
        equipment_type_code = #{record.equipmentTypeCode,jdbcType=INTEGER},
      </if>
      <if test="record.driverCode != null">
        driver_code = #{record.driverCode,jdbcType=VARCHAR},
      </if>
      <if test="record.driverType != null">
        driver_type = #{record.driverType,jdbcType=INTEGER},
      </if>
      <if test="record.driverDescription != null">
        driver_description = #{record.driverDescription,jdbcType=VARCHAR},
      </if>
      <if test="record.parentDriverCode != null">
        parent_driver_code = #{record.parentDriverCode,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update parking_lot_equipment_driver
    set id = #{record.id,jdbcType=BIGINT},
      equipment_type_code = #{record.equipmentTypeCode,jdbcType=INTEGER},
      driver_code = #{record.driverCode,jdbcType=VARCHAR},
      driver_type = #{record.driverType,jdbcType=INTEGER},
      driver_description = #{record.driverDescription,jdbcType=VARCHAR},
      parent_driver_code = #{record.parentDriverCode,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriver">
    update parking_lot_equipment_driver
    <set>
      <if test="equipmentTypeCode != null">
        equipment_type_code = #{equipmentTypeCode,jdbcType=INTEGER},
      </if>
      <if test="driverCode != null">
        driver_code = #{driverCode,jdbcType=VARCHAR},
      </if>
      <if test="driverType != null">
        driver_type = #{driverType,jdbcType=INTEGER},
      </if>
      <if test="driverDescription != null">
        driver_description = #{driverDescription,jdbcType=VARCHAR},
      </if>
      <if test="parentDriverCode != null">
        parent_driver_code = #{parentDriverCode,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zteits.park.domain.ParkingLotEquipmentDriver">
    update parking_lot_equipment_driver
    set equipment_type_code = #{equipmentTypeCode,jdbcType=INTEGER},
      driver_code = #{driverCode,jdbcType=VARCHAR},
      driver_type = #{driverType,jdbcType=INTEGER},
      driver_description = #{driverDescription,jdbcType=VARCHAR},
      parent_driver_code = #{parentDriverCode,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>