优惠券

This commit is contained in:
2025-03-23 17:45:53 +08:00
parent a5f67b1eac
commit f9a8a5f20e
9 changed files with 289 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?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.ycwl.basic.mapper.CouponMapper">
<update id="updateStatus">
UPDATE coupon
SET status = IF(status = 1, 0, 1)
WHERE id = #{id}
</update>
<select id="selectByQuery" resultType="com.ycwl.basic.model.pc.coupon.resp.CouponRespVO">
SELECT
c.id, scenic_id AS scenicId, s.name as scenicName,
c.name AS name,
config_ids AS configIds, discount_price AS discountPrice,
type, discount_type AS discountType,
c.status, c.create_at
FROM coupon c
LEFT JOIN scenic s ON c.scenic_id = s.id
<where>
<if test="scenicId != null">AND scenic_id = #{scenicId}</if>
<if test="name != null and name != ''">AND c.name = concat('%',#{name},'%')</if>
<if test="type != null">AND type = #{type}</if>
<if test="discountType != null">AND discount_type = #{discountType}</if>
<if test="status != null">AND c.status = #{status}</if>
<if test="createAtStart != null">AND create_time >= #{createAtStart}</if>
<if test="createAtEnd != null">AND create_time &lt;= #{createAtEnd}
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>