SpecialCarMapper.xml 9.4 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.pay.mapper.SpecialCarMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.SpecialCar">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
    <result column="car_number_color" jdbcType="INTEGER" property="carNumberColor" />
    <result column="is_prosecution" jdbcType="INTEGER" property="isProsecution" />
    <result column="ext1" jdbcType="INTEGER" property="ext1" />
    <result column="ext2" jdbcType="INTEGER" property="ext2" />
    <result column="ext3" jdbcType="VARCHAR" property="ext3" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
  </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, car_number, car_number_color, is_prosecution, ext1, ext2, ext3, data_state
  </sql>
  <select id="selectByExample" parameterType="com.zteits.pay.domain.SpecialCarExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from special_car
    <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 special_car
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from special_car
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.zteits.pay.domain.SpecialCarExample">
    delete from special_car
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.zteits.pay.domain.SpecialCar">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into special_car (car_number, car_number_color, is_prosecution, 
      ext1, ext2, ext3, data_state
      )
    values (#{carNumber,jdbcType=VARCHAR}, #{carNumberColor,jdbcType=INTEGER}, #{isProsecution,jdbcType=INTEGER}, 
      #{ext1,jdbcType=INTEGER}, #{ext2,jdbcType=INTEGER}, #{ext3,jdbcType=VARCHAR}, #{dataState,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.zteits.pay.domain.SpecialCar">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into special_car
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="carNumber != null">
        car_number,
      </if>
      <if test="carNumberColor != null">
        car_number_color,
      </if>
      <if test="isProsecution != null">
        is_prosecution,
      </if>
      <if test="ext1 != null">
        ext1,
      </if>
      <if test="ext2 != null">
        ext2,
      </if>
      <if test="ext3 != null">
        ext3,
      </if>
      <if test="dataState != null">
        data_state,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="carNumber != null">
        #{carNumber,jdbcType=VARCHAR},
      </if>
      <if test="carNumberColor != null">
        #{carNumberColor,jdbcType=INTEGER},
      </if>
      <if test="isProsecution != null">
        #{isProsecution,jdbcType=INTEGER},
      </if>
      <if test="ext1 != null">
        #{ext1,jdbcType=INTEGER},
      </if>
      <if test="ext2 != null">
        #{ext2,jdbcType=INTEGER},
      </if>
      <if test="ext3 != null">
        #{ext3,jdbcType=VARCHAR},
      </if>
      <if test="dataState != null">
        #{dataState,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.zteits.pay.domain.SpecialCarExample" resultType="java.lang.Long">
    select count(*) from special_car
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update special_car
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.carNumber != null">
        car_number = #{record.carNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.carNumberColor != null">
        car_number_color = #{record.carNumberColor,jdbcType=INTEGER},
      </if>
      <if test="record.isProsecution != null">
        is_prosecution = #{record.isProsecution,jdbcType=INTEGER},
      </if>
      <if test="record.ext1 != null">
        ext1 = #{record.ext1,jdbcType=INTEGER},
      </if>
      <if test="record.ext2 != null">
        ext2 = #{record.ext2,jdbcType=INTEGER},
      </if>
      <if test="record.ext3 != null">
        ext3 = #{record.ext3,jdbcType=VARCHAR},
      </if>
      <if test="record.dataState != null">
        data_state = #{record.dataState,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update special_car
    set id = #{record.id,jdbcType=BIGINT},
      car_number = #{record.carNumber,jdbcType=VARCHAR},
      car_number_color = #{record.carNumberColor,jdbcType=INTEGER},
      is_prosecution = #{record.isProsecution,jdbcType=INTEGER},
      ext1 = #{record.ext1,jdbcType=INTEGER},
      ext2 = #{record.ext2,jdbcType=INTEGER},
      ext3 = #{record.ext3,jdbcType=VARCHAR},
      data_state = #{record.dataState,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.zteits.pay.domain.SpecialCar">
    update special_car
    <set>
      <if test="carNumber != null">
        car_number = #{carNumber,jdbcType=VARCHAR},
      </if>
      <if test="carNumberColor != null">
        car_number_color = #{carNumberColor,jdbcType=INTEGER},
      </if>
      <if test="isProsecution != null">
        is_prosecution = #{isProsecution,jdbcType=INTEGER},
      </if>
      <if test="ext1 != null">
        ext1 = #{ext1,jdbcType=INTEGER},
      </if>
      <if test="ext2 != null">
        ext2 = #{ext2,jdbcType=INTEGER},
      </if>
      <if test="ext3 != null">
        ext3 = #{ext3,jdbcType=VARCHAR},
      </if>
      <if test="dataState != null">
        data_state = #{dataState,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zteits.pay.domain.SpecialCar">
    update special_car
    set car_number = #{carNumber,jdbcType=VARCHAR},
      car_number_color = #{carNumberColor,jdbcType=INTEGER},
      is_prosecution = #{isProsecution,jdbcType=INTEGER},
      ext1 = #{ext1,jdbcType=INTEGER},
      ext2 = #{ext2,jdbcType=INTEGER},
      ext3 = #{ext3,jdbcType=VARCHAR},
      data_state = #{dataState,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>