OrderItemMapper.xml
3.45 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
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
<?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.b2c.orders.dao.impl.OrderItemDaoBean">
<resultMap id="OrderItemRM" type="com.b2c.orders.domain.OrderItem">
<id property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="shopId" column="shop_id" />
<result property="amount" column="amount" />
<result property="versionNum" column="version_num" />
<result property="editTime" column="edit_time" />
<result property="createTime" column="create_time" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="sku" column="sku" />
<result property="skuTitle" column="sku_title" />
<result property="skuAttributes" column="sku_attributes" />
<result property="skuPrice" column="sku_price" />
<result property="priceUnit" column="price_unit" />
<result property="skuPicture" column="sku_picture" />
</resultMap>
<sql id="selectCondition">
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.orderId != null and param.orderId != ''">
and order_id = #{param.orderId}
</if>
<if test="param.productId != null and param.productId != ''">
and product_id = #{param.productId}
</if>
<if test="param.productName != null and param.productName != ''">
and product_name = #{param.productName}
</if>
<if test="param.shopId != null and param.shopId != ''">
and shop_id = #{param.shopId}
</if>
<if test="param.sku != null and param.sku != ''">
and sku = #{param.sku}
</if>
<if test="param.skuTitle != null and param.skuTitle != ''">
and sku_title = #{param.skuTitle}
</if>
<if test="param.skuAttributes != null and param.skuAttributes != ''">
and sku_attributes = #{param.skuAttributes}
</if>
<if test="param.amount != null and param.amount != ''">
and amount = #{param.amount}
</if>
<if test="param.skuPrice != null and param.skuPrice != ''">
and sku_price = #{param.skuPrice}
</if>
<if test="param.priceUnit != null and param.priceUnit != ''">
and price_unit = #{param.priceUnit}
</if>
</if>
</sql>
<select id="findByOrderId" parameterType="Long" resultMap="OrderItemRM">
<![CDATA[
SELECT
id,
order_id,
product_id,
product_name,
shop_id,
sku,
sku_title,
sku_attributes,
amount,
sku_price,
price_unit,
sku_picture,
version_num,
edit_time,
create_time
FROM t_order_item
WHERE order_id = #{orderId}
]]>
</select>
<insert id="save" parameterType="com.b2c.orders.domain.OrderItem">
<![CDATA[
INSERT INTO t_order_item(
id,
order_id,
product_id,
product_name,
shop_id,
sku,
sku_title,
sku_attributes,
amount,
sku_price,
price_unit,
sku_picture
) VALUES(
#{id},
#{orderId},
#{productId},
#{productName},
#{shopId},
#{sku},
#{skuTitle},
#{skuAttributes},
#{amount},
#{skuPrice},
#{priceUnit},
#{skuPicture}
)
]]>
</insert>
</mapper>