点检方案树的删除闲置功能
This commit is contained in:
parent
30f9e6aa85
commit
1260d288a2
@ -119,4 +119,9 @@ public class InspectionPlanController {
|
||||
BeanUtils.toBean(list, InspectionPlanRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/hasChild")
|
||||
@Operation(summary = "是否有子节点")
|
||||
public CommonResult<Boolean> hasInspectionPlan(@RequestParam("id") Long id) {
|
||||
return success(inspectionPlanService.hasChildInspectionPlan(id));
|
||||
}
|
||||
}
|
||||
|
@ -77,4 +77,9 @@ public interface InspectionPlanService {
|
||||
* @return java.util.List<com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO>
|
||||
*/
|
||||
List<InspectionPlanDO> getInspectionPlanHaveFeedbackList(InspectionPlanListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 是否有子节点
|
||||
*/
|
||||
Boolean hasChildInspectionPlan(Long id);
|
||||
}
|
||||
|
@ -127,4 +127,15 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
|
||||
}
|
||||
return inspectionPlanDOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* 是否有子节点
|
||||
*/
|
||||
public Boolean hasChildInspectionPlan(Long id){
|
||||
QueryWrapper<InspectionPlanDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.apply("find_in_set("+id+",ancestors)")
|
||||
.eq("deleted",0);
|
||||
return inspectionPlanMapper.selectCount(queryWrapper) > 0;
|
||||
}
|
||||
}
|
||||
|
@ -77,3 +77,11 @@ export function getInspectionPlanListHaveFeedback(params) {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
//是否有子节点
|
||||
export function hasInspectionPlanChild(id) {
|
||||
return request({
|
||||
url: "/imt/inspection-plan/hasChild?id=" + id,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
@ -257,9 +257,19 @@ export default {
|
||||
'是否确认删除点检方案编号为"' + inspectionPlanId + '"的数据项?'
|
||||
);
|
||||
try {
|
||||
await InspectionPlanApi.deleteInspectionPlan(inspectionPlanId);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
const hasChildRes = await InspectionPlanApi.hasInspectionPlanChild(
|
||||
inspectionPlanId
|
||||
);
|
||||
if (hasChildRes.data) {
|
||||
this.$message({
|
||||
message: "该节点存在子节点,请先删除子节点!",
|
||||
type: "warning",
|
||||
});
|
||||
} else {
|
||||
await InspectionPlanApi.deleteInspectionPlan(inspectionPlanId);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
|
Loading…
Reference in New Issue
Block a user