refactor(mapper): 统一时间字段命名

- 将 created_time 修改为 create_time
-将 updated_time 修改为 update_time
- 调整相关 SQL 查询和插入语句中的字段名称
This commit is contained in:
2025-08-21 18:04:41 +08:00
parent 3d49c47006
commit 2c0b7a094d
5 changed files with 30 additions and 30 deletions

View File

@@ -17,7 +17,7 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
*/
@Select("SELECT id, bundle_name, scenic_id, bundle_price, " +
"included_products, excluded_products, " +
"description, is_active, created_time, updated_time " +
"description, is_active, create_time, update_time " +
"FROM price_bundle_config WHERE is_active = 1")
@Results({
@Result(column = "included_products", property = "includedProducts",
@@ -32,7 +32,7 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
*/
@Select("SELECT id, bundle_name, scenic_id, bundle_price, " +
"included_products, excluded_products, " +
"description, is_active, created_time, updated_time " +
"description, is_active, create_time, update_time " +
"FROM price_bundle_config WHERE id = #{id} AND is_active = 1")
@Results({
@Result(column = "included_products", property = "includedProducts",
@@ -49,7 +49,7 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
*/
@Select("SELECT id, bundle_name, scenic_id, bundle_price, " +
"included_products, excluded_products, " +
"description, is_active, created_time, updated_time " +
"description, is_active, create_time, update_time " +
"FROM price_bundle_config ORDER BY is_active DESC, bundle_name ASC")
@Results({
@Result(column = "included_products", property = "includedProducts",
@@ -63,7 +63,7 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
* 插入一口价配置
*/
@Insert("INSERT INTO price_bundle_config (bundle_name, scenic_id, bundle_price, included_products, excluded_products, " +
"description, is_active, created_time, updated_time) VALUES " +
"description, is_active, create_time, update_time) VALUES " +
"(#{bundleName}, #{scenicId}, #{bundlePrice}, #{includedProducts,typeHandler=com.ycwl.basic.pricing.handler.BundleProductListTypeHandler}, #{excludedProducts,typeHandler=com.ycwl.basic.pricing.handler.BundleProductListTypeHandler}, " +
"#{description}, #{isActive}, NOW(), NOW())")
int insertBundleConfig(PriceBundleConfig config);
@@ -73,12 +73,12 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
*/
@Update("UPDATE price_bundle_config SET bundle_name = #{bundleName}, scenic_id = #{scenicId}, bundle_price = #{bundlePrice}, " +
"included_products = #{includedProducts,typeHandler=com.ycwl.basic.pricing.handler.BundleProductListTypeHandler}, excluded_products = #{excludedProducts,typeHandler=com.ycwl.basic.pricing.handler.BundleProductListTypeHandler}, " +
"description = #{description}, is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
"description = #{description}, is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateBundleConfig(PriceBundleConfig config);
/**
* 更新一口价配置状态
*/
@Update("UPDATE price_bundle_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
@Update("UPDATE price_bundle_config SET is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateBundleConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}

View File

@@ -40,7 +40,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
* 更新优惠券使用状态
*/
@Update("UPDATE price_coupon_claim_record SET status = #{status}, " +
"use_time = #{useTime}, order_id = #{orderId}, scenic_id = #{scenicId}, updated_time = NOW() " +
"use_time = #{useTime}, order_id = #{orderId}, scenic_id = #{scenicId}, update_time = NOW() " +
"WHERE id = #{id}")
int updateCouponStatus(@Param("id") Long id,
@Param("status") CouponStatus status,
@@ -51,7 +51,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
/**
* 插入优惠券领用记录
*/
@Insert("INSERT INTO price_coupon_claim_record (coupon_id, user_id, claim_time, status, scenic_id, created_time, updated_time) " +
@Insert("INSERT INTO price_coupon_claim_record (coupon_id, user_id, claim_time, status, scenic_id, create_time, update_time) " +
"VALUES (#{couponId}, #{userId}, NOW(), #{status}, #{scenicId}, NOW(), NOW())")
int insertClaimRecord(PriceCouponClaimRecord record);
@@ -59,7 +59,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
* 更新优惠券记录
*/
@Update("UPDATE price_coupon_claim_record SET status = #{status}, use_time = #{useTime}, " +
"order_id = #{orderId}, updated_time = NOW() WHERE id = #{id}")
"order_id = #{orderId}, update_time = NOW() WHERE id = #{id}")
int updateClaimRecord(PriceCouponClaimRecord record);
// ==================== 管理端接口 ====================
@@ -70,7 +70,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
@Select("SELECT r.*, c.coupon_name, c.coupon_type, c.discount_value " +
"FROM price_coupon_claim_record r " +
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"ORDER BY r.created_time DESC")
"ORDER BY r.create_time DESC")
List<PriceCouponClaimRecord> selectAllForAdmin();
/**
@@ -100,7 +100,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"AND r.scenic_id = #{scenicId}" +
"</if>" +
"</where>" +
"ORDER BY r.created_time DESC" +
"ORDER BY r.create_time DESC" +
"</script>")
List<PriceCouponClaimRecord> selectByConditionsForAdmin(@Param("userId") Long userId,
@Param("couponId") Long couponId,
@@ -116,7 +116,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"FROM price_coupon_claim_record r " +
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"WHERE r.user_id = #{userId} " +
"ORDER BY r.created_time DESC")
"ORDER BY r.create_time DESC")
List<PriceCouponClaimRecord> selectByUserIdForAdmin(@Param("userId") Long userId);
/**
@@ -126,7 +126,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"FROM price_coupon_claim_record r " +
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"WHERE r.coupon_id = #{couponId} " +
"ORDER BY r.created_time DESC")
"ORDER BY r.create_time DESC")
List<PriceCouponClaimRecord> selectByCouponIdForAdmin(@Param("couponId") Long couponId);
/**
@@ -136,7 +136,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"FROM price_coupon_claim_record r " +
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"WHERE r.status = #{status} " +
"ORDER BY r.created_time DESC")
"ORDER BY r.create_time DESC")
List<PriceCouponClaimRecord> selectByStatusForAdmin(@Param("status") CouponStatus status);
/**
@@ -191,7 +191,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper<PriceCouponClai
"FROM price_coupon_claim_record r " +
"LEFT JOIN price_coupon_config c ON r.coupon_id = c.id " +
"WHERE r.scenic_id = #{scenicId} " +
"ORDER BY r.created_time DESC")
"ORDER BY r.create_time DESC")
List<PriceCouponClaimRecord> selectByScenicIdForAdmin(@Param("scenicId") String scenicId);
/**

View File

@@ -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);
/**

View File

@@ -57,7 +57,7 @@ public interface PriceProductConfigMapper extends BaseMapper<PriceProductConfig>
/**
* 插入商品价格配置
*/
@Insert("INSERT INTO price_product_config (product_type, product_id, scenic_id, product_name, base_price, original_price, unit, is_active, created_time, updated_time) " +
@Insert("INSERT INTO price_product_config (product_type, product_id, scenic_id, product_name, base_price, original_price, unit, is_active, create_time, update_time) " +
"VALUES (#{productType}, #{productId}, #{scenicId}, #{productName}, #{basePrice}, #{originalPrice}, #{unit}, #{isActive}, NOW(), NOW())")
int insertProductConfig(PriceProductConfig config);
@@ -65,12 +65,12 @@ public interface PriceProductConfigMapper extends BaseMapper<PriceProductConfig>
* 更新商品价格配置
*/
@Update("UPDATE price_product_config SET product_id = #{productId}, scenic_id = #{scenicId}, product_name = #{productName}, base_price = #{basePrice}, " +
"original_price = #{originalPrice}, unit = #{unit}, is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
"original_price = #{originalPrice}, unit = #{unit}, is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateProductConfig(PriceProductConfig config);
/**
* 更新商品配置状态
*/
@Update("UPDATE price_product_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
@Update("UPDATE price_product_config SET is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateProductConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}

View File

@@ -82,7 +82,7 @@ public interface PriceTierConfigMapper extends BaseMapper<PriceTierConfig> {
* 插入阶梯定价配置
*/
@Insert("INSERT INTO price_tier_config (product_type, product_id, scenic_id, min_quantity, max_quantity, price, " +
"original_price, unit, sort_order, is_active, created_time, updated_time) VALUES " +
"original_price, unit, sort_order, is_active, create_time, update_time) VALUES " +
"(#{productType}, #{productId}, #{scenicId}, #{minQuantity}, #{maxQuantity}, #{price}, " +
"#{originalPrice}, #{unit}, #{sortOrder}, #{isActive}, NOW(), NOW())")
int insertTierConfig(PriceTierConfig config);
@@ -92,12 +92,12 @@ public interface PriceTierConfigMapper extends BaseMapper<PriceTierConfig> {
*/
@Update("UPDATE price_tier_config SET product_id = #{productId}, scenic_id = #{scenicId}, min_quantity = #{minQuantity}, " +
"max_quantity = #{maxQuantity}, price = #{price}, original_price = #{originalPrice}, unit = #{unit}, sort_order = #{sortOrder}, " +
"is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
"is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateTierConfig(PriceTierConfig config);
/**
* 更新阶梯配置状态
*/
@Update("UPDATE price_tier_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
@Update("UPDATE price_tier_config SET is_active = #{isActive}, update_time = NOW() WHERE id = #{id}")
int updateTierConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}