BuyerOrderPromotionMapper.xml
2.1 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
<?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.yohoufo.dal.order.BuyerOrderPromotionMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.BuyerOrderPromotion">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="promotion_id" jdbcType="INTEGER" property="promotionId" />
<result column="promotion_content" jdbcType="VARCHAR" property="promotionContent" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, promotion_id, promotion_content
</sql>
<select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from buyer_order_promotion
where order_code = #{orderCode,jdbcType=BIGINT}
order by id desc limit 1
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrderPromotion" useGeneratedKeys="true">
insert into buyer_order_promotion (uid, order_code, promotion_id,
promotion_content)
values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT},
#{promotionId,jdbcType=INTEGER},
#{promotionContent,jdbcType=VARCHAR})
</insert>
<select id="selectByUidPromotionId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from buyer_order_promotion
where uid = #{uid,jdbcType=INTEGER}
and promotion_id = #{promotionId,jdbcType=INTEGER}
</select>
<select id="selectCntByUidPromotionIdStatus" resultType="java.lang.Integer">
select count(*) from buyer_order bo,buyer_order_promotion bop
where bo.uid = #{uid,jdbcType=INTEGER}
and bo.order_code = bop.order_code
and bop.promotion_id = #{promotionId,jdbcType=INTEGER}
and bo.status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</select>
</mapper>