月报标题删除--验证

This commit is contained in:
zhn
2022-08-17 13:47:09 +08:00
parent e9138be454
commit 87f9de09e8
3 changed files with 49 additions and 0 deletions
@@ -134,6 +134,22 @@ public class LawsMonthlyReportTitleTemplateEOController extends JeroController<L
return Result.OK("批量删除成功!");
}
/**
* 目录删除验证
*
* @param ids
* @return
*/
@AutoLog(value = "月报标题模板-批量删除")
@ApiOperation(value="月报标题模板-批量删除", notes="月报标题模板-批量删除")
@GetMapping(value = "/verifyDelete")
public Result<?> verifyDelete(@RequestParam(name="ids",required=true) String ids) {
String flag = this.lawsMonthlyReportTitleTemplateEOService.verifyDelete(Arrays.asList(ids.split(",")));
return Result.OK(flag);
}
/**
* 通过id查询
*
@@ -48,6 +48,13 @@ public interface ILawsMonthlyReportTitleTemplateEOService extends IService<LawsM
*/
void deleteByIds(List<String> ids);
/**
* 目录删除验证
* @param ids
* @return
*/
String verifyDelete(List<String> ids);
/**
* 通过id查询
*
@@ -121,6 +121,32 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
removeByIds(ids);
}
/**
* 目录删除验证
* @param ids
*/
@Override
public String verifyDelete(List<String> ids) {
//标题下存在内容或子标题时不能删除
//1. 判断是否存在子标题
LambdaQueryWrapper<LawsMonthlyReportTitleTemplateEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(LawsMonthlyReportTitleTemplateEO::getParentId,ids);
List<LawsMonthlyReportTitleTemplateEO> list = this.list(wrapper);
if(list.size() != 0){
//不能删除
return "false";
}
//2. 判断是否存在内容 memories_chapter
LambdaQueryWrapper<LawsMonthlyReportWriteEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(LawsMonthlyReportWriteEO::getMemoriesChapter,ids);
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = lawsMonthlyReportWriteEOService.list(lambdaQueryWrapper);
if(lawsMonthlyReportWriteEOS.size() != 0){
//不能删除
return "false";
}
return "true";
}
/**
* 通过id查询
*