admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
<?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.MsgOtherDetailMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.MsgOtherDetail">
        <id column="mo_id" property="id" jdbcType="BIGINT" />
        <result column="mo_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeOtherTypeEnumHandler" />
        <result column="mo_content" property="content" jdbcType="VARCHAR" />
        <result column="mo_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="mo_read" property="read" jdbcType="BOOLEAN" />
        <result column="mo_source_id" property="sourceId" jdbcType="BIGINT" />
        <result column="mo_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="mo_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="extraInfo" property="extraInfo" jdbcType="VARCHAR"/>
        <association property="user" column="mo_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="mo_uid" property="id" jdbcType="BIGINT" />
        </association>
 
    </resultMap>
    <sql id="Base_Column_List">mo_id,mo_uid,mo_type,mo_content,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_source_id
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_other where mo_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        select d.*, t.`mea_content` AS extraInfo from yeshi_ec_msg_other d
        LEFT JOIN `yeshi_ec_msg_extra` t  ON (t.`mea_rid` = d.`mo_id` AND t.`mea_type` = 'other')
        where mo_uid = #{uid,jdbcType=BIGINT} 
        order by mo_create_time desc 
        limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">select count(mo_id) from yeshi_ec_msg_other where mo_uid
        = #{uid,jdbcType=BIGINT}</select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_other where mo_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOtherDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_other
        (mo_id,mo_uid,mo_type,mo_content,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_source_id)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{sourceId,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOtherDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_other
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mo_id,</if>
            <if test="user != null">mo_uid,</if>
            <if test="type != null">mo_type,</if>
            <if test="content != null">mo_content,</if>
            <if test="beiZhu != null">mo_beizhu,</if>
            <if test="read != null">mo_read,</if>
            <if test="createTime != null">mo_create_time,</if>
            <if test="updateTime != null">mo_update_time,</if>
            <if test="sourceId != null">mo_source_id,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="sourceId != null">#{sourceId,jdbcType=BIGINT}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOtherDetail">update
        yeshi_ec_msg_other set mo_uid = #{user.id,jdbcType=BIGINT},mo_type =
        #{type,jdbcType=VARCHAR},mo_content =
        #{content,jdbcType=VARCHAR},mo_beizhu =
        #{beiZhu,jdbcType=VARCHAR},mo_read =
        #{read,jdbcType=BOOLEAN},mo_create_time =
        #{createTime,jdbcType=TIMESTAMP},mo_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,mo_source_id
        =#{sourceId,jdbcType=BIGINT} where mo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOtherDetail">
        update yeshi_ec_msg_other
        <set>
            <if test="user != null">mo_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">mo_type=#{type,jdbcType=VARCHAR},</if>
            <if test="content != null">mo_content=#{content,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">mo_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">mo_read=#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">mo_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="sourceId !=null">mo_source_id =#{sourceId,jdbcType=BIGINT},</if>
        </set>
        where mo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">update
        yeshi_ec_msg_other set mo_read=1 where mo_uid = #{uid,jdbcType=BIGINT}
    </update>
</mapper>