You've already forked FrameTour-BE
refactor(mapper): 统一时间字段命名
- 将 created_time 修改为 create_time -将 updated_time 修改为 update_time - 调整相关 SQL 查询和插入语句中的字段名称
This commit is contained in:
@@ -36,7 +36,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
* 增加优惠券使用数量
|
||||
*/
|
||||
@Update("UPDATE price_coupon_config SET used_quantity = used_quantity + 1, " +
|
||||
"updated_time = NOW() WHERE id = #{couponId} AND used_quantity < total_quantity")
|
||||
"update_time = NOW() WHERE id = #{couponId} AND used_quantity < total_quantity")
|
||||
int incrementUsedQuantity(Long couponId);
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
*/
|
||||
@Insert("INSERT INTO price_coupon_config (coupon_name, coupon_type, discount_value, min_amount, " +
|
||||
"max_discount, applicable_products, total_quantity, used_quantity, valid_from, valid_until, " +
|
||||
"is_active, scenic_id, created_time, updated_time) VALUES " +
|
||||
"is_active, scenic_id, create_time, update_time) VALUES " +
|
||||
"(#{couponName}, #{couponType}, #{discountValue}, #{minAmount}, #{maxDiscount}, " +
|
||||
"#{applicableProducts}, #{totalQuantity}, #{usedQuantity}, #{validFrom}, #{validUntil}, " +
|
||||
"#{isActive}, #{scenicId}, NOW(), NOW())")
|
||||
@@ -57,7 +57,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
"discount_value = #{discountValue}, min_amount = #{minAmount}, max_discount = #{maxDiscount}, " +
|
||||
"applicable_products = #{applicableProducts}, total_quantity = #{totalQuantity}, " +
|
||||
"valid_from = #{validFrom}, valid_until = #{validUntil}, is_active = #{isActive}, " +
|
||||
"scenic_id = #{scenicId}, updated_time = NOW() WHERE id = #{id}")
|
||||
"scenic_id = #{scenicId}, update_time = NOW() WHERE id = #{id}")
|
||||
int updateCoupon(PriceCouponConfig coupon);
|
||||
|
||||
// ==================== 管理端接口 ====================
|
||||
@@ -65,7 +65,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
/**
|
||||
* 管理端:查询所有优惠券配置(包含禁用的)
|
||||
*/
|
||||
@Select("SELECT * FROM price_coupon_config ORDER BY created_time DESC")
|
||||
@Select("SELECT * FROM price_coupon_config ORDER BY create_time DESC")
|
||||
List<PriceCouponConfig> selectAllForAdmin();
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
"AND scenic_id = #{scenicId}" +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"ORDER BY created_time DESC" +
|
||||
"ORDER BY create_time DESC" +
|
||||
"</script>")
|
||||
List<PriceCouponConfig> selectByConditionsForAdmin(@Param("isActive") Boolean isActive,
|
||||
@Param("couponName") String couponName,
|
||||
@@ -93,19 +93,19 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
/**
|
||||
* 管理端:根据状态查询优惠券配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_coupon_config WHERE is_active = #{isActive} ORDER BY created_time DESC")
|
||||
@Select("SELECT * FROM price_coupon_config WHERE is_active = #{isActive} ORDER BY create_time DESC")
|
||||
List<PriceCouponConfig> selectByStatusForAdmin(@Param("isActive") Boolean isActive);
|
||||
|
||||
/**
|
||||
* 管理端:更新优惠券状态
|
||||
*/
|
||||
@Update("UPDATE price_coupon_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
|
||||
@Update("UPDATE price_coupon_config SET is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
|
||||
int updateCouponStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
|
||||
|
||||
/**
|
||||
* 管理端:删除优惠券配置
|
||||
*/
|
||||
@Update("UPDATE price_coupon_config SET deleted = 1, updated_time = NOW() WHERE id = #{id}")
|
||||
@Update("UPDATE price_coupon_config SET deleted = 1, update_time = NOW() WHERE id = #{id}")
|
||||
int deleteCoupon(Long id);
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
|
||||
/**
|
||||
* 管理端:根据景区ID查询优惠券配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_coupon_config WHERE scenic_id = #{scenicId} ORDER BY created_time DESC")
|
||||
@Select("SELECT * FROM price_coupon_config WHERE scenic_id = #{scenicId} ORDER BY create_time DESC")
|
||||
List<PriceCouponConfig> selectByScenicIdForAdmin(@Param("scenicId") String scenicId);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user