yujian
2019-03-27 cdcbed9af813b2a02cdc01eefa24db8bec6b51a9
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?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.PushGoodsMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushGoods">
    <id column="pg_id" property="id" jdbcType="BIGINT"/>
    <result column="pg_alert_title" property="alertTitle" jdbcType="VARCHAR"/>
    <result column="pg_alert_content" property="alertContent" jdbcType="VARCHAR"/>
    <result column="pg_title" property="title" jdbcType="VARCHAR"/>
    <result column="pg_content" property="content" jdbcType="VARCHAR"/>
    <result column="pg_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="pg_uid" property="uid" jdbcType="BIGINT"/>
    <result column="pg_versions" property="versions" jdbcType="VARCHAR"/>
    <result column="pg_is_push" property="isPush" jdbcType="VARCHAR"/>
    <result column="pg_push_time" property="pushTime" jdbcType="TIMESTAMP"/>
    <result column="pg_createtime" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="pg_updatetime" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods (pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime) values (#{id,jdbcType=BIGINT},#{alertTitle,jdbcType=VARCHAR},#{alertContent,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{versions,jdbcType=VARCHAR},#{isPush,jdbcType=VARCHAR},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">pg_id,</if>
      <if test="alertTitle != null">pg_alert_title,</if>
      <if test="alertContent != null">pg_alert_content,</if>
      <if test="title != null">pg_title,</if>
      <if test="content != null">pg_content,</if>
      <if test="picture != null">pg_picture,</if>
      <if test="uid != null">pg_uid,</if>
      <if test="versions != null">pg_versions,</if>
      <if test="isPush != null">pg_is_push,</if>
      <if test="pushTime != null">pg_push_time,</if>
      <if test="createTime != null">pg_createtime,</if>
      <if test="updateTime != null">pg_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="alertTitle != null">#{alertTitle,jdbcType=VARCHAR},</if>
      <if test="alertContent != null">#{alertContent,jdbcType=VARCHAR},</if>
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
      <if test="content != null">#{content,jdbcType=VARCHAR},</if>
      <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="versions != null">#{versions,jdbcType=VARCHAR},</if>
      <if test="isPush != null">#{isPush,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.PushGoods">update yeshi_ec_push_goods set pg_alert_title = #{alertTitle,jdbcType=VARCHAR},pg_alert_content = #{alertContent,jdbcType=VARCHAR},pg_title = #{title,jdbcType=VARCHAR},pg_content = #{content,jdbcType=VARCHAR},pg_picture = #{picture,jdbcType=VARCHAR},pg_uid = #{uid,jdbcType=BIGINT},pg_versions = #{versions,jdbcType=VARCHAR},pg_is_push = #{isPush,jdbcType=VARCHAR},pg_push_time = #{pushTime,jdbcType=TIMESTAMP},pg_createtime = #{createTime,jdbcType=TIMESTAMP},pg_updatetime = #{updateTime,jdbcType=TIMESTAMP} where pg_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods
    <set>
      <if test="alertTitle != null">pg_alert_title=#{alertTitle,jdbcType=VARCHAR},</if>
      <if test="alertContent != null">pg_alert_content=#{alertContent,jdbcType=VARCHAR},</if>
      <if test="title != null">pg_title=#{title,jdbcType=VARCHAR},</if>
      <if test="content != null">pg_content=#{content,jdbcType=VARCHAR},</if>
      <if test="picture != null">pg_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="uid != null">pg_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="versions != null">pg_versions=#{versions,jdbcType=VARCHAR},</if>
      <if test="isPush != null">pg_is_push=#{isPush,jdbcType=VARCHAR},</if>
      <if test="pushTime != null">pg_push_time=#{pushTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">pg_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">pg_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where pg_id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteBatchByPrimaryKey"  parameterType="java.util.List">
        delete from yeshi_ec_push_goods where pg_id in
        <foreach item="item" collection="list" open="(" separator=","
            close=")">#{item}</foreach>
   </delete>
  
   <select id="listQuery" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_goods
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (pg_alert_title like '%${key}%' or pg_alert_content like '%${key}%') 
           </if>
           <if test='state != null'>
                  AND pg_is_push = #{state}
           </if>
           ORDER BY pg_createtime desc 
        LIMIT ${start},${count}
   </select>
   
   <select id="countQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(pg_id),0)  FROM yeshi_ec_push_goods 
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (pg_alert_title like '%${key}%' or pg_alert_content like '%${key}%') 
           </if>
            <if test='state != null'>
                  AND pg_is_push = #{state}
           </if>
    </select>
    
   <select id="listHistoryByPushTime" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_goods
        WHERE pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
              AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
           ORDER BY pg_push_time desc 
        LIMIT ${start},${count}
   </select>
   
   <select id="countHistoryByPushTime" resultType="java.lang.Long">
        SELECT IFNULL(count(pg_id),0)  FROM yeshi_ec_push_goods
        WHERE pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
              AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
   </select>
   
    <select id="listByPushState" resultMap="BaseResultMap" parameterType="java.util.List">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_goods
        WHERE  pg_is_push = 1 AND  pg_id in
        <foreach item="item" collection="list" open="(" separator=","
            close=")">#{item}</foreach>
   </select>
</mapper>