admin
2019-08-27 fe879975a3e8a0a1aa280fb839e02d159bfbcff8
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
<?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.msg.MsgDeviceReadStateMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">
        <id column="mdrs_id" property="id" jdbcType="BIGINT" />
        <result column="mdrs_device" property="device" jdbcType="VARCHAR" />
        <result column="mdrs_platform" property="platform" jdbcType="INTEGER" />
        <result column="mdrs_type" property="type" jdbcType="VARCHAR" />
        <result column="mdrs_read_time" property="readTime" jdbcType="TIMESTAMP" />
        <result column="mdrs_unread_count" property="unReadCount"
            jdbcType="INTEGER" />
        <result column="mdrs_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="mdrs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="mdrs_latest_content" property="latestContent"
            jdbcType="VARCHAR" />
        <result column="mdrs_latest_content_time" property="latestContentTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content,mdrs_latest_content_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
        mdrs_platform=#{platform} and mdrs_type=#{type}
    </select>
    <select id="listByDeviceAndPlatform" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
        mdrs_platform=#{platform}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_device_read_state where mdrs_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_msg_device_read_state
        (mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content,mdrs_latest_content_time)
        values
        (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{readTime,jdbcType=TIMESTAMP},#{unReadCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{latestContent,jdbcType=VARCHAR},#{latestContentTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_device_read_state
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mdrs_id,</if>
            <if test="device != null">mdrs_device,</if>
            <if test="platform != null">mdrs_platform,</if>
            <if test="type != null">mdrs_type,</if>
            <if test="readTime != null">mdrs_read_time,</if>
            <if test="unReadCount != null">mdrs_unread_count,</if>
            <if test="createTime != null">mdrs_create_time,</if>
            <if test="updateTime != null">mdrs_update_time,</if>
            <if test="latestContent != null">mdrs_latest_content,</if>
            <if test="latestContentTime != null">mdrs_latest_content_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="device != null">#{device,jdbcType=VARCHAR},</if>
            <if test="platform != null">#{platform,jdbcType=INTEGER},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="readTime != null">#{readTime,jdbcType=TIMESTAMP},</if>
            <if test="unReadCount != null">#{unReadCount,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR},</if>
            <if test="latestContentTime != null">#{latestContentTime,jdbcType=TIMESTAMP}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">update
        yeshi_ec_msg_device_read_state set mdrs_device =
        #{device,jdbcType=VARCHAR},mdrs_platform =
        #{platform,jdbcType=INTEGER},mdrs_type =
        #{type,jdbcType=VARCHAR},mdrs_read_time =
        #{readTime,jdbcType=TIMESTAMP},mdrs_unread_count =
        #{unReadCount,jdbcType=INTEGER},mdrs_create_time =
        #{createTime,jdbcType=TIMESTAMP},mdrs_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,mdrs_latest_content
        =#{latestContent,jdbcType=VARCHAR},mdrs_latest_content_time
        =#{latestContentTime,jdbcType=TIMESTAMP} where mdrs_id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">
        update yeshi_ec_msg_device_read_state
        <set>
            <if test="device != null">mdrs_device=#{device,jdbcType=VARCHAR},</if>
            <if test="platform != null">mdrs_platform=#{platform,jdbcType=INTEGER},</if>
            <if test="type != null">mdrs_type=#{type,jdbcType=VARCHAR},</if>
            <if test="readTime != null">mdrs_read_time=#{readTime,jdbcType=TIMESTAMP},</if>
            <if test="unReadCount != null">mdrs_unread_count=#{unReadCount,jdbcType=INTEGER},</if>
            <if test="createTime != null">mdrs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mdrs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="id !=null">mdrs_id =#{id,jdbcType=BIGINT},</if>
            <if test="latestContent !=null">mdrs_latest_content =#{latestContent,jdbcType=VARCHAR},
            </if>
            <if test="latestContentTime !=null">mdrs_latest_content_time =#{latestContentTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where mdrs_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setAllMsgRead">update yeshi_ec_msg_device_read_state set
        mdrs_read_time=now(),mdrs_unread_count=0,mdrs_update_time=now() where
        mdrs_device=#{device} and mdrs_platform=#{platform}
    </update>
</mapper>