|
@@ -87,9 +87,15 @@ 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);
|
|
|
}
|