添加景区、删除子类型

This commit is contained in:
2025-08-15 13:33:51 +08:00
parent 9c932b6ba8
commit af5c59dc67
15 changed files with 391 additions and 112 deletions

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycwl.basic.pricing.entity.PriceBundleConfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@@ -27,20 +28,34 @@ public interface PriceBundleConfigMapper extends BaseMapper<PriceBundleConfig> {
@Select("SELECT * FROM price_bundle_config WHERE id = #{id} AND is_active = 1")
PriceBundleConfig selectActiveBundleById(Long id);
// ==================== 管理端接口(包含禁用的配置) ====================
/**
* 查询所有一口价配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_bundle_config ORDER BY is_active DESC, bundle_name ASC")
List<PriceBundleConfig> selectAllBundlesForAdmin();
/**
* 插入一口价配置
*/
@Insert("INSERT INTO price_bundle_config (bundle_name, bundle_price, included_products, excluded_products, " +
@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}, #{bundlePrice}, #{includedProducts}, #{excludedProducts}, " +
"(#{bundleName}, #{scenicId}, #{bundlePrice}, #{includedProducts}, #{excludedProducts}, " +
"#{description}, #{isActive}, NOW(), NOW())")
int insertBundleConfig(PriceBundleConfig config);
/**
* 更新一口价配置
*/
@Update("UPDATE price_bundle_config SET bundle_name = #{bundleName}, bundle_price = #{bundlePrice}, " +
@Update("UPDATE price_bundle_config SET bundle_name = #{bundleName}, scenic_id = #{scenicId}, bundle_price = #{bundlePrice}, " +
"included_products = #{includedProducts}, excluded_products = #{excludedProducts}, " +
"description = #{description}, is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
int updateBundleConfig(PriceBundleConfig config);
/**
* 更新一口价配置状态
*/
@Update("UPDATE price_bundle_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
int updateBundleConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycwl.basic.pricing.entity.PriceProductConfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@@ -33,17 +34,37 @@ 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);
// ==================== 管理端接口(包含禁用的配置) ====================
/**
* 查询所有商品配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_product_config ORDER BY product_type ASC, is_active DESC, product_id ASC")
List<PriceProductConfig> selectAllConfigsForAdmin();
/**
* 根据商品类型查询所有配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_product_config WHERE product_type = #{productType} ORDER BY is_active DESC, product_id ASC")
List<PriceProductConfig> selectByProductTypeForAdmin(@Param("productType") String productType);
/**
* 插入商品价格配置
*/
@Insert("INSERT INTO price_product_config (product_type, product_id, product_name, base_price, original_price, unit, is_active, created_time, updated_time) " +
"VALUES (#{productType}, #{productId}, #{productName}, #{basePrice}, #{originalPrice}, #{unit}, #{isActive}, NOW(), NOW())")
@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) " +
"VALUES (#{productType}, #{productId}, #{scenicId}, #{productName}, #{basePrice}, #{originalPrice}, #{unit}, #{isActive}, NOW(), NOW())")
int insertProductConfig(PriceProductConfig config);
/**
* 更新商品价格配置
*/
@Update("UPDATE price_product_config SET product_id = #{productId}, product_name = #{productName}, base_price = #{basePrice}, " +
@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}")
int updateProductConfig(PriceProductConfig config);
/**
* 更新商品配置状态
*/
@Update("UPDATE price_product_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
int updateProductConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}

View File

@@ -21,12 +21,10 @@ public interface PriceTierConfigMapper extends BaseMapper<PriceTierConfig> {
*/
@Select("SELECT * FROM price_tier_config WHERE product_type = #{productType} " +
"AND product_id = #{productId} " +
"AND (product_sub_type = #{productSubType} OR product_sub_type IS NULL) " +
"AND #{quantity} >= min_quantity AND #{quantity} <= max_quantity " +
"AND is_active = 1 ORDER BY sort_order ASC LIMIT 1")
PriceTierConfig selectByProductTypeAndQuantity(@Param("productType") String productType,
@Param("productId") String productId,
@Param("productSubType") String productSubType,
@Param("quantity") Integer quantity);
/**
@@ -44,28 +42,56 @@ public interface PriceTierConfigMapper extends BaseMapper<PriceTierConfig> {
List<PriceTierConfig> selectByProductTypeAndId(@Param("productType") String productType,
@Param("productId") String productId);
/**
* 根据商品类型和子类型查询阶梯配置
* 查询所有启用的阶梯配置
*/
@Select("SELECT * FROM price_tier_config WHERE is_active = 1 ORDER BY product_type ASC, sort_order ASC")
List<PriceTierConfig> selectAllActiveConfigs();
// ==================== 管理端接口(包含禁用的配置) ====================
/**
* 查询所有阶梯配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_tier_config ORDER BY product_type ASC, is_active DESC, sort_order ASC")
List<PriceTierConfig> selectAllConfigsForAdmin();
/**
* 根据商品类型查询所有阶梯配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_tier_config WHERE product_type = #{productType} " +
"AND product_sub_type = #{productSubType} AND is_active = 1 ORDER BY sort_order ASC")
List<PriceTierConfig> selectByProductTypeAndSubType(@Param("productType") String productType,
@Param("productSubType") String productSubType);
"ORDER BY is_active DESC, sort_order ASC")
List<PriceTierConfig> selectByProductTypeForAdmin(@Param("productType") String productType);
/**
* 根据商品类型和商品ID查询所有阶梯配置(包含禁用的)- 管理端使用
*/
@Select("SELECT * FROM price_tier_config WHERE product_type = #{productType} " +
"AND product_id = #{productId} ORDER BY is_active DESC, sort_order ASC")
List<PriceTierConfig> selectByProductTypeAndIdForAdmin(@Param("productType") String productType,
@Param("productId") String productId);
/**
* 插入阶梯定价配置
*/
@Insert("INSERT INTO price_tier_config (product_type, product_id, product_sub_type, min_quantity, max_quantity, price, " +
@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 " +
"(#{productType}, #{productId}, #{productSubType}, #{minQuantity}, #{maxQuantity}, #{price}, " +
"(#{productType}, #{productId}, #{scenicId}, #{minQuantity}, #{maxQuantity}, #{price}, " +
"#{originalPrice}, #{unit}, #{sortOrder}, #{isActive}, NOW(), NOW())")
int insertTierConfig(PriceTierConfig config);
/**
* 更新阶梯定价配置
*/
@Update("UPDATE price_tier_config SET product_id = #{productId}, product_sub_type = #{productSubType}, min_quantity = #{minQuantity}, " +
@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}")
int updateTierConfig(PriceTierConfig config);
/**
* 更新阶梯配置状态
*/
@Update("UPDATE price_tier_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
int updateTierConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
}