|
@@ -81,6 +81,13 @@ public class SbPositionServiceImpl extends BaseServiceImpl<SbPositionMapper, SbP
|
|
String code = IdGeneratorUtils.getStrNum("", ++i);
|
|
String code = IdGeneratorUtils.getStrNum("", ++i);
|
|
model.setCode(code);
|
|
model.setCode(code);
|
|
}*/
|
|
}*/
|
|
|
|
+ Weekend<SbPosition> weekend = new Weekend<>(SbPosition.class);
|
|
|
|
+ WeekendCriteria<SbPosition, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
|
+ weekendCriteria.andEqualTo(SbPosition::getNo, model.getNo());
|
|
|
|
+ SbPosition example = mapper.selectOneByExample(weekend);
|
|
|
|
+ if(example !=null){
|
|
|
|
+ throw new BusinessException("位号重复,请重新设置位号");
|
|
|
|
+ }
|
|
SbPosition sbPosition = super.saveModelByDTO(model);
|
|
SbPosition sbPosition = super.saveModelByDTO(model);
|
|
if (parent != null) {
|
|
if (parent != null) {
|
|
mapper.updateByPrimaryKeySelective(new SbPosition().setId(parentId).setUpdateTime(LocalDateTime.now()));
|
|
mapper.updateByPrimaryKeySelective(new SbPosition().setId(parentId).setUpdateTime(LocalDateTime.now()));
|
|
@@ -90,9 +97,14 @@ public class SbPositionServiceImpl extends BaseServiceImpl<SbPositionMapper, SbP
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void modModelByDTO(SbPositionDTO model) {
|
|
public void modModelByDTO(SbPositionDTO model) {
|
|
- SbPosition entity = mapper.selectByPrimaryKey(model.getId());
|
|
|
|
|
|
+ Weekend<SbPosition> weekend = new Weekend<>(SbPosition.class);
|
|
|
|
+ WeekendCriteria<SbPosition, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
|
+ weekendCriteria.andEqualTo(SbPosition::getNo, model.getNo());
|
|
|
|
+ SbPosition example = mapper.selectOneByExample(weekend);
|
|
|
|
+ if(example !=null && !example.getId().equals(model.getId())){
|
|
|
|
+ throw new BusinessException("位号重复,请重新设置位号");
|
|
|
|
+ }
|
|
String parentId = model.getParentId();
|
|
String parentId = model.getParentId();
|
|
- SbPosition parent = mapper.selectByPrimaryKeyForUpdate(parentId);
|
|
|
|
|
|
|
|
// 之前没有编码,则设置编码
|
|
// 之前没有编码,则设置编码
|
|
/* if(StringUtils.isBlank(model.getCode())){
|
|
/* if(StringUtils.isBlank(model.getCode())){
|