UnionClickCountDayMapper.xml 2.71 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.yoho.unions.dal.UnionClickCountDayMapper">
  <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionClickCountDay">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="day_id" jdbcType="VARCHAR" property="dayId" />
    <result column="union_type" jdbcType="VARCHAR" property="unionType" />
    <result column="client_type" jdbcType="INTEGER" property="clientType" />
    <result column="num" jdbcType="INTEGER" property="num" />
    <result column="comb" jdbcType="VARCHAR" property="comb" />
    <result column="create_time" jdbcType="INTEGER" property="createTime" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from union_click_count_day
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionClickCountDay">
    insert into union_click_count_day (id, day_id, union_type, 
      client_type, num, comb, 
      create_time)
    values (#{id,jdbcType=INTEGER}, #{dayId,jdbcType=VARCHAR}, #{unionType,jdbcType=VARCHAR}, 
      #{clientType,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{comb,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=INTEGER})
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionClickCountDay">
    update union_click_count_day
    set day_id = #{dayId,jdbcType=VARCHAR},
      union_type = #{unionType,jdbcType=VARCHAR},
      client_type = #{clientType,jdbcType=INTEGER},
      num = #{num,jdbcType=INTEGER},
      comb = #{comb,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, day_id, union_type, client_type, num, comb, create_time
    from union_click_count_day
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select id, day_id, union_type, client_type, num, comb, create_time
    from union_click_count_day
  </select>
  <delete id="deleteCountInfoByTime">
        delete
    		from union_click_count_day
        	where 
        		create_time &gt;= #{beginTime,jdbcType=INTEGER} 
        	and create_time &lt; #{endTime,jdbcType=INTEGER}
    </delete>
    <select id="selectCount">
	    select sum(num) from union_click_count_day
	    where union_type = #{unionType,jdbcType=VARCHAR} and client_type = #{clientType,jdbcType=INTEGER} and
	    		day_id &gt;= #{start,jdbcType=VARCHAR} and day_id &lt;= #{end,jdbcType=VARCHAR}
	</select>
</mapper>