DataStatisticMapper.xml 10.7 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.DataStatisticMapper" >
  <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.DataStatistic" >
    <id column="dataStatistic_id" property="id" />
    <result column="dataStatistic_task_id" property="taskId" />
    <result column="dataStatistic_task_name" property="taskName" />
    <result column="dataStatistic_date" property="date" />
    <result column="dataStatistic_hour" property="hour" />
    <result column="dataStatistic_traffic" property="traffic" />
    <result column="dataStatistic_behavior" property="behavior" />
    <result column="dataStatistic_flow" property="flow" />
  </resultMap>
  <resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.DataStatistic" 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" >
    `dataStatistic`.id as dataStatistic_id, `dataStatistic`.task_id as dataStatistic_task_id, 
    `dataStatistic`.task_name as dataStatistic_task_name, `dataStatistic`.`date` as `dataStatistic_date`, 
    `dataStatistic`.`hour` as `dataStatistic_hour`, `dataStatistic`.traffic as dataStatistic_traffic, 
    `dataStatistic`.behavior as dataStatistic_behavior, `dataStatistic`.flow as dataStatistic_flow
  </sql>
  <sql id="Base_Column_List" >
    <if test="!(_parameter.getClass().getSimpleName() == 'DataStatisticExample')" >
      <include refid="com.viontech.fanxing.query.mapper.DataStatisticMapper.Base_Column_List_Root" />
    </if>
    <if test="_parameter.getClass().getSimpleName() == 'DataStatisticExample'" >
      <foreach collection="columnContainerSet" item="columns" separator="," >
        <choose >
          <when test="columns.tableName == 'd_data_statistic'.toString()" >
            <if test="columns.valid" >
              ${columns.columnContainerStr}
            </if>
            <if test="!columns.valid" >
              <include refid="com.viontech.fanxing.query.mapper.DataStatisticMapper.Base_Column_List_Root" />
            </if>
          </when>
        </choose>
      </foreach>
    </if>
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.commons.model.DataStatisticExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from `d_data_statistic` `dataStatistic`
    <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="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from `d_data_statistic` `dataStatistic`
    where `dataStatistic`.id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete  from `d_data_statistic` `dataStatistic`
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.DataStatisticExample" >
    delete  from `d_data_statistic` `dataStatistic`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.viontech.fanxing.commons.model.DataStatistic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `d_data_statistic` (task_id, task_name, `date`, 
      `hour`, traffic, behavior, 
      flow)
    values (#{taskId,jdbcType=BIGINT}, #{taskName,jdbcType=VARCHAR}, #{date,jdbcType=DATE}, 
      #{hour,jdbcType=INTEGER}, #{traffic,jdbcType=INTEGER}, #{behavior,jdbcType=INTEGER}, 
      #{flow,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.DataStatistic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `d_data_statistic`
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="taskId != null" >
        task_id,
      </if>
      <if test="taskName != null" >
        task_name,
      </if>
      <if test="date != null" >
        `date`,
      </if>
      <if test="hour != null" >
        `hour`,
      </if>
      <if test="traffic != null" >
        traffic,
      </if>
      <if test="behavior != null" >
        behavior,
      </if>
      <if test="flow != null" >
        flow,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="taskId != null" >
        #{taskId,jdbcType=BIGINT},
      </if>
      <if test="taskName != null" >
        #{taskName,jdbcType=VARCHAR},
      </if>
      <if test="date != null" >
        #{date,jdbcType=DATE},
      </if>
      <if test="hour != null" >
        #{hour,jdbcType=INTEGER},
      </if>
      <if test="traffic != null" >
        #{traffic,jdbcType=INTEGER},
      </if>
      <if test="behavior != null" >
        #{behavior,jdbcType=INTEGER},
      </if>
      <if test="flow != null" >
        #{flow,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.viontech.fanxing.commons.model.DataStatisticExample" resultType="java.lang.Integer" >
    select count(*) from `d_data_statistic` `dataStatistic`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update `d_data_statistic` `dataStatistic`
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.taskId != null" >
        task_id = #{record.taskId,jdbcType=BIGINT},
      </if>
      <if test="record.taskName != null" >
        task_name = #{record.taskName,jdbcType=VARCHAR},
      </if>
      <if test="record.date != null" >
        `date` = #{record.date,jdbcType=DATE},
      </if>
      <if test="record.hour != null" >
        `hour` = #{record.hour,jdbcType=INTEGER},
      </if>
      <if test="record.traffic != null" >
        traffic = #{record.traffic,jdbcType=INTEGER},
      </if>
      <if test="record.behavior != null" >
        behavior = #{record.behavior,jdbcType=INTEGER},
      </if>
      <if test="record.flow != null" >
        flow = #{record.flow,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update `d_data_statistic` `dataStatistic`
    set id = #{record.id,jdbcType=BIGINT},
      task_id = #{record.taskId,jdbcType=BIGINT},
      task_name = #{record.taskName,jdbcType=VARCHAR},
      `date` = #{record.date,jdbcType=DATE},
      `hour` = #{record.hour,jdbcType=INTEGER},
      traffic = #{record.traffic,jdbcType=INTEGER},
      behavior = #{record.behavior,jdbcType=INTEGER},
      flow = #{record.flow,jdbcType=INTEGER}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.commons.model.DataStatistic" >
    update `d_data_statistic`
    <set >
      <if test="taskId != null" >
        task_id = #{taskId,jdbcType=BIGINT},
      </if>
      <if test="taskName != null" >
        task_name = #{taskName,jdbcType=VARCHAR},
      </if>
      <if test="date != null" >
        `date` = #{date,jdbcType=DATE},
      </if>
      <if test="hour != null" >
        `hour` = #{hour,jdbcType=INTEGER},
      </if>
      <if test="traffic != null" >
        traffic = #{traffic,jdbcType=INTEGER},
      </if>
      <if test="behavior != null" >
        behavior = #{behavior,jdbcType=INTEGER},
      </if>
      <if test="flow != null" >
        flow = #{flow,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.DataStatistic" >
    update `d_data_statistic`
    set task_id = #{taskId,jdbcType=BIGINT},
      task_name = #{taskName,jdbcType=VARCHAR},
      `date` = #{date,jdbcType=DATE},
      `hour` = #{hour,jdbcType=INTEGER},
      traffic = #{traffic,jdbcType=INTEGER},
      behavior = #{behavior,jdbcType=INTEGER},
      flow = #{flow,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>