update customer package

This commit is contained in:
Timi
2026-09-06 15:49:57 +08:00
parent f3166f0413
commit db2fca5715
25 changed files with 394 additions and 608 deletions
@@ -1,11 +1,6 @@
<?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.GaoCustomerPackageMapper">
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
SELECT * FROM `gao_customer_package`
WHERE `id` = #{id} AND `deleted_at` IS NULL
FOR UPDATE
</select>
<select id="selectBySalesOrderId" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
SELECT * FROM `gao_customer_package`
WHERE `sales_order_id` = #{salesOrderId} AND `deleted_at` IS NULL
@@ -15,18 +10,19 @@
p.`deleted_at` IS NULL
<if test="storeId != null and storeId != ''">AND p.`store_id` = #{storeId}</if>
<if test="customerId != null and customerId != ''">AND p.`customer_id` = #{customerId}</if>
<if test="status != null">AND p.`status` = #{status}</if>
<if test="status != null">AND o.`status` = #{status}</if>
<if test="keyword != null and keyword.trim() != ''">AND (p.`package_name_snapshot` LIKE CONCAT('%', #{keyword}, '%') OR c.`name` LIKE CONCAT('%', #{keyword}, '%') OR c.`code` LIKE CONCAT('%', #{keyword}, '%'))</if>
</sql>
<select id="countByQuery" resultType="long">
SELECT COUNT(1) FROM `gao_customer_package` p
LEFT JOIN `gao_customer` c ON c.`id` = p.`customer_id`
INNER JOIN `gao_sales_order` o ON o.`id` = p.`sales_order_id` AND o.`store_id` = p.`store_id` AND o.`deleted_at` IS NULL
WHERE <include refid="queryWhere"/>
</select>
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
SELECT p.* FROM `gao_customer_package` p
LEFT JOIN `gao_customer` c ON c.`id` = p.`customer_id`
LEFT JOIN `gao_sales_order` o ON o.`id` = p.`sales_order_id` AND o.`store_id` = p.`store_id` AND o.`deleted_at` IS NULL
INNER JOIN `gao_sales_order` o ON o.`id` = p.`sales_order_id` AND o.`store_id` = p.`store_id` AND o.`deleted_at` IS NULL
WHERE <include refid="queryWhere"/>
ORDER BY o.`purchased_at` DESC, p.`created_at` DESC
LIMIT #{offset}, #{limit}