admin
2019-11-23 51a4ff5d777028d52a19c314a99f796334cb7b51
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
<?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.goods.recommend.RecommendGoodsDeleteHistoryMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory">
        <id column="ud_id" property="id" jdbcType="BIGINT" />
        <result column="ud_device" property="device" jdbcType="VARCHAR" />
        <result column="ud_uid" property="uid" jdbcType="BIGINT" />
        <result column="ud_goods_id" property="goodsId" jdbcType="BIGINT" />
        <result column="ud_goods_source" property="goodsSource"
            jdbcType="INTEGER" />
        <result column="ud_reason" property="reason" jdbcType="VARCHAR" />
        <result column="ud_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ud_beizhu" property="beiZhu" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">ud_id,ud_device,ud_uid,ud_goods_id,ud_goods_source,ud_reason,ud_create_time,ud_beizhu
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_recommend_goods_user_delete where ud_id =
        #{id,jdbcType=BIGINT}
    </select>
 
 
    <select id="listByGoodsInfo" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_recommend_goods_user_delete where ud_device =
        #{device}
        <foreach collection="goodsList" item="item" open=" and ("
            close=")" separator=" or ">
            (
            ud_goods_id= #{item.goodsId} and ud_goods_source=#{item.goodsSource}
            )
        </foreach>
    </select>
    
    <select id="listBackStage" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_recommend_goods_user_delete
        WHERE 1=1  <if test="key != null ">
                    AND (t.`ud_uid` = ${key} OR t.`ud_reason` LIKE '%${key}%')
                   </if>
        LIMIT #{start},#{count}
    </select>
 
    <select id="countBackStage" resultMap="BaseResultMap">
        SELECT IFNULL(COUNT(t.`ud_id`),0) FROM yeshi_ec_recommend_goods_user_delete  t
        WHERE 1=1  <if test="key != null ">
                    AND (t.`ud_uid` = ${key} OR t.`ud_reason` LIKE '%${key}%')
                   </if>
    </select>
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_recommend_goods_user_delete where ud_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_recommend_goods_user_delete
        (ud_id,ud_device,ud_uid,ud_goods_id,ud_goods_source,ud_reason,ud_create_time,ud_beizhu)
        values
        (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{goodsId,jdbcType=BIGINT},#{goodsSource,jdbcType=INTEGER},#{reason,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_recommend_goods_user_delete
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ud_id,</if>
            <if test="device != null">ud_device,</if>
            <if test="uid != null">ud_uid,</if>
            <if test="goodsId != null">ud_goods_id,</if>
            <if test="goodsSource != null">ud_goods_source,</if>
            <if test="reason != null">ud_reason,</if>
            <if test="createTime != null">ud_create_time,</if>
            <if test="beiZhu != null">ud_beizhu,</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="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="goodsId != null">#{goodsId,jdbcType=BIGINT},</if>
            <if test="goodsSource != null">#{goodsSource,jdbcType=INTEGER},</if>
            <if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory">update yeshi_ec_recommend_goods_user_delete set
        ud_device = #{device,jdbcType=VARCHAR},ud_uid =
        #{uid,jdbcType=BIGINT},ud_goods_id =
        #{goodsId,jdbcType=BIGINT},ud_goods_source =
        #{goodsSource,jdbcType=INTEGER},ud_reason =
        #{reason,jdbcType=VARCHAR},ud_create_time =
        #{createTime,jdbcType=TIMESTAMP},ud_beizhu =
        #{beiZhu,jdbcType=VARCHAR} where ud_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory">
        update yeshi_ec_recommend_goods_user_delete
        <set>
            <if test="device != null">ud_device=#{device,jdbcType=VARCHAR},</if>
            <if test="uid != null">ud_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="goodsId != null">ud_goods_id=#{goodsId,jdbcType=BIGINT},</if>
            <if test="goodsSource != null">ud_goods_source=#{goodsSource,jdbcType=INTEGER},</if>
            <if test="reason != null">ud_reason=#{reason,jdbcType=VARCHAR},</if>
            <if test="createTime != null">ud_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">ud_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
        </set>
        where ud_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>