admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
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
<?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.PushRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.xinge.PushRecord">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="url" property="url" jdbcType="VARCHAR"/>
    <result column="type" property="type" jdbcType="INTEGER"/>
    <result column="title" property="title" jdbcType="VARCHAR"/>
    <result column="state" property="state" jdbcType="INTEGER"/>
    <result column="createtime" property="createtime" jdbcType="BIGINT"/>
    <result column="count" property="count" jdbcType="BIGINT"/>
    <result column="iosPushId" property="iosPushId" jdbcType="VARCHAR"/>
    <result column="androidPushId" property="androidPushId" jdbcType="VARCHAR"/>
    <result column="account" property="account" jdbcType="INTEGER"/>
    <result column="appName" property="appName" jdbcType="VARCHAR"/>
    <result column="uid" property="uid" jdbcType="BIGINT"/>
  </resultMap>
  <sql id="Base_Column_List">id,url,type,title,state,createtime,count,iosPushId,androidPushId,account,appName,uid</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_push_record where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_record where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.xinge.PushRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_record (id,url,type,title,state,createtime,count,iosPushId,androidPushId,account,appName,uid) values (#{id,jdbcType=BIGINT},#{url,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{title,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT},#{count,jdbcType=BIGINT},#{iosPushId,jdbcType=VARCHAR},#{androidPushId,jdbcType=VARCHAR},#{account,jdbcType=INTEGER},#{appName,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.xinge.PushRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="url != null">url,</if>
      <if test="type != null">type,</if>
      <if test="title != null">title,</if>
      <if test="state != null">state,</if>
      <if test="createtime != null">createtime,</if>
      <if test="count != null">count,</if>
      <if test="iosPushId != null">iosPushId,</if>
      <if test="androidPushId != null">androidPushId,</if>
      <if test="account != null">account,</if>
      <if test="appName != null">appName,</if>
      <if test="uid != null">uid,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="url != null">#{url,jdbcType=VARCHAR},</if>
      <if test="type != null">#{type,jdbcType=INTEGER},</if>
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
      <if test="count != null">#{count,jdbcType=BIGINT},</if>
      <if test="iosPushId != null">#{iosPushId,jdbcType=VARCHAR},</if>
      <if test="androidPushId != null">#{androidPushId,jdbcType=VARCHAR},</if>
      <if test="account != null">#{account,jdbcType=INTEGER},</if>
      <if test="appName != null">#{appName,jdbcType=VARCHAR},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.xinge.PushRecord">update yeshi_ec_push_record set url = #{url,jdbcType=VARCHAR},type = #{type,jdbcType=INTEGER},title = #{title,jdbcType=VARCHAR},state = #{state,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT},count = #{count,jdbcType=BIGINT},iosPushId = #{iosPushId,jdbcType=VARCHAR},androidPushId = #{androidPushId,jdbcType=VARCHAR},account = #{account,jdbcType=INTEGER},appName = #{appName,jdbcType=VARCHAR},uid = #{uid,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.xinge.PushRecord">update yeshi_ec_push_record
    <set>
      <if test="url != null">url=#{url,jdbcType=VARCHAR},</if>
      <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
      <if test="title != null">title=#{title,jdbcType=VARCHAR},</if>
      <if test="state != null">state=#{state,jdbcType=INTEGER},</if>
      <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
      <if test="count != null">count=#{count,jdbcType=BIGINT},</if>
      <if test="iosPushId != null">iosPushId=#{iosPushId,jdbcType=VARCHAR},</if>
      <if test="androidPushId != null">androidPushId=#{androidPushId,jdbcType=VARCHAR},</if>
      <if test="account != null">account=#{account,jdbcType=INTEGER},</if>
      <if test="appName != null">appName=#{appName,jdbcType=VARCHAR},</if>
      <if test="uid != null">uid=#{uid,jdbcType=BIGINT},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listQuery" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_push_record p
    WHERE 1=1
        <if test="key != null and key != '' ">
            AND p.`title` LIKE '%${key}%' 
        </if>
        <if test="type != null and type != 0 ">
            AND p.`type` = #{type}
        </if>
    ORDER BY p.id DESC
    LIMIT #{start},#{count}
  </select>
  
  <select id="countQuery" resultType="java.lang.Long">
      SELECT IFNULL(COUNT(p.`id`),0) FROM yeshi_ec_push_record p
    WHERE 1=1
        <if test="key != null and key != '' ">
            AND p.`title` LIKE '%${key}%' 
        </if>
        <if test="type != null and type != 0 ">
            AND p.`type` = #{type}
        </if>
  </select>
  
  <select id="getByAndroidPushId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_push_record p
    WHERE p.`androidPushId` = #{pushId}
    LIMIT 1
  </select>
  
  <select id="getByIosPushId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_push_record p
    WHERE p.`iosPushId` = #{pushId}
    LIMIT 1
  </select>
  
</mapper>