CutDownPriceUserHelpMapper.xml
3.86 KB
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
<?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.yoho.activity.dal.CutDownPriceUserHelpMapper">
<resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.CutDownPriceProductHelpUser">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="help_user_id" property="helpUserId" jdbcType="INTEGER" />
<result column="activity_id" property="activityId" jdbcType="INTEGER" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="cut_record_id" property="cutRecordId" jdbcType="INTEGER" />
<result column="cut_price" property="cutPrice" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="userName" property="userName" jdbcType="VARCHAR" />
<result column="userImgUrl" property="userImgUrl" jdbcType="VARCHAR" />
<result column="helpUserName" property="helpUserName" jdbcType="VARCHAR" />
<result column="helpUserImgUrl" property="helpUserImgUrl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl
</sql>
<select id="selectHelpInfo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cutdown_price_help_user
where user_id = #{userId,jdbcType=INTEGER}
and activity_id = #{activityId,jdbcType=INTEGER}
and product_skn = #{productSkn,jdbcType=INTEGER}
and cut_record_id = #{cutRecordId,jdbcType=INTEGER}
</select>
<insert id="addHelpUserInfo" parameterType="com.yoho.activity.dal.model.CutDownPriceProductHelpUser">
insert into cutdown_price_help_user (user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl)
values (#{userId,jdbcType=INTEGER}, #{helpUserId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER},
#{cutRecordId,jdbcType=INTEGER}, #{cutPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userImgUrl,jdbcType=VARCHAR}, #{helpUserName,jdbcType=VARCHAR}, #{helpUserImgUrl,jdbcType=VARCHAR}
)
</insert>
<select id="selectExistHelpInfoCurrentDay" resultType="java.lang.Integer">
select count(1) FROM cutdown_price_help_user
where help_user_id = #{helpUserId,jdbcType=INTEGER}
AND activity_id = #{activityId,jdbcType=INTEGER}
AND product_skn = #{productSkn,jdbcType=INTEGER}
and create_time >= #{startTime,jdbcType=INTEGER}
</select>
<select id="selectExistHelpInfo" resultType="java.lang.Integer">
select count(1) FROM cutdown_price_help_user
where help_user_id = #{helpUserId,jdbcType=INTEGER}
AND activity_id = #{activityId,jdbcType=INTEGER}
AND product_skn = #{productSkn,jdbcType=INTEGER}
and cut_record_id = #{cutRecordId,jdbcType=INTEGER}
</select>
<select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from cutdown_price_help_user
where
<foreach collection="list" item="item" index="index" separator="OR">
(user_id = #{item.userId,jdbcType=INTEGER} and activity_id=#{item.activityId,jdbcType=INTEGER} and product_skn=#{item.productSkn,jdbcType=INTEGER})
</foreach>
</select>
<select id="selectHelpInfoListCurrentDay" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from cutdown_price_help_user
where
help_user_id = #{helpUserId,jdbcType=INTEGER}
and create_time >= #{startTime,jdbcType=INTEGER}
and create_time <= #{endTime,jdbcType=INTEGER}
</select>
</mapper>