Administrator
2018-11-05 2d950dce7919a2bc39464f9d264f7b96b69f6d1e
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?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.activity.RecommendActivityMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.activity.RecommendActivity">
        <id column="ar_id" property="id" jdbcType="BIGINT" />
        <result column="ar_title" property="title" jdbcType="VARCHAR" />
        <result column="ar_type" property="type" jdbcType="INTEGER" />
        <result column="ar_order_by" property="orderBy" jdbcType="INTEGER" />
        <result column="ar_share_count" property="shareCount" jdbcType="INTEGER" />
        <result column="ar_total_getmoney" property="totalGetMoney"
            jdbcType="VARCHAR" />
        <result column="ar_video_post_picture" property="videoPostPictire"
            jdbcType="VARCHAR" />
        <result column="ar_video_url" property="videoUrl" jdbcType="VARCHAR" />
        <result column="ar_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ar_top" property="top" jdbcType="BOOLEAN" />
        <association property="activityUser" column="ar_activity_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper.BaseResultMap" />
 
        <association property="goodsList" column="ar_id"
            select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityTaoBaoGoodsMapper.selectByActivityId">
        </association>
        <association property="imageList" column="ar_id"
            select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgByActivityId">
        </association>
 
        <association property="widthAndHeight" column="ar_id"
            select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgWithAndHeightByActivityId">
        </association>
 
 
    </resultMap>
    <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid as
        au_id,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}
    </select>
 
 
    <select id="getRecommendActivityList" resultMap="BaseResultMap">
        select
        *
        from
        yeshi_ec_activity_recommend left join yeshi_ec_activity_user on
        ar_activity_uid=au_id order by ar_top desc,ar_order_by
        asc,ar_create_time desc limit #{start},#{count}
    </select>
 
 
    <select id="queryRecommendActivityList" resultMap="BaseResultMap">
        select
        *
        from
        yeshi_ec_activity_recommend left join yeshi_ec_activity_user on
        ar_activity_uid=au_id where ar_title like '%${title}%' order by ar_top
        desc,ar_order_by
        asc,ar_create_time desc limit ${start},${count}
    </select>
 
    <select id="getRecommendActivityCount" resultType="java.lang.Long">
        select
        count(ar_id)
        from yeshi_ec_activity_recommend
    </select>
 
 
 
    <select id="getRecommendActivityListByType" resultMap="BaseResultMap">
        select
        *
        from
        yeshi_ec_activity_recommend left join yeshi_ec_activity_user on
        ar_activity_uid=au_id where ar_type=#{type} order by ar_top
        desc,ar_order_by
        asc,ar_create_time desc limit ${start},${count}
    </select>
 
 
    <select id="getRecommendActivityCountByType" resultType="java.lang.Long"
        parameterType="java.lang.Integer">
        select
        count(ar_id)
        from yeshi_ec_activity_recommend where
        ar_type=#{type}
    </select>
 
 
 
 
 
 
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}
    </delete>
 
    <delete id="batchDeleteByPrimaryKey" parameterType="int">
        <!-- 批量删除动态信息 -->
        delete from yeshi_ec_activity_recommend where ar_id in
        <foreach item="arids" collection="array" open="(" separator=","
            close=")">
            #{arids}
        </foreach>
    </delete>
 
 
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_activity_recommend
        (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top)
        values
        (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_activity_recommend
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ar_id,</if>
            <if test="title != null">ar_title,</if>
            <if test="type != null">ar_type,</if>
            <if test="orderBy != null">ar_order_by,</if>
            <if test="activityUser != null">ar_activity_uid,</if>
            <if test="shareCount != null">ar_share_count,</if>
            <if test="totalGetMoney != null">ar_total_getmoney,</if>
            <if test="videoPostPictire != null">ar_video_post_picture,</if>
            <if test="videoUrl != null">ar_video_url,</if>
            <if test="createTime != null">ar_create_time,</if>
            <if test="top != null">ar_top,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if>
            <if test="activityUser != null">#{activityUser.id,jdbcType=BIGINT},</if>
            <if test="shareCount != null">#{shareCount,jdbcType=INTEGER},</if>
            <if test="totalGetMoney != null">#{totalGetMoney,jdbcType=VARCHAR},</if>
            <if test="videoPostPictire != null">#{videoPostPictire,jdbcType=VARCHAR},</if>
            <if test="videoUrl != null">#{videoUrl,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="top != null">#{top,jdbcType=BOOLEAN}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title =
        #{title,jdbcType=VARCHAR},ar_type =
        #{type,jdbcType=INTEGER},ar_order_by =
        #{orderBy,jdbcType=INTEGER},ar_activity_uid =
        #{activityUser.id,jdbcType=BIGINT},ar_share_count =
        #{shareCount,jdbcType=INTEGER},ar_total_getmoney =
        #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture =
        #{videoPostPictire,jdbcType=VARCHAR},ar_video_url =
        #{videoUrl,jdbcType=VARCHAR},ar_create_time =
        #{createTime,jdbcType=TIMESTAMP} ,ar_top =#{top,jdbcType=BOOLEAN}
        where ar_id = #{id,jdbcType=BIGINT}
    </update>
 
 
    <update id="addShareCount">update yeshi_ec_activity_recommend set ar_share_count
        =ar_share_count+#{count}
        where ar_id = #{id,jdbcType=BIGINT}
    </update>
 
 
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">
        update yeshi_ec_activity_recommend
        <set>
            <if test="title != null">ar_title=#{title,jdbcType=VARCHAR},</if>
            <if test="type != null">ar_type=#{type,jdbcType=INTEGER},</if>
            <if test="orderBy != null">ar_order_by=#{orderBy,jdbcType=INTEGER},</if>
            <if test="activityUser != null">ar_activity_uid=#{activityUser.id,jdbcType=BIGINT},</if>
            <if test="shareCount != null">ar_share_count=#{shareCount,jdbcType=INTEGER},</if>
            <if test="totalGetMoney != null">ar_total_getmoney=#{totalGetMoney,jdbcType=VARCHAR},</if>
            <if test="videoPostPictire != null">ar_video_post_picture=#{videoPostPictire,jdbcType=VARCHAR},
            </if>
            <if test="videoUrl != null">ar_video_url=#{videoUrl,jdbcType=VARCHAR},</if>
            <if test="createTime != null">ar_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="top !=null">ar_top =#{top,jdbcType=BOOLEAN},</if>
        </set>
        where ar_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>