获取服务配置2
This commit is contained in:
@@ -7,6 +7,7 @@ import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 体重区间价格 Mapper
|
||||
@@ -17,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface ProdWeightRangePricesMapper extends BaseMapperX<ProdWeightRangePricesDO> {
|
||||
|
||||
|
||||
/**
|
||||
* 删除关联
|
||||
*/
|
||||
public int deleteWeightRangePrices(@Param("prodId")Long prodId);
|
||||
}
|
||||
@@ -167,12 +167,12 @@ public class ProdServiceImpl implements ProdService {
|
||||
}
|
||||
}
|
||||
//体重设置
|
||||
if (Objects.equals(prodServiceVO.getWeightSwitch(), BaseEnum.YES_ONE.getKey())) {
|
||||
/* if (Objects.equals(prodServiceVO.getWeightSwitch(), BaseEnum.YES_ONE.getKey())) {
|
||||
prodDO.setWeightSwitch(BaseEnum.YES_ONE.getKey());
|
||||
ProdWeightRangePricesDO prodWeightRangePrices = prodServiceVO.prodWeightConfig;
|
||||
prodWeightRangePrices.setProdId(prodDO.getProdId());
|
||||
prodWeightRangePricesMapper.insert(prodWeightRangePrices);
|
||||
}
|
||||
}*/
|
||||
prodMapper.updateById(prodDO);
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ public class ProdServiceImpl implements ProdService {
|
||||
prodReservationConfigDO.setTimeBook(prodServiceVO.getProdReservationConfig().getTimeBook());
|
||||
prodReservationConfigDO.setReservationTimeSlots(prodServiceVO.getProdReservationConfig().getReservationTimeSlots());
|
||||
prodReservationConfigMapper.insert(prodReservationConfigDO);
|
||||
if(prodServiceVO.getProdReservationConfig().getProdReservationBlackList()!=null){
|
||||
if (prodServiceVO.getProdReservationConfig().getProdReservationBlackList() != null) {
|
||||
for (ProdAdditionalFeeBlackVO prodAdditionalFeeBlackVO : prodServiceVO.getProdReservationConfig().getProdReservationBlackList()) {
|
||||
ProdAdditionalFeeDatesDO prodAdditionalFeeDatesDO = BeanUtils.toBean(prodAdditionalFeeBlackVO, ProdAdditionalFeeDatesDO.class);
|
||||
prodAdditionalFeeDatesDO.setProdId(prod.getProdId());
|
||||
@@ -257,8 +257,8 @@ public class ProdServiceImpl implements ProdService {
|
||||
prodReservationConfigDO.setReservationTimeSlots(prodServiceVO.getProdReservationConfig().getReservationTimeSlots());
|
||||
prodReservationConfigMapper.updateById(prodReservationConfigDO);
|
||||
//先删除在新增
|
||||
prodAdditionalFeeDatesMapper.deleteAdditionalFeeDates(prod.getProdId(),2);
|
||||
if(prodServiceVO.getProdReservationConfig().getProdReservationBlackList()!=null){
|
||||
prodAdditionalFeeDatesMapper.deleteAdditionalFeeDates(prod.getProdId(), 2);
|
||||
if (prodServiceVO.getProdReservationConfig().getProdReservationBlackList() != null) {
|
||||
for (ProdAdditionalFeeBlackVO prodAdditionalFeeBlackVO : prodServiceVO.getProdReservationConfig().getProdReservationBlackList()) {
|
||||
ProdAdditionalFeeDatesDO prodAdditionalFeeDatesDO = BeanUtils.toBean(prodAdditionalFeeBlackVO, ProdAdditionalFeeDatesDO.class);
|
||||
prodAdditionalFeeDatesDO.setProdId(prod.getProdId());
|
||||
@@ -278,14 +278,14 @@ public class ProdServiceImpl implements ProdService {
|
||||
ProdEmergencyResponseDO prodEmergencyResponse = BeanUtils.toBean(prodServiceVO.getProdEmergencyInfoVO(), ProdEmergencyResponseDO.class);
|
||||
prodEmergencyResponse.setProdId(prod.getProdId());
|
||||
prodEmergencyResponseMapper.insert(prodEmergencyResponse);
|
||||
if(prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList()!=null){
|
||||
if (prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList() != null) {
|
||||
for (ProdEmergencyResponseIntervalsDO prodEmergencyResponseIntervals : prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList()) {
|
||||
prodEmergencyResponseIntervals.setConfigId(prodEmergencyResponse.getId());
|
||||
prodEmergencyResponseIntervals.setProdId(prod.getProdId());
|
||||
prodEmergencyResponseIntervalsMapper.insert(prodEmergencyResponseIntervals);
|
||||
}
|
||||
}
|
||||
if(prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseBlackList()!=null){
|
||||
if (prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseBlackList() != null) {
|
||||
for (ProdAdditionalFeeBlackVO prodAdditionalFeeBlackVO : prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseBlackList()) {
|
||||
ProdAdditionalFeeDatesDO prodAdditionalFeeDatesDO = BeanUtils.toBean(prodAdditionalFeeBlackVO, ProdAdditionalFeeDatesDO.class);
|
||||
prodAdditionalFeeDatesDO.setProdId(prod.getProdId());
|
||||
@@ -298,7 +298,7 @@ public class ProdServiceImpl implements ProdService {
|
||||
if (prodEmergencyResponse != null) {
|
||||
prodEmergencyResponseMapper.updateById(prodEmergencyResponse);
|
||||
prodEmergencyResponseIntervalsMapper.deleteIntervals(prodEmergencyResponse.getId());
|
||||
if(prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList()!=null) {
|
||||
if (prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList() != null) {
|
||||
for (ProdEmergencyResponseIntervalsDO prodEmergencyResponseIntervals : prodServiceVO.getProdEmergencyInfoVO().getProdEmergencyResponseIntervalsList()) {
|
||||
prodEmergencyResponseIntervals.setConfigId(prodEmergencyResponse.getId());
|
||||
prodEmergencyResponseIntervals.setProdId(prod.getProdId());
|
||||
@@ -306,8 +306,8 @@ public class ProdServiceImpl implements ProdService {
|
||||
}
|
||||
}
|
||||
//先删除在新增
|
||||
prodAdditionalFeeDatesMapper.deleteAdditionalFeeDates(prod.getProdId(),3);
|
||||
if(prodServiceVO.getProdReservationConfig().getProdReservationBlackList()!=null){
|
||||
prodAdditionalFeeDatesMapper.deleteAdditionalFeeDates(prod.getProdId(), 3);
|
||||
if (prodServiceVO.getProdReservationConfig().getProdReservationBlackList() != null) {
|
||||
for (ProdAdditionalFeeBlackVO prodAdditionalFeeBlackVO : prodServiceVO.getProdReservationConfig().getProdReservationBlackList()) {
|
||||
ProdAdditionalFeeDatesDO prodAdditionalFeeDatesDO = BeanUtils.toBean(prodAdditionalFeeBlackVO, ProdAdditionalFeeDatesDO.class);
|
||||
prodAdditionalFeeDatesDO.setProdId(prod.getProdId());
|
||||
@@ -356,14 +356,25 @@ public class ProdServiceImpl implements ProdService {
|
||||
}
|
||||
//体重设置
|
||||
if (Objects.equals(prodServiceVO.getWeightSwitch(), BaseEnum.YES_ONE.getKey())) {
|
||||
if (prodServiceVO.getProdWeightConfig().getId() == null) {
|
||||
prod.setWeightSwitch(BaseEnum.YES_ONE.getKey());
|
||||
ProdWeightRangePricesDO prodWeightRangePrices = prodServiceVO.getProdWeightConfig();
|
||||
prodWeightRangePrices.setProdId(prod.getProdId());
|
||||
prodWeightRangePricesMapper.insert(prodWeightRangePrices);
|
||||
} else {
|
||||
prodWeightRangePricesMapper.updateById(prodServiceVO.getProdWeightConfig());
|
||||
prod.setWeightSwitch(BaseEnum.YES_ONE.getKey());
|
||||
ProdExtendDO prodExtendDO =prodExtendMapper.selectOne(ProdExtendDO::getProdId, prod.getProdId());
|
||||
if(prodExtendDO!= null){
|
||||
prodExtendDO.setIsWeightCharge(prodServiceVO.getProdWeightConfig().getIsWeightCharge());
|
||||
prodExtendMapper.updateById(prodExtendDO);
|
||||
}else {
|
||||
prodExtendDO = new ProdExtendDO();
|
||||
prodExtendDO.setProdId(prod.getProdId());
|
||||
prodExtendDO.setIsWeightCharge(prodServiceVO.getProdWeightConfig().getIsWeightCharge());
|
||||
prodExtendMapper.insert(prodExtendDO);
|
||||
}
|
||||
prodWeightRangePricesMapper.deleteWeightRangePrices(prod.getProdId());
|
||||
if (prodServiceVO.getProdWeightConfig().getProdWeightConfigList() != null){
|
||||
for (ProdWeightRangePricesDO prodWeightRangePricesDO : prodServiceVO.getProdWeightConfig().getProdWeightConfigList()) {
|
||||
prodWeightRangePricesDO.setProdId(prod.getProdId());
|
||||
prodWeightRangePricesMapper.insert(prodWeightRangePricesDO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
prodMapper.updateById(prod);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
-->
|
||||
|
||||
<delete id="deleteAdditionalFeeDates">
|
||||
delete from tz_prod_additional_fee_dates where prod_id = #{configId} AND type = #{type}
|
||||
delete from tz_prod_additional_fee_dates where prod_id = #{prodId} AND type = #{type}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -89,17 +89,21 @@
|
||||
|
||||
|
||||
<!-- 新增:映射体重区间价格配置列表 (prodWeightConfigList) -->
|
||||
<collection property="prodWeightConfig" ofType="com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO">
|
||||
<id property="id" column="wrp_record_id"/>
|
||||
<result property="prodId" column="wrp_prod_id"/>
|
||||
<result property="weightRange" column="wrp_weight_range"/> <!-- 注意:数据库列是 weight_range -->
|
||||
<result property="price" column="wrp_price"/>
|
||||
<result property="isEnabled" column="wrp_is_enabled"/>
|
||||
<!-- <result property="createTime" column="wrp_create_time"/> -->
|
||||
<!-- <result property="updateTime" column="wrp_update_time"/> -->
|
||||
<!-- <result property="creator" column="wrp_creator"/> -->
|
||||
<!-- <result property="updater" column="wrp_updater"/> -->
|
||||
</collection>
|
||||
<association property="prodWeightConfig" javaType="com.tashow.cloud.productapi.api.product.vo.prodweightrangeprices.ProdWeightRangePricesSaveInfoVO">
|
||||
<result property="isWeightCharge" column="tpe_is_weight_charge"/>
|
||||
<!-- 新增:映射体重区间价格配置列表 (prodWeightConfigList) -->
|
||||
<collection property="prodWeightConfigList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO">
|
||||
<id property="id" column="wrp_record_id"/>
|
||||
<result property="prodId" column="wrp_prod_id"/>
|
||||
<result property="weightRange" column="wrp_weight_range"/> <!-- 注意:数据库列是 weight_range -->
|
||||
<result property="price" column="wrp_price"/>
|
||||
<result property="isEnabled" column="wrp_is_enabled"/>
|
||||
<!-- <result property="createTime" column="wrp_create_time"/> -->
|
||||
<!-- <result property="updateTime" column="wrp_update_time"/> -->
|
||||
<!-- <result property="creator" column="wrp_creator"/> -->
|
||||
<!-- <result property="updater" column="wrp_updater"/> -->
|
||||
</collection>
|
||||
</association>
|
||||
|
||||
<!-- 新增:映射特殊日期规则配置列表 (prodAdditionalFeePeriodsList) -->
|
||||
<collection property="prodAdditionalFeePeriodsList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdAdditionalFeePeriodsDO">
|
||||
@@ -204,19 +208,23 @@
|
||||
<result property="maxOrders" column="ol_max_orders"/>
|
||||
</association>
|
||||
|
||||
<association property="prodWeightConfig" javaType="com.tashow.cloud.productapi.api.product.vo.prodweightrangeprices.ProdWeightRangePricesSaveInfoVO">
|
||||
<result property="isWeightCharge" column="tpe_is_weight_charge"/>
|
||||
<!-- 新增:映射体重区间价格配置列表 (prodWeightConfigList) -->
|
||||
<collection property="prodWeightConfigList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO">
|
||||
<id property="id" column="wrp_record_id"/>
|
||||
<result property="prodId" column="wrp_prod_id"/>
|
||||
<result property="weightRange" column="wrp_weight_range"/> <!-- 注意:数据库列是 weight_range -->
|
||||
<result property="price" column="wrp_price"/>
|
||||
<result property="isEnabled" column="wrp_is_enabled"/>
|
||||
<!-- <result property="createTime" column="wrp_create_time"/> -->
|
||||
<!-- <result property="updateTime" column="wrp_update_time"/> -->
|
||||
<!-- <result property="creator" column="wrp_creator"/> -->
|
||||
<!-- <result property="updater" column="wrp_updater"/> -->
|
||||
</collection>
|
||||
</association>
|
||||
|
||||
|
||||
<!-- 新增:映射体重区间价格配置列表 (prodWeightConfigList) -->
|
||||
<collection property="prodWeightConfig" ofType="com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO">
|
||||
<id property="id" column="wrp_record_id"/>
|
||||
<result property="prodId" column="wrp_prod_id"/>
|
||||
<result property="weightRange" column="wrp_weight_range"/> <!-- 注意:数据库列是 weight_range -->
|
||||
<result property="price" column="wrp_price"/>
|
||||
<result property="isEnabled" column="wrp_is_enabled"/>
|
||||
<!-- <result property="createTime" column="wrp_create_time"/> -->
|
||||
<!-- <result property="updateTime" column="wrp_update_time"/> -->
|
||||
<!-- <result property="creator" column="wrp_creator"/> -->
|
||||
<!-- <result property="updater" column="wrp_updater"/> -->
|
||||
</collection>
|
||||
|
||||
<!-- 新增:映射特殊日期规则配置列表 (prodAdditionalFeePeriodsList) -->
|
||||
<collection property="prodAdditionalFeePeriodsList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdAdditionalFeePeriodsDO">
|
||||
@@ -268,6 +276,7 @@
|
||||
p.category_name,
|
||||
<!-- 只有当 emergencySwitch 开启时,才查询紧急响应相关字段 -->
|
||||
<if test="emergencySwitch != null and emergencySwitch == 1">
|
||||
erc.id AS erc_record_id,
|
||||
erc.response_time_slots as erc_response_time_slots,
|
||||
epafd.id AS erc_record_id,
|
||||
epafd.date_type as erc_date_type,
|
||||
@@ -340,6 +349,7 @@
|
||||
</if>
|
||||
<!-- 只有当 weightSwitch 开启时,才查询体重区间价格相关字段 -->
|
||||
<if test="weightSwitch != null and weightSwitch == 1">
|
||||
tpe.is_weight_charge as tpe_is_weight_charge,
|
||||
wrp.id AS wrp_record_id,
|
||||
wrp.prod_id AS wrp_prod_id,
|
||||
wrp.weight_range AS wrp_weight_range,
|
||||
@@ -377,6 +387,7 @@
|
||||
LEFT JOIN tz_product_order_limit ol ON p.prod_id = ol.prod_id AND ol.deleted = 0
|
||||
</if>
|
||||
<if test="weightSwitch != null and weightSwitch == 1">
|
||||
LEFT JOIN tz_prod_extend tpe ON p.prod_id = tpe.prod_id
|
||||
LEFT JOIN tz_prod_weight_range_prices wrp ON p.prod_id = wrp.prod_id AND wrp.deleted = 0
|
||||
</if>
|
||||
<if test="regionSwitch != null and regionSwitch == 1">
|
||||
@@ -405,6 +416,7 @@
|
||||
p.region_switch,
|
||||
<!-- 只有当 emergencySwitch 开启时,才查询紧急响应相关字段 -->
|
||||
<if test="emergencySwitch != null and emergencySwitch == 1">
|
||||
erc.id AS erc_record_id,
|
||||
erc.response_time_slots as erc_response_time_slots,
|
||||
epafd.id AS erc_record_id,
|
||||
epafd.date_type as erc_date_type,
|
||||
@@ -477,6 +489,7 @@
|
||||
</if>
|
||||
<!-- 只有当 weightSwitch 开启时,才查询体重区间价格相关字段 -->
|
||||
<if test="weightSwitch != null and weightSwitch == 1">
|
||||
tpe.is_weight_charge as tpe_is_weight_charge,
|
||||
wrp.id AS wrp_record_id,
|
||||
wrp.prod_id AS wrp_prod_id,
|
||||
wrp.weight_range AS wrp_weight_range,
|
||||
@@ -506,6 +519,7 @@
|
||||
LEFT JOIN tz_product_order_limit ol ON p.prod_id = ol.prod_id AND ol.deleted = 0
|
||||
</if>
|
||||
<if test="weightSwitch != null and weightSwitch == 1">
|
||||
LEFT JOIN tz_prod_extend tpe ON p.prod_id = tpe.prod_id
|
||||
LEFT JOIN tz_prod_weight_range_prices wrp ON p.prod_id = wrp.prod_id AND wrp.deleted = 0
|
||||
</if>
|
||||
where p.deleted = 0
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<delete id="deleteReservationConfig">
|
||||
delete from tz_prod_reservation_config where prod_id = #{configId}
|
||||
delete from tz_prod_reservation_config where prod_id = #{prodId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -8,5 +8,7 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteWeightRangePrices">
|
||||
delete from tz_prod_weight_range_prices where prod_id = #{prodId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user