add gao product
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?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.GaoSalesOrderMapper">
|
||||
<select id="selectByRequestNo" resultType="com.imyeyu.api.modules.gao.entity.GaoSalesOrder">
|
||||
SELECT * FROM `gao_sales_order`
|
||||
WHERE `store_id` = #{storeId} AND `request_no` = #{requestNo} AND `deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoSalesOrder">
|
||||
SELECT * FROM `gao_sales_order`
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL
|
||||
FOR UPDATE
|
||||
</select>
|
||||
<sql id="queryWhere">
|
||||
o.`deleted_at` IS NULL
|
||||
<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="orderType != null">AND o.`order_type` = #{orderType}</if>
|
||||
<if test="status != null">AND o.`status` = #{status}</if>
|
||||
<if test="paymentStatus != null">AND o.`payment_status` = #{paymentStatus}</if>
|
||||
<if test="fulfilledButUnpaid != null and fulfilledButUnpaid">AND o.`status` = 'FULFILLED' AND o.`paid_amount` < o.`sale_amount`</if>
|
||||
<if test="keyword != null and keyword.trim() != ''">AND (o.`order_no` LIKE CONCAT('%', #{keyword}, '%') OR c.`name` LIKE CONCAT('%', #{keyword}, '%') OR c.`code` LIKE CONCAT('%', #{keyword}, '%'))</if>
|
||||
<if test="beginAt != null">AND o.`purchased_at` >= #{beginAt}</if>
|
||||
<if test="endAt != null">AND o.`purchased_at` <= #{endAt}</if>
|
||||
</sql>
|
||||
<select id="countByQuery" resultType="long">
|
||||
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"/>
|
||||
ORDER BY o.`purchased_at` DESC, o.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<update id="updatePayment">
|
||||
UPDATE `gao_sales_order`
|
||||
SET `pending_paid_amount` = #{pendingPaidAmount}, `paid_amount` = #{paidAmount}, `refunded_amount` = #{refundedAmount},
|
||||
`payment_status` = #{paymentStatus}, `refund_status` = #{refundStatus}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL
|
||||
</update>
|
||||
<update id="cancelIf">
|
||||
UPDATE `gao_sales_order`
|
||||
SET `status` = #{toStatus}, `cancelled_at` = #{cancelledAt}, `cancel_operator_user_id` = #{cancelOperatorUserId},
|
||||
`cancel_reason` = #{cancelReason}, `refund_status` = #{refundStatus}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `status` = #{fromStatus} AND `deleted_at` IS NULL
|
||||
</update>
|
||||
<update id="updateSourceEventRecordId">
|
||||
UPDATE `gao_sales_order`
|
||||
SET `source_event_record_id` = #{sourceEventRecordId}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `source_event_record_id` IS NULL AND `deleted_at` IS NULL
|
||||
</update>
|
||||
<update id="updateStatus">
|
||||
UPDATE `gao_sales_order`
|
||||
SET `status` = #{status}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user