TrafficFaceMapper.xml 10.8 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.viontech.fanxing.query.mapper.TrafficFaceMapper" >
  <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.TrafficFace" >
    <id column="trafficFace_id" property="id" />
    <id column="trafficFace_event_time" property="eventTime" />
    <result column="trafficFace_unid" property="unid" />
    <result column="trafficFace_traffic_id" property="trafficId" />
    <result column="trafficFace_state" property="state" />
    <result column="trafficFace_sex" property="sex" />
    <result column="trafficFace_upper_color" property="upperColor" />
    <result column="trafficFace_lower_color" property="lowerColor" />
  </resultMap>
  <resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.TrafficFace" extends="BaseResultMapRoot" />
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List_Root" >
    `trafficFace`.id as trafficFace_id, `trafficFace`.event_time as trafficFace_event_time, 
    `trafficFace`.unid as trafficFace_unid, `trafficFace`.traffic_id as trafficFace_traffic_id, 
    `trafficFace`.`state` as `trafficFace_state`, `trafficFace`.sex as trafficFace_sex, 
    `trafficFace`.upper_color as trafficFace_upper_color, `trafficFace`.lower_color as trafficFace_lower_color
  </sql>
  <sql id="Base_Column_List" >
    <if test="!(_parameter.getClass().getSimpleName() == 'TrafficFaceExample')" >
      <include refid="com.viontech.fanxing.query.mapper.TrafficFaceMapper.Base_Column_List_Root" />
    </if>
    <if test="_parameter.getClass().getSimpleName() == 'TrafficFaceExample'" >
      <foreach collection="columnContainerSet" item="columns" separator="," >
        <choose >
          <when test="columns.tableName == 'd_traffic_face'.toString()" >
            <if test="columns.valid" >
              ${columns.columnContainerStr}
            </if>
            <if test="!columns.valid" >
              <include refid="com.viontech.fanxing.query.mapper.TrafficFaceMapper.Base_Column_List_Root" />
            </if>
          </when>
        </choose>
      </foreach>
    </if>
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.commons.model.TrafficFaceExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from `d_traffic_face` `trafficFace`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="groupByClause != null" >
      group by ${groupByClause}
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="map" >
    select 
    <include refid="Base_Column_List" />
    from `d_traffic_face` `trafficFace`
    where `trafficFace`.id = #{id,jdbcType=BIGINT}
      and `trafficFace`.event_time = #{eventTime,jdbcType=TIMESTAMP}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="map" >
    delete  from `d_traffic_face` `trafficFace`
    where id = #{id,jdbcType=BIGINT}
      and event_time = #{eventTime,jdbcType=TIMESTAMP}
  </delete>
  <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.TrafficFaceExample" >
    delete  from `d_traffic_face` `trafficFace`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `d_traffic_face` (event_time, unid, traffic_id, 
      `state`, sex, upper_color, 
      lower_color)
    values (#{eventTime,jdbcType=TIMESTAMP}, #{unid,jdbcType=VARCHAR}, #{trafficId,jdbcType=BIGINT}, 
      #{state,jdbcType=SMALLINT}, #{sex,jdbcType=SMALLINT}, #{upperColor,jdbcType=VARCHAR}, 
      #{lowerColor,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `d_traffic_face`
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="eventTime != null" >
        event_time,
      </if>
      <if test="unid != null" >
        unid,
      </if>
      <if test="trafficId != null" >
        traffic_id,
      </if>
      <if test="state != null" >
        `state`,
      </if>
      <if test="sex != null" >
        sex,
      </if>
      <if test="upperColor != null" >
        upper_color,
      </if>
      <if test="lowerColor != null" >
        lower_color,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="eventTime != null" >
        #{eventTime,jdbcType=TIMESTAMP},
      </if>
      <if test="unid != null" >
        #{unid,jdbcType=VARCHAR},
      </if>
      <if test="trafficId != null" >
        #{trafficId,jdbcType=BIGINT},
      </if>
      <if test="state != null" >
        #{state,jdbcType=SMALLINT},
      </if>
      <if test="sex != null" >
        #{sex,jdbcType=SMALLINT},
      </if>
      <if test="upperColor != null" >
        #{upperColor,jdbcType=VARCHAR},
      </if>
      <if test="lowerColor != null" >
        #{lowerColor,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.viontech.fanxing.commons.model.TrafficFaceExample" resultType="java.lang.Integer" >
    select count(*) from `d_traffic_face` `trafficFace`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update `d_traffic_face` `trafficFace`
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.eventTime != null" >
        event_time = #{record.eventTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.unid != null" >
        unid = #{record.unid,jdbcType=VARCHAR},
      </if>
      <if test="record.trafficId != null" >
        traffic_id = #{record.trafficId,jdbcType=BIGINT},
      </if>
      <if test="record.state != null" >
        `state` = #{record.state,jdbcType=SMALLINT},
      </if>
      <if test="record.sex != null" >
        sex = #{record.sex,jdbcType=SMALLINT},
      </if>
      <if test="record.upperColor != null" >
        upper_color = #{record.upperColor,jdbcType=VARCHAR},
      </if>
      <if test="record.lowerColor != null" >
        lower_color = #{record.lowerColor,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update `d_traffic_face` `trafficFace`
    set id = #{record.id,jdbcType=BIGINT},
      event_time = #{record.eventTime,jdbcType=TIMESTAMP},
      unid = #{record.unid,jdbcType=VARCHAR},
      traffic_id = #{record.trafficId,jdbcType=BIGINT},
      `state` = #{record.state,jdbcType=SMALLINT},
      sex = #{record.sex,jdbcType=SMALLINT},
      upper_color = #{record.upperColor,jdbcType=VARCHAR},
      lower_color = #{record.lowerColor,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.commons.model.TrafficFace" >
    update `d_traffic_face`
    <set >
      <if test="unid != null" >
        unid = #{unid,jdbcType=VARCHAR},
      </if>
      <if test="trafficId != null" >
        traffic_id = #{trafficId,jdbcType=BIGINT},
      </if>
      <if test="state != null" >
        `state` = #{state,jdbcType=SMALLINT},
      </if>
      <if test="sex != null" >
        sex = #{sex,jdbcType=SMALLINT},
      </if>
      <if test="upperColor != null" >
        upper_color = #{upperColor,jdbcType=VARCHAR},
      </if>
      <if test="lowerColor != null" >
        lower_color = #{lowerColor,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
      and event_time = #{eventTime,jdbcType=TIMESTAMP}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.TrafficFace" >
    update `d_traffic_face`
    set unid = #{unid,jdbcType=VARCHAR},
      traffic_id = #{trafficId,jdbcType=BIGINT},
      `state` = #{state,jdbcType=SMALLINT},
      sex = #{sex,jdbcType=SMALLINT},
      upper_color = #{upperColor,jdbcType=VARCHAR},
      lower_color = #{lowerColor,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
      and event_time = #{eventTime,jdbcType=TIMESTAMP}
  </update>
</mapper>