From 2c0b7a094d3858db52e7234c1d6bd9092ed617dc Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 21 Aug 2025 18:04:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor(mapper):=20=E7=BB=9F=E4=B8=80=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=AD=97=E6=AE=B5=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 created_time 修改为 create_time -将 updated_time 修改为 update_time - 调整相关 SQL 查询和插入语句中的字段名称 --- .../mapper/PriceBundleConfigMapper.java | 12 ++++++------ .../mapper/PriceCouponClaimRecordMapper.java | 18 +++++++++--------- .../mapper/PriceCouponConfigMapper.java | 18 +++++++++--------- .../mapper/PriceProductConfigMapper.java | 6 +++--- .../pricing/mapper/PriceTierConfigMapper.java | 6 +++--- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/ycwl/basic/pricing/mapper/PriceBundleConfigMapper.java b/src/main/java/com/ycwl/basic/pricing/mapper/PriceBundleConfigMapper.java index 0bc1ce3..f65e4f0 100644 --- a/src/main/java/com/ycwl/basic/pricing/mapper/PriceBundleConfigMapper.java +++ b/src/main/java/com/ycwl/basic/pricing/mapper/PriceBundleConfigMapper.java @@ -17,7 +17,7 @@ public interface PriceBundleConfigMapper extends BaseMapper { */ @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 { */ @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 { */ @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 { * 插入一口价配置 */ @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 { */ @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); } \ No newline at end of file diff --git a/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponClaimRecordMapper.java b/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponClaimRecordMapper.java index 725c9f7..ec83ac9 100644 --- a/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponClaimRecordMapper.java +++ b/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponClaimRecordMapper.java @@ -40,7 +40,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper selectAllForAdmin(); /** @@ -100,7 +100,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper" + "" + - "ORDER BY r.created_time DESC" + + "ORDER BY r.create_time DESC" + "") List selectByConditionsForAdmin(@Param("userId") Long userId, @Param("couponId") Long couponId, @@ -116,7 +116,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper selectByUserIdForAdmin(@Param("userId") Long userId); /** @@ -126,7 +126,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper selectByCouponIdForAdmin(@Param("couponId") Long couponId); /** @@ -136,7 +136,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper selectByStatusForAdmin(@Param("status") CouponStatus status); /** @@ -191,7 +191,7 @@ public interface PriceCouponClaimRecordMapper extends BaseMapper selectByScenicIdForAdmin(@Param("scenicId") String scenicId); /** diff --git a/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponConfigMapper.java b/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponConfigMapper.java index d1075a5..077e470 100644 --- a/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponConfigMapper.java +++ b/src/main/java/com/ycwl/basic/pricing/mapper/PriceCouponConfigMapper.java @@ -36,7 +36,7 @@ public interface PriceCouponConfigMapper extends BaseMapper { * 增加优惠券使用数量 */ @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 { */ @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 { "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 { /** * 管理端:查询所有优惠券配置(包含禁用的) */ - @Select("SELECT * FROM price_coupon_config ORDER BY created_time DESC") + @Select("SELECT * FROM price_coupon_config ORDER BY create_time DESC") List selectAllForAdmin(); /** @@ -84,7 +84,7 @@ public interface PriceCouponConfigMapper extends BaseMapper { "AND scenic_id = #{scenicId}" + "" + "" + - "ORDER BY created_time DESC" + + "ORDER BY create_time DESC" + "") List selectByConditionsForAdmin(@Param("isActive") Boolean isActive, @Param("couponName") String couponName, @@ -93,19 +93,19 @@ public interface PriceCouponConfigMapper extends BaseMapper { /** * 管理端:根据状态查询优惠券配置 */ - @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 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 { /** * 管理端:根据景区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 selectByScenicIdForAdmin(@Param("scenicId") String scenicId); /** diff --git a/src/main/java/com/ycwl/basic/pricing/mapper/PriceProductConfigMapper.java b/src/main/java/com/ycwl/basic/pricing/mapper/PriceProductConfigMapper.java index d200921..e4769a0 100644 --- a/src/main/java/com/ycwl/basic/pricing/mapper/PriceProductConfigMapper.java +++ b/src/main/java/com/ycwl/basic/pricing/mapper/PriceProductConfigMapper.java @@ -57,7 +57,7 @@ public interface PriceProductConfigMapper extends BaseMapper /** * 插入商品价格配置 */ - @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 * 更新商品价格配置 */ @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); } \ No newline at end of file diff --git a/src/main/java/com/ycwl/basic/pricing/mapper/PriceTierConfigMapper.java b/src/main/java/com/ycwl/basic/pricing/mapper/PriceTierConfigMapper.java index 8921078..edbc30d 100644 --- a/src/main/java/com/ycwl/basic/pricing/mapper/PriceTierConfigMapper.java +++ b/src/main/java/com/ycwl/basic/pricing/mapper/PriceTierConfigMapper.java @@ -82,7 +82,7 @@ public interface PriceTierConfigMapper extends BaseMapper { * 插入阶梯定价配置 */ @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 { */ @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); } \ No newline at end of file