优化混炼示方日志记录逻辑,直接从入参构建快照以减少数据库查询,提高性能与效率。
This commit is contained in:
@@ -41,6 +41,7 @@ import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecTcuMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFormulaSpecEditLogService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -98,10 +99,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList, trace);
|
||||
trace.finish();
|
||||
//update-begin---author:cursor ---date:20260526 for:【配方日志查询】混炼示方新增落库修改日志-----------
|
||||
MesXslMixingSpecPage saved = queryPageById(main.getId());
|
||||
if (saved != null) {
|
||||
mesXslFormulaSpecEditLogService.recordMixingCreate(saved);
|
||||
}
|
||||
// 直接用已落库的入参构建快照,避免二次全量 queryPageById() 查询
|
||||
mesXslFormulaSpecEditLogService.recordMixingCreate(
|
||||
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
|
||||
//update-end---author:cursor ---date:20260526 for:【配方日志查询】混炼示方新增落库修改日志-----------
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表新增保存-----------
|
||||
}
|
||||
@@ -130,10 +130,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList, trace);
|
||||
trace.finish();
|
||||
//update-begin---author:cursor ---date:20260526 for:【配方日志查询】混炼示方编辑落库修改日志-----------
|
||||
MesXslMixingSpecPage after = queryPageById(main.getId());
|
||||
if (after != null) {
|
||||
mesXslFormulaSpecEditLogService.recordMixingUpdate(before, after);
|
||||
}
|
||||
// 直接用已落库的入参构建 after 快照,避免二次全量 queryPageById() 查询(节省 5 次 SELECT)
|
||||
mesXslFormulaSpecEditLogService.recordMixingUpdate(before,
|
||||
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
|
||||
//update-end---author:cursor ---date:20260526 for:【配方日志查询】混炼示方编辑落库修改日志-----------
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表编辑保存-----------
|
||||
}
|
||||
@@ -841,4 +840,21 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
this.update(wrapper);
|
||||
}
|
||||
//update-end---author:cursor ---date:20260526 for:【XSLMES-20260526-A61】混炼示方密炼PS审批联动同步审批人-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260527 for:【配方日志查询】从入参直接构建快照,避免二次查库-----------
|
||||
private MesXslMixingSpecPage buildPageFromInput(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList) {
|
||||
MesXslMixingSpecPage page = new MesXslMixingSpecPage();
|
||||
BeanUtils.copyProperties(main, page);
|
||||
page.setMaterialList(materialList != null ? materialList : new ArrayList<>());
|
||||
page.setStepList(stepList != null ? stepList : new ArrayList<>());
|
||||
page.setDownStepList(downStepList != null ? downStepList : new ArrayList<>());
|
||||
page.setTcuList(tcuList != null ? tcuList : new ArrayList<>());
|
||||
return page;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260527 for:【配方日志查询】从入参直接构建快照,避免二次查库-----------
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user