|
@@ -189,44 +189,62 @@ public class UnitServiceImpl implements UnitService {
|
|
|
if (unitGearboxPO != null) {
|
|
|
// 处理齿轮箱轴承处理
|
|
|
if (!CollectionUtils.isEmpty(unitDto.getUnitGearDto().getUnitGearboxBearingsDtoList())) {
|
|
|
+
|
|
|
UnitGearboxBearingsPO unitGearboxBearingsPO = null;
|
|
|
- List<UnitGearboxBearingsPO> unitGearboxBearingsPOList = Lists.newArrayList();
|
|
|
+ List<UnitGearboxBearingsPO> unitGearboxBearingsSaveList = Lists.newArrayList();
|
|
|
+ List<UnitGearboxBearingsPO> unitGearboxBearingsUpdateList = Lists.newArrayList();
|
|
|
for (UnitDto.UnitGearboxBearingsDto dto : unitDto.getUnitGearDto().getUnitGearboxBearingsDtoList()) {
|
|
|
unitGearboxBearingsPO = new UnitGearboxBearingsPO();
|
|
|
BeanUtil.copyProperties(dto, unitGearboxBearingsPO);
|
|
|
- unitGearboxBearingsPO.setGearboxCode(unitGearboxPO.getCode());
|
|
|
- unitGearboxBearingsPO.setCreateBy(userId);
|
|
|
- unitGearboxBearingsPO.setUpdateBy(userId);
|
|
|
- unitGearboxBearingsPO.setCreateTime(new Date());
|
|
|
- unitGearboxBearingsPO.setUpdateTime(new Date());
|
|
|
- unitGearboxBearingsPOList.add(unitGearboxBearingsPO);
|
|
|
+ if (dto.getId() == null) {
|
|
|
+ unitGearboxBearingsPO.setGearboxCode(unitGearboxPO.getCode());
|
|
|
+ unitGearboxBearingsPO.setCreateBy(userId);
|
|
|
+ unitGearboxBearingsPO.setUpdateBy(userId);
|
|
|
+ unitGearboxBearingsPO.setCreateTime(new Date());
|
|
|
+ unitGearboxBearingsPO.setUpdateTime(new Date());
|
|
|
+ unitGearboxBearingsSaveList.add(unitGearboxBearingsPO);
|
|
|
+ }else{
|
|
|
+ unitGearboxBearingsPO.setUpdateBy(userId);
|
|
|
+ unitGearboxBearingsPO.setUpdateTime(new Date());
|
|
|
+ unitGearboxBearingsUpdateList.add(unitGearboxBearingsPO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(unitGearboxBearingsSaveList)){
|
|
|
+ unitGearboxBearingsMapper.insertList(unitGearboxBearingsSaveList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(unitGearboxBearingsUpdateList)){
|
|
|
+ unitGearboxBearingsMapper.batchUpdate(unitGearboxBearingsUpdateList);
|
|
|
}
|
|
|
-// UnitGearboxBearingsPO po = new UnitGearboxBearingsPO();
|
|
|
-// po.setGearboxCode(unitGearboxPO.getCode());
|
|
|
-// unitGearboxBearingsMapper.delete(po);
|
|
|
-
|
|
|
- unitGearboxBearingsMapper.batchUpdate(unitGearboxBearingsPOList);
|
|
|
}
|
|
|
|
|
|
// 处理齿轮箱结构
|
|
|
if (!CollectionUtils.isEmpty(unitDto.getUnitGearDto().getUnitGearboxStructureDtoList())) {
|
|
|
UnitGearboxStructurePO unitGearboxStructurePO = null;
|
|
|
- List<UnitGearboxStructurePO> unitGearboxStructurePOList = Lists.newArrayList();
|
|
|
+ List<UnitGearboxStructurePO> unitGearboxStructureSaveList = Lists.newArrayList();
|
|
|
+ List<UnitGearboxStructurePO> unitGearboxStructureUpdateList = Lists.newArrayList();
|
|
|
for (UnitDto.UnitGearboxStructureDto dto : unitDto.getUnitGearDto().getUnitGearboxStructureDtoList()) {
|
|
|
unitGearboxStructurePO = new UnitGearboxStructurePO();
|
|
|
BeanUtil.copyProperties(dto, unitGearboxStructurePO);
|
|
|
- unitGearboxStructurePO.setGearboxCode(unitGearboxPO.getCode());
|
|
|
- unitGearboxStructurePO.setCreateTime(new Date());
|
|
|
- unitGearboxStructurePO.setUpdateTime(new Date());
|
|
|
- unitGearboxStructurePO.setCreateBy(userId);
|
|
|
- unitGearboxStructurePO.setUpdateBy(userId);
|
|
|
- unitGearboxStructurePOList.add(unitGearboxStructurePO);
|
|
|
- }
|
|
|
-// UnitGearboxStructurePO po = new UnitGearboxStructurePO();
|
|
|
-// po.setGearboxCode(unitGearboxPO.getCode());
|
|
|
-// unitGearboxStructureMapper.delete(po);
|
|
|
+ if(dto.getId()==null){
|
|
|
+ unitGearboxStructurePO.setGearboxCode(unitGearboxPO.getCode());
|
|
|
+ unitGearboxStructurePO.setCreateTime(new Date());
|
|
|
+ unitGearboxStructurePO.setUpdateTime(new Date());
|
|
|
+ unitGearboxStructurePO.setCreateBy(userId);
|
|
|
+ unitGearboxStructurePO.setUpdateBy(userId);
|
|
|
+ unitGearboxStructureSaveList.add(unitGearboxStructurePO);
|
|
|
+ }else{
|
|
|
+ unitGearboxStructurePO.setUpdateTime(new Date());
|
|
|
+ unitGearboxStructurePO.setUpdateBy(userId);
|
|
|
+ unitGearboxStructureUpdateList.add(unitGearboxStructurePO);
|
|
|
+ }
|
|
|
|
|
|
- unitGearboxStructureMapper.batchUpdate(unitGearboxStructurePOList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(unitGearboxStructureSaveList)){
|
|
|
+ unitGearboxStructureMapper.insertList(unitGearboxStructureSaveList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(unitGearboxStructureUpdateList)){
|
|
|
+ unitGearboxStructureMapper.batchUpdate(unitGearboxStructureUpdateList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return flg;
|
|
@@ -328,7 +346,7 @@ public class UnitServiceImpl implements UnitService {
|
|
|
Example.Criteria criteria = queryExample.createCriteria();
|
|
|
criteria.andEqualTo("millTypeCode", millTypeCode);
|
|
|
|
|
|
- return unitDynamoMapper.selectOneByExample(queryExample) ;
|
|
|
+ return unitDynamoMapper.selectOneByExample(queryExample);
|
|
|
}
|
|
|
|
|
|
|