add quick fulfillment
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<?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.imyeyu.api.modules.gao.mapper.GaoCustomerMapper">
|
||||
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT * FROM `gao_customer` WHERE `id` = #{id} AND `deleted_at` IS NULL FOR UPDATE
|
||||
</select>
|
||||
<select id="selectByIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT
|
||||
*
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
WHERE `store_id` = #{storeId} AND `request_no` = #{requestNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectByRequestNoPrefix" resultType="com.imyeyu.api.modules.gao.entity.GaoOrderFulfillment">
|
||||
SELECT * FROM `gao_order_fulfillment`
|
||||
WHERE `store_id` = #{storeId} AND `request_no` LIKE CONCAT(#{requestNoPrefix}, '%')
|
||||
ORDER BY `created_at`, `sales_order_id`
|
||||
</select>
|
||||
<select id="selectById" resultType="com.imyeyu.api.modules.gao.entity.GaoOrderFulfillment">
|
||||
SELECT * FROM `gao_order_fulfillment`
|
||||
WHERE `id` = #{id}
|
||||
|
||||
@@ -81,6 +81,39 @@
|
||||
ORDER BY o.`purchased_at` DESC, o.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<select id="selectQuickFulfillmentSourceRows" resultType="com.imyeyu.api.modules.gao.vo.GaoQuickFulfillmentSourceRow">
|
||||
SELECT o.`id` AS `salesOrderId`, o.`order_no` AS `orderNo`, o.`order_type` AS `orderType`,
|
||||
o.`payment_status` AS `paymentStatus`,
|
||||
o.`created_at` AS `orderCreatedAt`,
|
||||
(SELECT cp.`package_name_snapshot` FROM `gao_customer_package` cp
|
||||
WHERE cp.`sales_order_id` = o.`id` AND cp.`deleted_at` IS NULL LIMIT 1) AS `packageName`,
|
||||
COALESCE(o.`sale_amount`, 0) AS `saleAmount`,
|
||||
COALESCE(o.`paid_amount`, 0) AS `paidAmount`,
|
||||
GREATEST(COALESCE(o.`sale_amount`, 0) - COALESCE(o.`paid_amount`, 0), 0) AS `unpaidAmount`,
|
||||
i.`id` AS `sourceOrderItemId`, i.`sku_id` AS `skuId`,
|
||||
p.`name` AS `productName`,
|
||||
i.`product_name_snapshot` AS `productNameSnapshot`, i.`sku_name_snapshot` AS `skuNameSnapshot`,
|
||||
COALESCE(i.`base_quantity`, 0) - COALESCE(i.`reserved_base_quantity`, 0) - COALESCE(i.`fulfilled_base_quantity`, 0) AS `availableBaseQuantity`
|
||||
FROM `gao_sales_order_item` i
|
||||
INNER JOIN `gao_sales_order` o ON o.`id` = i.`sales_order_id` AND o.`deleted_at` IS NULL
|
||||
INNER JOIN `gao_product_sku` s ON s.`id` = i.`sku_id` AND s.`deleted_at` IS NULL
|
||||
INNER JOIN `gao_product` p ON p.`id` = s.`product_id` AND p.`deleted_at` IS NULL
|
||||
WHERE i.`deleted_at` IS NULL AND o.`store_id` = #{storeId} AND o.`customer_id` = #{customerId}
|
||||
AND o.`status` <> 'CANCELLED'
|
||||
AND (#{allowUnpaid} OR o.`sale_amount` = 0 OR o.`paid_amount` = o.`sale_amount`)
|
||||
AND ((o.`order_type` = 'PACKAGE' AND i.`item_type` = 'PACKAGE_ENTITLEMENT')
|
||||
OR (o.`order_type` = 'DIRECT_PRODUCT' AND i.`item_type` = 'DIRECT_PRODUCT'))
|
||||
AND COALESCE(i.`base_quantity`, 0) - COALESCE(i.`reserved_base_quantity`, 0) - COALESCE(i.`fulfilled_base_quantity`, 0) > 0
|
||||
<if test="skuIdList != null and skuIdList.size() > 0">
|
||||
AND i.`sku_id` IN
|
||||
<foreach collection="skuIdList" item="skuId" open="(" separator="," close=")">#{skuId}</foreach>
|
||||
</if>
|
||||
<if test="salesOrderIdList != null and salesOrderIdList.size() > 0">
|
||||
AND o.`id` IN
|
||||
<foreach collection="salesOrderIdList" item="salesOrderId" open="(" separator="," close=")">#{salesOrderId}</foreach>
|
||||
</if>
|
||||
ORDER BY o.`purchased_at` ASC, o.`created_at` ASC, o.`id` ASC, i.`sort` ASC, i.`created_at` ASC, i.`id` ASC
|
||||
</select>
|
||||
<select id="selectSummaryByQuery" resultType="com.imyeyu.api.modules.gao.vo.GaoSalesOrderReceivableStatView">
|
||||
SELECT
|
||||
COUNT(1) AS `orderCount`,
|
||||
|
||||
Reference in New Issue
Block a user