fix(pricing): 修复优惠券查询条件拼接问题

- 在每个查询条件后添加空格,避免SQL语法错误
- 确保动态SQL片段正确连接
- 优化时间范围查询条件的格式处理
This commit is contained in:
2025-12-08 10:58:33 +08:00
parent b2c55c9feb
commit d5befd75e1

View File

@@ -89,22 +89,22 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"<where>" +
"<if test='userId != null'>" +
"AND r.user_id = #{userId}" +
"AND r.user_id = #{userId} " +
"</if>" +
"<if test='couponId != null'>" +
"AND r.coupon_id = #{couponId}" +
"AND r.coupon_id = #{couponId} " +
"</if>" +
"<if test='status != null'>" +
"AND r.status = #{status}" +
"AND r.status = #{status} " +
"</if>" +
"<if test='startTime != null and startTime != \"\"'>" +
"AND r.claim_time >= #{startTime}" +
"AND r.claim_time >= #{startTime} " +
"</if>" +
"<if test='endTime != null and endTime != \"\"'>" +
"AND r.claim_time &lt;= #{endTime}" +
"AND r.claim_time &lt;= #{endTime} " +
"</if>" +
"<if test='scenicId != null and scenicId != \"\"'>" +
"AND r.scenic_id = #{scenicId}" +
"AND r.scenic_id = #{scenicId} " +
"</if>" +
"</where>" +
"ORDER BY r.create_time DESC" +