You've already forked FrameTour-BE
feat(pricing): 添加查询接口并优化配置管理
- 新增多个查询接口,包括商品配置、阶梯配置和一口价配置的查询- 优化配置管理逻辑,支持 default 配置的创建和使用 - 重构部分代码,提高可维护性和可扩展性
This commit is contained in:
@@ -41,7 +41,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 " +
|
||||
"(#{bundleName}, #{scenicId}, #{bundlePrice}, #{includedProducts}, #{excludedProducts}, " +
|
||||
"(#{bundleName}, #{scenicId}, #{bundlePrice}, #{includedProducts,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{excludedProducts,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, " +
|
||||
"#{description}, #{isActive}, NOW(), NOW())")
|
||||
int insertBundleConfig(PriceBundleConfig config);
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
|
||||
* 更新一口价配置
|
||||
*/
|
||||
@Update("UPDATE price_bundle_config SET bundle_name = #{bundleName}, scenic_id = #{scenicId}, bundle_price = #{bundlePrice}, " +
|
||||
"included_products = #{includedProducts}, excluded_products = #{excludedProducts}, " +
|
||||
"included_products = #{includedProducts,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, excluded_products = #{excludedProducts,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, " +
|
||||
"description = #{description}, is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
|
||||
int updateBundleConfig(PriceBundleConfig config);
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@ public interface PriceProductConfigMapper extends BaseMapper<PriceProductConfig>
|
||||
@Select("SELECT * FROM price_product_config WHERE product_type = #{productType} AND product_id = #{productId} AND is_active = 1")
|
||||
PriceProductConfig selectByProductTypeAndId(String productType, String productId);
|
||||
|
||||
/**
|
||||
* 检查是否存在default配置(包含禁用的)
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM price_product_config WHERE product_type = #{productType} AND product_id = 'default'")
|
||||
int countDefaultConfigsByProductType(@Param("productType") String productType);
|
||||
|
||||
// ==================== 管理端接口(包含禁用的配置) ====================
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,6 +49,12 @@ public interface PriceTierConfigMapper extends BaseMapper<PriceTierConfig> {
|
||||
@Select("SELECT * FROM price_tier_config WHERE is_active = 1 ORDER BY product_type ASC, sort_order ASC")
|
||||
List<PriceTierConfig> selectAllActiveConfigs();
|
||||
|
||||
/**
|
||||
* 检查是否存在default阶梯配置(包含禁用的)
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM price_tier_config WHERE product_type = #{productType} AND product_id = 'default'")
|
||||
int countDefaultTierConfigsByProductType(@Param("productType") String productType);
|
||||
|
||||
// ==================== 管理端接口(包含禁用的配置) ====================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user