You've already forked FrameTour-BE
feat(pricing): 添加一口价购买功能
- 新增 OnePricePurchaseController 控制器 - 新增 OnePriceConfigFilterRequest、OnePriceConfigRequest、OnePriceInfo等 DTO 类 - 新增 PriceOnePriceConfig 实体类和对应的 Mapper 接口 - 实现 OnePricePurchaseDiscountProvider 优惠提供者 - 实现 OnePricePurchaseServiceImpl 服务实现类 -定义 IOnePricePurchaseService服务接口 - 优化 DiscountDetail 类,添加创建一口价折扣的方法 - 修改 CLAUDE.md,将 error 方法改为 fail 方法
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
package com.ycwl.basic.pricing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ycwl.basic.pricing.entity.PriceOnePriceConfig;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 一口价配置Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface PriceOnePriceConfigMapper extends BaseMapper<PriceOnePriceConfig> {
|
||||
|
||||
/**
|
||||
* 查询启用的一口价配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_one_price_config WHERE is_active = 1 AND deleted = 0 " +
|
||||
"ORDER BY scenic_id")
|
||||
List<PriceOnePriceConfig> selectActiveConfigs();
|
||||
|
||||
/**
|
||||
* 根据景区ID查询启用的配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_one_price_config " +
|
||||
"WHERE is_active = 1 AND deleted = 0 " +
|
||||
"AND scenic_id = #{scenicId} " +
|
||||
"LIMIT 1")
|
||||
PriceOnePriceConfig selectConfigByScenic(@Param("scenicId") Long scenicId);
|
||||
|
||||
/**
|
||||
* 查询特定景区的所有配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_one_price_config " +
|
||||
"WHERE is_active = 1 AND deleted = 0 " +
|
||||
"AND scenic_id = #{scenicId}")
|
||||
List<PriceOnePriceConfig> selectConfigsByScenic(@Param("scenicId") Long scenicId);
|
||||
|
||||
/**
|
||||
* 根据ID查询启用的配置
|
||||
*/
|
||||
@Select("SELECT * FROM price_one_price_config " +
|
||||
"WHERE id = #{id} AND is_active = 1 AND deleted = 0")
|
||||
PriceOnePriceConfig selectActiveConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有配置(包含禁用的)- 管理端使用
|
||||
*/
|
||||
@Select("SELECT * FROM price_one_price_config WHERE deleted = 0 " +
|
||||
"ORDER BY is_active DESC, create_time DESC")
|
||||
List<PriceOnePriceConfig> selectAllConfigsForAdmin();
|
||||
|
||||
/**
|
||||
* 插入配置
|
||||
*/
|
||||
@Insert("INSERT INTO price_one_price_config " +
|
||||
"(config_name, scenic_id, one_price, original_price, description, is_active, " +
|
||||
"start_time, end_time, can_use_coupon, can_use_voucher, " +
|
||||
"create_time, update_time, create_by, deleted) " +
|
||||
"VALUES " +
|
||||
"(#{configName}, #{scenicId}, #{onePrice}, #{originalPrice}, #{description}, #{isActive}, " +
|
||||
"#{startTime}, #{endTime}, #{canUseCoupon}, #{canUseVoucher}, " +
|
||||
"NOW(), NOW(), #{createBy}, 0)")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
int insertConfig(PriceOnePriceConfig config);
|
||||
|
||||
/**
|
||||
* 更新配置
|
||||
*/
|
||||
@Update("UPDATE price_one_price_config SET " +
|
||||
"config_name = #{configName}, scenic_id = #{scenicId}, " +
|
||||
"one_price = #{onePrice}, original_price = #{originalPrice}, " +
|
||||
"description = #{description}, is_active = #{isActive}, " +
|
||||
"start_time = #{startTime}, end_time = #{endTime}, " +
|
||||
"can_use_coupon = #{canUseCoupon}, can_use_voucher = #{canUseVoucher}, " +
|
||||
"update_time = NOW(), update_by = #{updateBy} " +
|
||||
"WHERE id = #{id} AND deleted = 0")
|
||||
int updateConfig(PriceOnePriceConfig config);
|
||||
|
||||
/**
|
||||
* 更新配置状态
|
||||
*/
|
||||
@Update("UPDATE price_one_price_config SET is_active = #{isActive}, update_time = NOW() " +
|
||||
"WHERE id = #{id} AND deleted = 0")
|
||||
int updateConfigStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
|
||||
|
||||
/**
|
||||
* 逻辑删除配置
|
||||
*/
|
||||
@Update("UPDATE price_one_price_config SET deleted = 1, deleted_at = NOW() " +
|
||||
"WHERE id = #{id}")
|
||||
int deleteConfig(Long id);
|
||||
}
|
||||
Reference in New Issue
Block a user