|
@@ -86,8 +86,10 @@ public class ExamItemServiceImpl extends ServiceImpl<ExamItemMapper, ExamItem> i
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updateExamItem(ExamItemUpdateVO updateVO) {
|
|
public boolean updateExamItem(ExamItemUpdateVO updateVO) {
|
|
|
// 检查项目是否存在
|
|
// 检查项目是否存在
|
|
|
- ExamItem existing = this.getById(updateVO.getId());
|
|
|
|
|
- if (existing == null || existing.getStatus() == 0) {
|
|
|
|
|
|
|
+ ExamItem existing = this.getOne(new LambdaQueryWrapper<ExamItem>()
|
|
|
|
|
+ .eq(ExamItem::getId, updateVO.getId())
|
|
|
|
|
+ .eq(ExamItem::getStatus, 1));
|
|
|
|
|
+ if (existing == null) {
|
|
|
throw new RuntimeException("检查项目不存在");
|
|
throw new RuntimeException("检查项目不存在");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -118,18 +120,14 @@ public class ExamItemServiceImpl extends ServiceImpl<ExamItemMapper, ExamItem> i
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean deleteExamItem(Long id) {
|
|
public boolean deleteExamItem(Long id) {
|
|
|
- // 检查项目是否存在
|
|
|
|
|
- ExamItem existing = this.getById(id);
|
|
|
|
|
- if (existing == null) {
|
|
|
|
|
- throw new RuntimeException("检查项目不存在");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 逻辑删除
|
|
// 逻辑删除
|
|
|
- existing.setStatus(0);
|
|
|
|
|
- boolean result = this.updateById(existing);
|
|
|
|
|
|
|
+ ExamItem examItem = new ExamItem();
|
|
|
|
|
+ examItem.setId(id);
|
|
|
|
|
+ examItem.setStatus(0);
|
|
|
|
|
+ boolean result = this.updateById(examItem);
|
|
|
|
|
|
|
|
if (result) {
|
|
if (result) {
|
|
|
- log.info("删除检查项目成功: id={}, itemName={}", existing.getId(), existing.getItemName());
|
|
|
|
|
|
|
+ log.info("删除检查项目成功: id={}", id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
return result;
|
|
@@ -138,11 +136,8 @@ public class ExamItemServiceImpl extends ServiceImpl<ExamItemMapper, ExamItem> i
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updateEnabled(Long id, Integer enabled) {
|
|
public boolean updateEnabled(Long id, Integer enabled) {
|
|
|
- ExamItem examItem = this.getById(id);
|
|
|
|
|
- if (examItem == null) {
|
|
|
|
|
- throw new RuntimeException("检查项目不存在");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ExamItem examItem = new ExamItem();
|
|
|
|
|
+ examItem.setId(id);
|
|
|
examItem.setEnabled(enabled);
|
|
examItem.setEnabled(enabled);
|
|
|
boolean result = this.updateById(examItem);
|
|
boolean result = this.updateById(examItem);
|
|
|
|
|
|