fix:绿植租赁方案删除

This commit is contained in:
2025-08-26 10:26:47 +08:00
parent ef0976c621
commit a6b0277ff6
5 changed files with 32 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import java.util.List;
public interface PlantsPlanProductMapper extends BaseMapperPlus<PlantsPlanProduct, PlantsPlanProductVo> {
void deleteByPlanId(Long planId);
void deleteByPlanIds(List<Long> planIds);
List<PlantsPlanProductVo> queryProductsInfo(Long planId);
}

View File

@@ -67,6 +67,12 @@ public interface IPlantsPlanProductService {
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 根据方案id删除方案产品
* @param ids
*/
void deleteByPlanIds(List<Long> ids);
/**
* 批量保存租赁方案植物
*

View File

@@ -159,6 +159,7 @@ public class PlantsPlanProductServiceImpl implements IPlantsPlanProductService {
/**
* 查询租赁方案植物数据
*
* @param planId
* @return
*/
@@ -166,4 +167,17 @@ public class PlantsPlanProductServiceImpl implements IPlantsPlanProductService {
public List<PlantsPlanProductVo> queryPlanProductsInfo(Long planId) {
return baseMapper.queryProductsInfo(planId);
}
/**
* 根据方案id删除方案产品
*
* @param ids 方案id
* @return
*/
@Override
public void deleteByPlanIds(List<Long> ids) {
if (CollectionUtils.isNotEmpty(ids)) {
baseMapper.deleteByPlanIds(ids);
}
}
}

View File

@@ -25,6 +25,7 @@ import org.dromara.property.domain.vo.PlantsRentalPlanVo;
import org.dromara.property.domain.PlantsRentalPlan;
import org.dromara.property.mapper.PlantsRentalPlanMapper;
import org.dromara.property.service.IPlantsRentalPlanService;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@@ -166,6 +167,7 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
PlantsRentalOrderBo plantsRentalOrderBo = new PlantsRentalOrderBo();
@@ -174,6 +176,8 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
if(CollectionUtils.isNotEmpty(plantsRentalOrderVos)){
throw new ServiceException("当前选中租赁方案不可删除");
}
//删除方案产品数据
planProductService.deleteByPlanIds(ids.stream().toList());
}
return baseMapper.deleteByIds(ids) > 0;
}

View File

@@ -26,6 +26,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from plants_plan_product p where p.plan_id=#{planId}
</delete>
<delete id="deleteByPlanIds" parameterType="java.util.List">
delete from plants_plan_product p where p.plan_id in
<foreach collection="list" item="planId" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
<select id="queryProductsInfo" resultMap="planProductMap">
select
c.id pid,