feat(oa): 新增根据计划ID批量删除步骤功能

- 在 IOaProjectScheduleStepService 接口中新增 deleteByScheduleIds 方法
- 实现类 OaProjectScheduleStepServiceImpl 中实现 deleteByScheduleIds 方法
- 在 OaProjectScheduleStepMapper 中增加 deleteByScheduleIds 的 SQL 映射- 在 OaProjectScheduleServiceImpl 删除计划时同步删除相关步骤
- 添加 Mapper 层对 scheduleIds 参数的支持及 XML 删除语句- 更新 mapper 接口导入 Collection 类以支持参数传递
This commit is contained in:
2025-11-11 13:33:26 +08:00
parent d5c7b78419
commit d2a6d40e93
5 changed files with 26 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import java.util.Collection;
import java.util.List;
/**
@@ -29,4 +30,11 @@ public interface OaProjectScheduleStepMapper extends BaseMapperPlus<OaProjectSch
OaProjectScheduleStepVo selectByCurrentStepAndScheduleId(@Param("currentStep") Long currentStep, @Param("scheduleId") Long scheduleId);
void saveBatch(List<OaProjectScheduleStep> entities);
/**
* 根据 schedule_id 批量删除步骤记录
* @param scheduleIds 主表的 schedule_id 集合
* @return 删除的记录数
*/
int deleteByScheduleIds(@Param("scheduleIds") Collection<Long> scheduleIds);
}

View File

@@ -53,6 +53,8 @@ public interface IOaProjectScheduleStepService{
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Boolean deleteByScheduleIds(Collection<Long> scheduleIds, Boolean isValid);
OaProjectScheduleStepVo maxStepByScheduleId(Long scheduleId);
void updateByStepAndScheduleId(Long currentStep,Long scheduleId);

View File

@@ -184,6 +184,8 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
//同时在删除对应的项目进度步骤
projectScheduleStepService.deleteByScheduleIds(ids, false);
return baseMapper.deleteBatchIds(ids) > 0;
}

View File

@@ -202,6 +202,13 @@ public class OaProjectScheduleStepServiceImpl implements IOaProjectScheduleStepS
}
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public Boolean deleteByScheduleIds(Collection<Long> scheduleIds, Boolean isValid) {
if (isValid) {
// 如需校验,添加业务校验逻辑(例如:判断步骤是否存在关联数据等)
}
return projectScheduleStepMapper.deleteByScheduleIds(scheduleIds) > 0;
}
@Override
public OaProjectScheduleStepVo maxStepByScheduleId(Long scheduleId) {

View File

@@ -89,6 +89,13 @@
AND del_flag = '0'
and use_flag = '1'
</update>
<delete id="deleteByScheduleIds">
DELETE FROM oa_project_schedule_step
WHERE schedule_id IN
<foreach collection="scheduleIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="maxStepByScheduleId" resultMap="OaProjectScheduleStepResult">
SELECT opss.track_id,
opss.accessory,