SellerOrderGoodsViewMapper.xml
6.42 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?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.SellerOrderGoodsViewMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.SellerOrderGoods">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="storage_id" jdbcType="INTEGER" property="storageId" />
<result column="depot_no" jdbcType="INTEGER" property="depotNo" />
<result column="size_id" jdbcType="INTEGER" property="sizeId" />
<result column="size_name" jdbcType="VARCHAR" property="sizeName" />
<result column="color_id" jdbcType="SMALLINT" property="colorId" />
<result column="color_name" jdbcType="VARCHAR" property="colorName" />
<result column="goods_price" jdbcType="DECIMAL" property="goodsPrice" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="batch_no" jdbcType="BIGINT" property="batchNo" />
<result column="storage_num" jdbcType="INTEGER" property="storageNum" />
<result column="size_num" jdbcType="INTEGER" property="sizeNum" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
</resultMap>
<sql id="Base_Column_List">
id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name,
color_id, color_name, goods_price, status, image_url, is_del, batch_no,attributes
</sql>
<select id="selectEntryCntByUidStatusGBSkc" resultType="java.lang.Integer">
SELECT COUNT(*) from (select sog.id FROM seller_order_goods sog,seller_order so
WHERE sog.id = so.skup and sog.uid = #{uid,jdbcType=INTEGER} and sog.is_del = 1
AND so.payment = 11
<if test="statusList != null">
and sog.status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
GROUP BY sog.uid,product_id) t
</select>
<sql id="Base_Column_List_with_table_name">
sog.id as id, sog.uid as uid, product_id, product_name,storage_id,depot_no,size_id,size_name,
color_id, color_name, goods_price, sog.status as status, image_url, sog.is_del as is_del, batch_no,
sog.attributes as attributes
</sql>
<select id="selectEntryListByUidStatusGBSkc" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List_with_table_name" /> FROM seller_order_goods sog,seller_order so
WHERE sog.id = so.skup and sog.uid = #{uid,jdbcType=INTEGER} and sog.is_del = 1 AND so.payment = 11
<if test="statusList != null">
and sog.status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
GROUP BY sog.uid,product_id ORDER BY id DESC
limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
</select>
<select id="selectByUidStatusGBSkc" resultMap="BaseResultMap">
SELECT `uid`,`product_id`,`product_name`,`color_id`,`color_name`,COUNT(size_id) size_num,SUM(size_storage) storage_num FROM
(
SELECT sog.`uid`,`product_id`,`product_name`,`color_id`,`color_name`,size_id,COUNT(`size_id`) size_storage
FROM seller_order_goods sog,seller_order so
WHERE sog.id = so.skup and sog.uid = #{uid,jdbcType=INTEGER} and sog.is_del = 1 AND so.payment = 11
<if test="statusList != null">
and sog.status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
AND product_id = #{productId,jdbcType=INTEGER}
GROUP BY sog.uid,size_id
) t
</select>
<select id="selectNotEntryCntByUidStatusGBSkc" resultType="java.lang.Integer">
SELECT COUNT(*) from (select sog.id FROM seller_order_goods sog,seller_order so
WHERE sog.id = so.skup and sog.uid = #{uid,jdbcType=INTEGER} and sog.is_del = 1
AND (so.payment != 11 or so.payment is null)
<if test="statusList != null">
and sog.status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
) t
</select>
<select id="selectNotEntryListByUidStatusGBSkc" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List_with_table_name" /> FROM seller_order_goods sog,seller_order so
WHERE sog.id = so.skup and sog.uid = #{uid,jdbcType=INTEGER} and sog.is_del = 1
AND (so.payment != 11 or so.payment is null)
<if test="statusList != null">
and sog.status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
ORDER BY id DESC
limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
</select>
<select id="selectEntryListByUidStatusGBSku" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List_with_table_name" />,COUNT(`size_id`) storage_num
FROM seller_order_goods sog,seller_order so WHERE sog.id = so.skup
AND sog.uid = #{condition.uid,jdbcType=INTEGER} AND so.payment = 11
AND sog.status = #{condition.status, jdbcType=TINYINT} AND product_id = #{condition.productId,jdbcType=INTEGER}
GROUP BY sog.attributes,size_id,`goods_price`
order by size_id,goods_price
limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
</select>
<select id="selectEntryCntByUidStatusGBSku" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" resultType="java.lang.Integer">
select count(*) FROM
(
SELECT size_id ,goods_price
FROM seller_order_goods sog,seller_order so WHERE sog.id = so.skup
AND sog.uid = #{uid,jdbcType=INTEGER} AND so.payment = 11
AND sog.status = #{status, jdbcType=TINYINT} AND product_id = #{productId,jdbcType=INTEGER}
GROUP BY sog.attributes,size_id,`goods_price`
) t
</select>
<select id="selectCanSellByStorageId" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM seller_order_goods
WHERE storage_id = #{storageId,jdbcType=INTEGER} and status = 1
</select>
</mapper>