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>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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="selectByRequestNo" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
|
||||
SELECT * FROM `gao_customer_package`
|
||||
WHERE `store_id` = #{storeId} AND `request_no` = #{requestNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectByRequestNoAnyStore" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
|
||||
SELECT * FROM `gao_customer_package`
|
||||
WHERE `request_no` = #{requestNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<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="selectByPurchaseEventRecordId" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerPackage">
|
||||
SELECT * FROM `gao_customer_package`
|
||||
WHERE `purchase_event_record_id` = #{purchaseEventRecordId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<sql id="queryWhere">
|
||||
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="paymentStatus != null">AND p.`payment_status` = #{paymentStatus}</if>
|
||||
<if test="refundStatus != null">AND p.`refund_status` = #{refundStatus}</if>
|
||||
<if test="beginAt != null">AND p.`purchased_at` >= #{beginAt}</if>
|
||||
<if test="endAt != null">AND p.`purchased_at` <= #{endAt}</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`
|
||||
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`
|
||||
WHERE <include refid="queryWhere"/>
|
||||
ORDER BY p.`purchased_at` DESC, p.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<update id="updatePendingPaidAmountDelta">
|
||||
UPDATE `gao_customer_package`
|
||||
SET `pending_paid_amount` = `pending_paid_amount` + #{delta}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL AND `pending_paid_amount` + #{delta} >= 0
|
||||
</update>
|
||||
<update id="updatePaidAmountDelta">
|
||||
UPDATE `gao_customer_package`
|
||||
SET `paid_amount` = `paid_amount` + #{delta}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL AND `paid_amount` + #{delta} >= 0
|
||||
</update>
|
||||
<update id="updateStatusIf">
|
||||
UPDATE `gao_customer_package`
|
||||
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>
|
||||
</mapper>
|
||||
@@ -136,6 +136,9 @@
|
||||
AND (
|
||||
c.`code` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR c.`name` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR c.`name_pinyin_full` LIKE CONCAT(#{keyword}, '%')
|
||||
OR c.`name_pinyin_initial` LIKE CONCAT(#{keyword}, '%')
|
||||
OR c.`name_pinyin_mixed` LIKE CONCAT(#{keyword}, '%')
|
||||
OR r.`remark` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR r.`operator_user_id` LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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.GaoFundRecordMapper">
|
||||
<select id="selectByRequestNo" resultType="com.imyeyu.api.modules.gao.entity.GaoFundRecord">
|
||||
SELECT * FROM `gao_fund_record`
|
||||
WHERE `store_id` = #{storeId} AND `request_no` = #{requestNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoFundRecord">
|
||||
SELECT * FROM `gao_fund_record`
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL
|
||||
FOR UPDATE
|
||||
</select>
|
||||
<select id="selectRevokeBySourceRecordId" resultType="com.imyeyu.api.modules.gao.entity.GaoFundRecord">
|
||||
SELECT * FROM `gao_fund_record`
|
||||
WHERE `source_record_id` = #{sourceRecordId} AND `deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="countPendingReceiveByBizId" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_fund_record`
|
||||
WHERE `biz_id` = #{bizId} AND `operation_type` = 'RECEIVE' AND `status` = 'PENDING' AND `deleted_at` IS NULL
|
||||
</select>
|
||||
<select id="selectByBizId" resultType="com.imyeyu.api.modules.gao.entity.GaoFundRecord">
|
||||
SELECT * FROM `gao_fund_record`
|
||||
WHERE `biz_id` = #{bizId} AND `deleted_at` IS NULL
|
||||
ORDER BY `occurred_at` DESC, `created_at` DESC
|
||||
</select>
|
||||
<sql id="queryWhere">
|
||||
f.`deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">AND f.`store_id` = #{storeId}</if>
|
||||
<if test="customerPackageId != null and customerPackageId != ''">AND f.`biz_id` = #{customerPackageId}</if>
|
||||
<if test="customerId != null and customerId != ''">AND f.`customer_id` = #{customerId}</if>
|
||||
<if test="operationType != null">AND f.`operation_type` = #{operationType}</if>
|
||||
<if test="status != null">AND f.`status` = #{status}</if>
|
||||
<if test="beginAt != null">AND f.`occurred_at` >= #{beginAt}</if>
|
||||
<if test="endAt != null">AND f.`occurred_at` <= #{endAt}</if>
|
||||
</sql>
|
||||
<select id="countByQuery" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_fund_record` f WHERE <include refid="queryWhere"/>
|
||||
</select>
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoFundRecord">
|
||||
SELECT f.* FROM `gao_fund_record` f WHERE <include refid="queryWhere"/>
|
||||
ORDER BY f.`occurred_at` DESC, f.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<update id="updateStatusIf">
|
||||
UPDATE `gao_fund_record`
|
||||
SET `status` = #{toStatus}, `verifier_user_id` = #{verifierUserId}, `verified_at` = #{verifiedAt}, `reason` = #{reason}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `status` = #{fromStatus} AND `deleted_at` IS NULL
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.GaoPackageConfigItemMapper">
|
||||
<select id="selectByPackageConfigId" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfigItem">
|
||||
SELECT * FROM `gao_package_config_item`
|
||||
WHERE `package_config_id` = #{packageConfigId} AND `deleted_at` IS NULL
|
||||
ORDER BY `sort`, `created_at`
|
||||
</select>
|
||||
<select id="selectByPackageConfigIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfigItem">
|
||||
SELECT * FROM `gao_package_config_item`
|
||||
WHERE `deleted_at` IS NULL
|
||||
<choose>
|
||||
<when test="packageConfigIdList != null and !packageConfigIdList.isEmpty()">
|
||||
AND `package_config_id` IN <foreach collection="packageConfigIdList" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||
</when>
|
||||
<otherwise>AND FALSE</otherwise>
|
||||
</choose>
|
||||
ORDER BY `package_config_id`, `sort`, `created_at`
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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.GaoPackageConfigMapper">
|
||||
<select id="selectByIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfig">
|
||||
SELECT * FROM `gao_package_config`
|
||||
WHERE `deleted_at` IS NULL
|
||||
<choose>
|
||||
<when test="idList != null and !idList.isEmpty()">
|
||||
AND `id` IN <foreach collection="idList" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||
</when>
|
||||
<otherwise>AND FALSE</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="selectValidList" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfig">
|
||||
SELECT * FROM `gao_package_config`
|
||||
WHERE `store_id` = #{storeId}
|
||||
AND `status` = 'ACTIVE'
|
||||
AND (`begin_at` IS NULL OR `begin_at` <= #{now})
|
||||
AND (`end_at` IS NULL OR #{now} <= `end_at`)
|
||||
AND `deleted_at` IS NULL
|
||||
ORDER BY `sort`, `created_at`
|
||||
</select>
|
||||
<select id="countByQuery" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_package_config`
|
||||
WHERE `deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">AND `store_id` = #{storeId}</if>
|
||||
<if test="status != null">AND `status` = #{status}</if>
|
||||
<if test="keyword != null and keyword.trim() != ''">AND (`name` LIKE CONCAT('%', #{keyword}, '%') OR `description` LIKE CONCAT('%', #{keyword}, '%'))</if>
|
||||
</select>
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfig">
|
||||
SELECT * FROM `gao_package_config`
|
||||
WHERE `deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">AND `store_id` = #{storeId}</if>
|
||||
<if test="status != null">AND `status` = #{status}</if>
|
||||
<if test="keyword != null and keyword.trim() != ''">AND (`name` LIKE CONCAT('%', #{keyword}, '%') OR `description` LIKE CONCAT('%', #{keyword}, '%'))</if>
|
||||
ORDER BY `sort`, `created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<select id="selectByStoreIdAndName" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageConfig">
|
||||
SELECT * FROM `gao_package_config`
|
||||
WHERE `store_id` = #{storeId} AND `name` = #{name} AND `deleted_at` IS NULL
|
||||
<if test="excludeId != null">AND `id` != #{excludeId}</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.GaoPackageDeliveryItemMapper">
|
||||
<select id="selectByDeliveryId" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDeliveryItem">
|
||||
SELECT * FROM `gao_package_delivery_item`
|
||||
WHERE `delivery_id` = #{deliveryId} AND `deleted_at` IS NULL
|
||||
ORDER BY `created_at`, `id`
|
||||
</select>
|
||||
<select id="selectByDeliveryIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDeliveryItem">
|
||||
SELECT * FROM `gao_package_delivery_item`
|
||||
WHERE `deleted_at` IS NULL
|
||||
<choose>
|
||||
<when test="deliveryIdList != null and !deliveryIdList.isEmpty()">
|
||||
AND `delivery_id` IN <foreach collection="deliveryIdList" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||
</when>
|
||||
<otherwise>AND FALSE</otherwise>
|
||||
</choose>
|
||||
ORDER BY `delivery_id`, `created_at`, `id`
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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.GaoPackageDeliveryMapper">
|
||||
<select id="selectByRequestNo" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDelivery">
|
||||
SELECT * FROM `gao_package_delivery`
|
||||
WHERE `store_id` = #{storeId} AND `request_no` = #{requestNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectForUpdate" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDelivery">
|
||||
SELECT * FROM `gao_package_delivery`
|
||||
WHERE `id` = #{id} AND `deleted_at` IS NULL
|
||||
FOR UPDATE
|
||||
</select>
|
||||
<select id="selectRevokeBySourceDeliveryId" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDelivery">
|
||||
SELECT * FROM `gao_package_delivery`
|
||||
WHERE `source_delivery_id` = #{sourceDeliveryId} AND `deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="countPendingByCustomerPackageId" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_package_delivery`
|
||||
WHERE `customer_package_id` = #{customerPackageId} AND `status` = 'PENDING' AND `operation_type` = 'DELIVER' AND `deleted_at` IS NULL
|
||||
</select>
|
||||
<select id="countVerifiedByCustomerPackageId" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_package_delivery`
|
||||
WHERE `customer_package_id` = #{customerPackageId} AND `status` = 'VERIFIED' AND `operation_type` = 'DELIVER' AND `deleted_at` IS NULL
|
||||
</select>
|
||||
<select id="selectByCustomerPackageId" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDelivery">
|
||||
SELECT * FROM `gao_package_delivery`
|
||||
WHERE `customer_package_id` = #{customerPackageId} AND `deleted_at` IS NULL
|
||||
ORDER BY `delivered_at` DESC, `created_at` DESC
|
||||
</select>
|
||||
<sql id="queryWhere">
|
||||
d.`deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">AND d.`store_id` = #{storeId}</if>
|
||||
<if test="customerPackageId != null and customerPackageId != ''">AND d.`customer_package_id` = #{customerPackageId}</if>
|
||||
<if test="customerId != null and customerId != ''">AND d.`customer_id` = #{customerId}</if>
|
||||
<if test="status != null">AND d.`status` = #{status}</if>
|
||||
<if test="operationType != null">AND d.`operation_type` = #{operationType}</if>
|
||||
<if test="beginAt != null">AND d.`delivered_at` >= #{beginAt}</if>
|
||||
<if test="endAt != null">AND d.`delivered_at` <= #{endAt}</if>
|
||||
</sql>
|
||||
<select id="countByQuery" resultType="long">
|
||||
SELECT COUNT(1) FROM `gao_package_delivery` d WHERE <include refid="queryWhere"/>
|
||||
</select>
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoPackageDelivery">
|
||||
SELECT d.* FROM `gao_package_delivery` d WHERE <include refid="queryWhere"/>
|
||||
ORDER BY d.`delivered_at` DESC, d.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<update id="updateStatusIf">
|
||||
UPDATE `gao_package_delivery`
|
||||
SET `status` = #{toStatus}, `verifier_user_id` = #{verifierUserId}, `verified_at` = #{verifiedAt}, `reason` = #{reason}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||
WHERE `id` = #{id} AND `status` = #{fromStatus} AND `deleted_at` IS NULL
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user