mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?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.panzhihua.service_community.dao.ComBatteryCommodityOrderMapper">
 
    <resultMap type="com.panzhihua.service_community.entity.ComBatteryCommodityOrder" id="ComBatteryCommodityOrderMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="userId" column="user_id" jdbcType="INTEGER"/>
        <result property="storeId" column="store_id" jdbcType="INTEGER"/>
        <result property="addressId" column="address_id" jdbcType="INTEGER"/>
        <result property="activityId" column="activity_id" jdbcType="INTEGER"/>
        <result property="commodityId" column="commodity_id" jdbcType="INTEGER"/>
        <result property="specsId" column="specs_id" jdbcType="INTEGER"/>
        <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
        <result property="activityType" column="activity_type" jdbcType="INTEGER"/>
        <result property="status" column="status" jdbcType="INTEGER"/>
        <result property="collageStatus" column="collage_status" jdbcType="INTEGER"/>
        <result property="bargainStatus" column="bargain_status" jdbcType="INTEGER"/>
        <result property="payStatus" column="pay_status" jdbcType="INTEGER"/>
        <result property="isDel" column="is_del" jdbcType="INTEGER"/>
        <result property="payType" column="pay_type" jdbcType="INTEGER"/>
        <result property="count" column="count" jdbcType="INTEGER"/>
        <result property="price" column="price" jdbcType="VARCHAR"/>
        <result property="amount" column="amount" jdbcType="VARCHAR"/>
        <result property="freight" column="freight" jdbcType="VARCHAR"/>
        <result property="logisticsNo" column="logistics_no" jdbcType="VARCHAR"/>
        <result property="logisticsCompany" column="logistics_company" jdbcType="VARCHAR"/>
        <result property="finalAmount" column="final_amount" jdbcType="VARCHAR"/>
        <result property="payNo" column="pay_no" jdbcType="VARCHAR"/>
        <result property="payAmount" column="pay_amount" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="deliveryTime" column="delivery_time" jdbcType="TIMESTAMP"/>
        <result property="receivingTime" column="receiving_time" jdbcType="TIMESTAMP"/>
        <result property="createAt" column="create_at" jdbcType="TIMESTAMP"/>
        <result property="createBy" column="create_by" jdbcType="INTEGER"/>
        <result property="updateAt" column="update_at" jdbcType="TIMESTAMP"/>
        <result property="updateBy" column="update_by" jdbcType="INTEGER"/>
        <result property="receivingName" column="receiving_name" jdbcType="VARCHAR"/>
        <result property="receivingPhone" column="receiving_phone" jdbcType="VARCHAR"/>
        <result property="receivingRegion" column="receiving_region" jdbcType="VARCHAR"/>
        <result property="receivingAddress" column="receiving_address" jdbcType="VARCHAR"/>
    </resultMap>
 
    <!--查询单个-->
    <select id="queryById" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityOrderVo">
        SELECT
        cbco.id,
        cbco.user_id,
        cbco.store_id,
        cbco.address_id,
        cbco.activity_id,
        cbco.commodity_id,
        cbco.specs_id,
        cbco.order_no,
        cbco.activity_type,
        cbco.`status`,
        cbco.collage_status,
        cbco.bargain_status,
        cbco.pay_status,
        cbco.pay_type,
        cbco.count,
        cbco.price,
        cbco.amount,
        cbco.freight,
        cbco.logistics_no,
        cbco.logistics_company,
        cbco.final_amount,
        cbco.pay_no,
        cbco.pay_amount,
        cbco.remark,
        cbco.delivery_time,
        cbco.receiving_time,
        cbco.create_at,
        cbco.create_by,
        cbco.update_at,
        cbco.update_by,
        cbco.receiving_name,
        cbco.receiving_phone,
        cbco.receiving_region_code,
        cbco.receiving_region,
        cbco.receiving_address,
        su.phone,
        cbc.`name` as commodityName,
        cbcs.`name` as specsName
        FROM
        com_battery_commodity_order AS cbco
        left join sys_user as su on su.user_id = cbco.user_id
        left join com_battery_commodity as cbc on cbc.id = cbco.commodity_id
        left join com_battery_commodity_specs as cbcs on cbcs.id = cbco.specs_id
        where cbco.id = #{id}
    </select>
 
    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityOrderVo">
        SELECT
        cbco.id,
        cbco.user_id,
        cbco.store_id,
        cbco.address_id,
        cbco.activity_id,
        cbco.commodity_id,
        cbco.specs_id,
        cbco.order_no,
        cbco.activity_type,
        cbco.`status`,
        cbco.collage_status,
        cbco.bargain_status,
        cbco.pay_status,
        cbco.pay_type,
        cbco.count,
        cbco.price,
        cbco.amount,
        cbco.freight,
        cbco.logistics_no,
        cbco.logistics_company,
        cbco.final_amount,
        cbco.pay_no,
        cbco.pay_amount,
        cbco.remark,
        cbco.delivery_time,
        cbco.receiving_time,
        cbco.create_at,
        cbco.create_by,
        cbco.update_at,
        cbco.update_by,
        cbco.receiving_name,
        cbco.receiving_phone,
        cbco.receiving_region_code,
        cbco.receiving_region,
        cbco.receiving_address,
        su.phone,
        su.nick_name as nickName,
        cbc.`name` as commodityName,
        cbcs.`images` as commodityImages,
        cbcs.`name` as specsName
        FROM
        com_battery_commodity_order AS cbco
        left join sys_user as su on su.user_id = cbco.user_id
        left join com_battery_commodity as cbc on cbc.id = cbco.commodity_id
        left join com_battery_commodity_specs as cbcs on cbcs.id = cbco.specs_id
        <where>
            and cbco.is_del = 2
            <if test="dto.id != null">
                and cbco.id = #{dto.id}
            </if>
            <if test="dto.userId != null">
                and cbco.user_id = #{dto.userId}
            </if>
            <if test="dto.storeId != null">
                and cbco.store_id = #{dto.storeId}
            </if>
            <if test="dto.activityId != null">
                and cbco.activity_id = #{dto.activityId}
            </if>
            <if test="dto.orderNo != null and dto.orderNo != ''">
                and cbco.order_no = #{dto.orderNo}
            </if>
            <if test="dto.activityType != null">
                and cbco.activity_type = #{dto.activityType}
            </if>
            <if test="dto.status != null">
                and cbco.status = #{dto.status}
            </if>
            <if test="dto.collageStatus != null">
                and cbco.collage_status = #{dto.collageStatus}
            </if>
            <if test="dto.bargainStatus != null">
                and cbco.bargain_status = #{dto.bargainStatus}
            </if>
            <if test="dto.payStatus != null">
                and cbco.pay_status = #{dto.payStatus}
            </if>
            <if test="dto.payType != null">
                and cbco.pay_type = #{dto.payType}
            </if>
            <if test="dto.isApplets != null and dto.isApplets == 1">
                and cbco.status in (2,3,4)
            </if>
            <if test="dto.isAdmin != null and dto.isAdmin == 1">
                and cbco.status in (2,3,4)
            </if>
            <if test="dto.payNo != null and dto.payNo != ''">
                and cbco.pay_no = #{dto.payNo}
            </if>
        </where>
        order by cbco.create_at desc
    </select>
 
    <!--查询所有数据-->
    <select id="queryAllByList" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityOrderVo">
        SELECT
        cbco.id,
        cbco.user_id,
        cbco.store_id,
        cbco.address_id,
        cbco.activity_id,
        cbco.commodity_id,
        cbco.specs_id,
        cbco.order_no,
        cbco.activity_type,
        cbco.`status`,
        cbco.collage_status,
        cbco.bargain_status,
        cbco.pay_status,
        cbco.pay_type,
        cbco.count,
        cbco.price,
        cbco.amount,
        cbco.freight,
        cbco.logistics_no,
        cbco.logistics_company,
        cbco.final_amount,
        cbco.pay_no,
        cbco.pay_amount,
        cbco.remark,
        cbco.delivery_time,
        cbco.receiving_time,
        cbco.create_at,
        cbco.create_by,
        cbco.update_at,
        cbco.update_by,
        cbco.receiving_name,
        cbco.receiving_phone,
        cbco.receiving_region_code,
        cbco.receiving_region,
        cbco.receiving_address,
        su.phone,
        cbc.`name` as commodityName,
        cbcs.`images` as commodityImages,
        cbcs.`name` as specsName
        FROM
        com_battery_commodity_order AS cbco
        left join sys_user as su on su.user_id = cbco.user_id
        left join com_battery_commodity as cbc on cbc.id = cbco.commodity_id
        left join com_battery_commodity_specs as cbcs on cbcs.id = cbco.specs_id
        <where>
            and cbco.is_del = 2
            <if test="dto.id != null">
                and cbco.id = #{dto.id}
            </if>
            <if test="dto.userId != null">
                and cbco.user_id = #{dto.userId}
            </if>
            <if test="dto.storeId != null">
                and cbco.store_id = #{dto.storeId}
            </if>
            <if test="dto.activityId != null">
                and cbco.activity_id = #{dto.activityId}
            </if>
            <if test="dto.orderNo != null and dto.orderNo != ''">
                and cbco.order_no = #{dto.orderNo}
            </if>
            <if test="dto.activityType != null">
                and cbco.activity_type = #{dto.activityType}
            </if>
            <if test="dto.status != null">
                and cbco.status = #{dto.status}
            </if>
            <if test="dto.collageStatus != null">
                and cbco.collage_status = #{dto.collageStatus}
            </if>
            <if test="dto.bargainStatus != null">
                and cbco.bargain_status = #{dto.bargainStatus}
            </if>
            <if test="dto.payStatus != null">
                and cbco.pay_status = #{dto.payStatus}
            </if>
            <if test="dto.payType != null">
                and cbco.pay_type = #{dto.payType}
            </if>
            <if test="dto.payNo != null and dto.payNo != ''">
                and cbco.pay_no = #{dto.payNo}
            </if>
        </where>
        order by cbco.create_at desc
    </select>
 
    <select id="queryTeamIdByUserId" resultType="com.panzhihua.common.model.vos.common.ComBatteryActivityTeamVo">
        select id as teamId,create_at as teamEndTime from com_battery_commodity_order_collage_team
        where activity_id = #{activityId} and user_id = #{userId} and status = 1
    </select>
 
    <select id="queryTeamIdByUserIdBargain" resultType="com.panzhihua.common.model.vos.common.ComBatteryActivityTeamVo">
        select cbcob.id as teamId,cbcob.create_at as teamEndTime from com_battery_commodity_order_bargain as cbcob
        left join com_battery_commodity_order as cbco on cbco.id = cbcob.order_id
        where cbcob.user_id = #{userId} and cbcob.activity_id = #{activityId} and cbco.bargain_status = 1
    </select>
 
</mapper>