feat: recycle system
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
</select>
|
||||
<sql id="queryWhere">
|
||||
o.`deleted_at` IS NULL
|
||||
<if test="orderAllowed != null and !orderAllowed">AND o.`order_type` = 'RECYCLE'</if>
|
||||
<if test="recycleAllowed != null and !recycleAllowed">AND o.`order_type` <> 'RECYCLE'</if>
|
||||
<if test="storeId != null and storeId != ''">AND o.`store_id` = #{storeId}</if>
|
||||
<if test="customerId != null and customerId != ''">AND o.`customer_id` = #{customerId}</if>
|
||||
<if test="fulfillableSkuId != null and fulfillableSkuId != ''">
|
||||
@@ -86,7 +88,17 @@
|
||||
SELECT COUNT(1) FROM `gao_sales_order` o LEFT JOIN `gao_customer` c ON c.`id` = o.`customer_id` WHERE <include refid="queryWhere"/>
|
||||
</select>
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoSalesOrder">
|
||||
SELECT o.* FROM `gao_sales_order` o LEFT JOIN `gao_customer` c ON c.`id` = o.`customer_id` WHERE <include refid="queryWhere"/>
|
||||
SELECT o.*,
|
||||
(SELECT SUM(p.`quantity`) FROM `gao_recycle_payment` p
|
||||
WHERE p.`order_id` = o.`id` AND p.`status` = 'PENDING') AS `recyclePendingQuantity`,
|
||||
<!-- 回收物名称与单位取兑换单创建时的快照,回收物改名后历史订单仍显示当时的名称 -->
|
||||
e.`id` AS `recycleExchangeId`,
|
||||
e.`recycle_name_snapshot` AS `recycleItemName`,
|
||||
e.`recycle_unit_snapshot` AS `recycleUnit`
|
||||
FROM `gao_sales_order` o
|
||||
LEFT JOIN `gao_customer` c ON c.`id` = o.`customer_id`
|
||||
LEFT JOIN `gao_recycle_exchange` e ON e.`sales_order_id` = o.`id`
|
||||
WHERE <include refid="queryWhere"/>
|
||||
ORDER BY o.`purchased_at` DESC, o.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user