add GaoPackage

This commit is contained in:
Timi
2026-08-31 20:31:28 +08:00
parent 4a7de1909c
commit b4b6a13f8d
60 changed files with 4132 additions and 5 deletions
@@ -0,0 +1,35 @@
<?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.GaoCustomerPackageItemMapper">
<select id="selectByCustomerPackageId" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackageItem">
SELECT * FROM `gao_customer_package_item`
WHERE `customer_package_id` = #{customerPackageId} AND `deleted_at` IS NULL
ORDER BY `sort`, `created_at`
</select>
<select id="selectByCustomerPackageIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackageItem">
SELECT * FROM `gao_customer_package_item`
WHERE `deleted_at` IS NULL
<choose>
<when test="customerPackageIdList != null and !customerPackageIdList.isEmpty()">
AND `customer_package_id` IN <foreach collection="customerPackageIdList" item="id" open="(" separator="," close=")">#{id}</foreach>
</when>
<otherwise>AND FALSE</otherwise>
</choose>
ORDER BY `customer_package_id`, `sort`, `created_at`
</select>
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackageItem">
SELECT * FROM `gao_customer_package_item`
WHERE `id` = #{id} AND `deleted_at` IS NULL
FOR UPDATE
</select>
<update id="updateReservedQuantity">
UPDATE `gao_customer_package_item`
SET `reserved_quantity` = `reserved_quantity` + #{delta}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
WHERE `id` = #{id} AND `deleted_at` IS NULL AND `reserved_quantity` + #{delta} &gt;= 0
</update>
<update id="updateDeliveredQuantity">
UPDATE `gao_customer_package_item`
SET `delivered_quantity` = `delivered_quantity` + #{delta}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
WHERE `id` = #{id} AND `deleted_at` IS NULL AND `delivered_quantity` + #{delta} &gt;= 0
</update>
</mapper>