删除标题--添加验证
This commit is contained in:
+21
-1
@@ -5,12 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportTitleTemplateEO;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportWriteEO;
|
||||
import com.jero.modules.report.mapper.LawsMonthlyReportTitleTemplateEOMapper;
|
||||
import com.jero.modules.report.service.ILawsMonthlyReportTitleTemplateEOService;
|
||||
import com.jero.modules.report.vo.LawsMonthlyReportTitleTemplateVO;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -30,6 +33,8 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<LawsMonthlyReportTitleTemplateEOMapper, LawsMonthlyReportTitleTemplateEO> implements ILawsMonthlyReportTitleTemplateEOService {
|
||||
|
||||
@Autowired
|
||||
private LawsMonthlyReportWriteEOServiceImpl lawsMonthlyReportWriteEOService;
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -98,7 +103,22 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
//标题下存在内容或子标题时不能删除
|
||||
//1. 判断是否存在子标题
|
||||
LambdaQueryWrapper<LawsMonthlyReportTitleTemplateEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(LawsMonthlyReportTitleTemplateEO::getParentId,ids);
|
||||
List<LawsMonthlyReportTitleTemplateEO> list = this.list(wrapper);
|
||||
if(list.size() != 0){
|
||||
throw new JeroBootException("该标题下存在子标题,不能删除");
|
||||
}
|
||||
//2. 判断是否存在内容 memories_chapter
|
||||
LambdaQueryWrapper<LawsMonthlyReportWriteEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(LawsMonthlyReportWriteEO::getMemoriesChapter,ids);
|
||||
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = lawsMonthlyReportWriteEOService.list(lambdaQueryWrapper);
|
||||
if(lawsMonthlyReportWriteEOS.size() != 0){
|
||||
throw new JeroBootException("该标题下存在新增内容,不能删除");
|
||||
}
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user