use of com.eservice.api.model.abnormal_record.AbnormalRecord in project sinsim by WilsonHu.
the class AbnormalController method delete.
@PostMapping("/delete")
public Result delete(@RequestParam Integer id) {
if (id == null || id <= 0) {
return ResultGenerator.genFailResult("异常ID有误!");
} else {
// 检查异常记录中是否使用了该异常,如果已经使用,不能删除
Condition condition = new Condition(AbnormalRecord.class);
condition.createCriteria().andCondition("abnormal_type = ", id);
List<AbnormalRecord> list = abnormalRecordService.findByCondition(condition);
if (list == null || list.size() > 0) {
return ResultGenerator.genFailResult("该异常已经被使用,删除会导致之前的y异常记录有误;如不想使用,可把该项设置为无效!");
}
}
abnormalService.deleteById(id);
return ResultGenerator.genSuccessResult();
}
Aggregations