add GaoPackage
This commit is contained in:
@@ -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} >= 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} >= 0
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user