admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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.yeshi.fanli.dao.mybatis.push.PushCouponMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushCoupon">
    <id column="pc_id" property="id" jdbcType="BIGINT"/>
    <result column="pc_title" property="title" jdbcType="VARCHAR"/>
    <result column="pc_content" property="content" jdbcType="VARCHAR"/>
    <result column="pc_amount" property="amount" jdbcType="INTEGER"/>
    <result column="pc_percent" property="percent" jdbcType="DECIMAL"/>
    <result column="pc_uids" property="uids" jdbcType="VARCHAR"/>
    <result column="pc_versions" property="versions" jdbcType="VARCHAR"/>
    <result column="pc_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="pc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="pc_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="pc_pushed" property="pushed" jdbcType="VARCHAR"/>
    <result column="pc_push_time" property="pushTime" jdbcType="TIMESTAMP"/>
    <result column="pc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="pc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">pc_id,pc_title,pc_content,pc_amount,pc_percent,pc_uids,pc_versions,pc_remark,pc_start_time,pc_end_time,pc_pushed,pc_push_time,pc_create_time,pc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_push_coupon where pc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_coupon where pc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon (pc_id,pc_title,pc_content,pc_amount,pc_percent,pc_uids,pc_versions,pc_remark,pc_start_time,pc_end_time,pc_pushed,pc_push_time,pc_create_time,pc_update_time) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{amount,jdbcType=INTEGER},#{percent,jdbcType=DECIMAL},#{uids,jdbcType=VARCHAR},#{versions,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{pushed,jdbcType=VARCHAR},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">pc_id,</if>
      <if test="title != null">pc_title,</if>
      <if test="content != null">pc_content,</if>
      <if test="amount != null">pc_amount,</if>
      <if test="percent != null">pc_percent,</if>
      <if test="uids != null">pc_uids,</if>
      <if test="versions != null">pc_versions,</if>
      <if test="remark != null">pc_remark,</if>
      <if test="startTime != null">pc_start_time,</if>
      <if test="endTime != null">pc_end_time,</if>
      <if test="pushed != null">pc_pushed,</if>
      <if test="pushTime != null">pc_push_time,</if>
      <if test="createTime != null">pc_create_time,</if>
      <if test="updateTime != null">pc_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
      <if test="content != null">#{content,jdbcType=VARCHAR},</if>
      <if test="amount != null">#{amount,jdbcType=INTEGER},</if>
      <if test="percent != null">#{percent,jdbcType=DECIMAL},</if>
      <if test="uids != null">#{uids,jdbcType=VARCHAR},</if>
      <if test="versions != null">#{versions,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="pushed != null">#{pushed,jdbcType=VARCHAR},</if>
      <if test="pushTime != null">#{pushTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushCoupon">update yeshi_ec_push_coupon set pc_title = #{title,jdbcType=VARCHAR},pc_content = #{content,jdbcType=VARCHAR},pc_amount = #{amount,jdbcType=INTEGER},pc_percent = #{percent,jdbcType=DECIMAL},pc_uids = #{uids,jdbcType=VARCHAR},pc_versions = #{versions,jdbcType=VARCHAR},pc_remark = #{remark,jdbcType=VARCHAR},pc_start_time = #{startTime,jdbcType=TIMESTAMP},pc_end_time = #{endTime,jdbcType=TIMESTAMP},pc_pushed = #{pushed,jdbcType=VARCHAR},pc_push_time = #{pushTime,jdbcType=TIMESTAMP},pc_create_time = #{createTime,jdbcType=TIMESTAMP},pc_update_time = #{updateTime,jdbcType=TIMESTAMP} where pc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushCoupon">update yeshi_ec_push_coupon
    <set>
      <if test="title != null">pc_title=#{title,jdbcType=VARCHAR},</if>
      <if test="content != null">pc_content=#{content,jdbcType=VARCHAR},</if>
      <if test="amount != null">pc_amount=#{amount,jdbcType=INTEGER},</if>
      <if test="percent != null">pc_percent=#{percent,jdbcType=DECIMAL},</if>
      <if test="uids != null">pc_uids=#{uids,jdbcType=VARCHAR},</if>
      <if test="versions != null">pc_versions=#{versions,jdbcType=VARCHAR},</if>
      <if test="remark != null">pc_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">pc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">pc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="pushed != null">pc_pushed=#{pushed,jdbcType=VARCHAR},</if>
      <if test="pushTime != null">pc_push_time=#{pushTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">pc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">pc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where pc_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="listQuery" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_coupon
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND pc_uids like '%${key}%'
           </if>
           ORDER BY pc_create_time desc 
        LIMIT ${start},${count}
   </select>
   
   <select id="countQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(pc_id),0)  FROM yeshi_ec_push_coupon 
        WHERE 1=1
           <if test='key != null and key != ""'>
                   AND pc_uids like '%${key}%'
           </if>
    </select>
    
    <select id="listQueryEffective" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_push_coupon 
        WHERE pc_pushed = 1    
            AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ <= ]]>DATE_FORMAT(pc_end_time,'%Y%m%d');
    </select>
</mapper>