|
@@ -30,6 +30,7 @@ public class DiagnosetrainhistoryServiceImpl extends ServiceImpl<Diagnosetrainhi
|
|
|
@Autowired
|
|
|
private InitialRunner initialRunner;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public List<Diagnosetrainhistory> getAll( AlgorithmType type) {
|
|
|
ExcludeQueryWrapper<Diagnosetrainhistory> wrapper = new ExcludeQueryWrapper<>();
|
|
@@ -46,6 +47,7 @@ public class DiagnosetrainhistoryServiceImpl extends ServiceImpl<Diagnosetrainhi
|
|
|
public void insertItem(Diagnosetrainhistory obj) {
|
|
|
try{
|
|
|
insert(obj);
|
|
|
+ initialRunner.cacheHistory();
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage());
|
|
|
throw new CustomException(ResultCode.ERROR_DATA);
|
|
@@ -65,6 +67,7 @@ public class DiagnosetrainhistoryServiceImpl extends ServiceImpl<Diagnosetrainhi
|
|
|
wrapper.eq("id",id);
|
|
|
try {
|
|
|
baseMapper.delete(wrapper);
|
|
|
+ initialRunner.cacheHistory();
|
|
|
} catch (CustomException e) {
|
|
|
log.error(e.getMessage());
|
|
|
throw new CustomException(ResultCode.ERROR_DATA);
|
|
@@ -87,15 +90,21 @@ public class DiagnosetrainhistoryServiceImpl extends ServiceImpl<Diagnosetrainhi
|
|
|
@Override
|
|
|
public void editDiagnosetrainhistory(Diagnosetrainhistory history) {
|
|
|
try {
|
|
|
- List<Diagnosetrainhistory> historyByModel = getHistoryByModel(history.getId(), history.getModel());
|
|
|
+ List<Diagnosetrainhistory> historyByModel = getHistoryByModel("", history.getModel());
|
|
|
+ if (1 == historyByModel.size() && historyByModel.get(0).getId().equals(history.getId()) && !history.isEnable()) {
|
|
|
+ throw new CustomException(ResultCode.ERROR_DATA);
|
|
|
+ }
|
|
|
if (null != historyByModel && historyByModel.size() > 0 && history.isEnable()) {
|
|
|
for (Diagnosetrainhistory h : historyByModel) {
|
|
|
+ if (h.getId().equals(history.getId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
h.setEnable(false);
|
|
|
baseMapper.updateById(h);
|
|
|
}
|
|
|
}
|
|
|
baseMapper.updateById(history);
|
|
|
- initialRunner.cacheKnowCategory();
|
|
|
+ initialRunner.cacheHistory();
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage());
|
|
|
throw new CustomException(ResultCode.ERROR_DATA);
|
|
@@ -142,6 +151,12 @@ public class DiagnosetrainhistoryServiceImpl extends ServiceImpl<Diagnosetrainhi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Diagnosetrainhistory> getListAll() {
|
|
|
+ QueryWrapper<Diagnosetrainhistory> wrapper = new QueryWrapper<>();
|
|
|
+ return baseMapper.selectList(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 由于mybatis-plus存储的中文乱码
|