Browse Source

新增规则pids组装调整

feature/teamB_zz_wgh
Jackwang 3 years ago
parent
commit
ccd4eb9dc0
  1. 22
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java

22
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java

@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.common.enu.PointAddRuleEnum;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointAdditiveRuleDao;
import com.epmet.dto.CategorydetailResultDTO;
@ -114,7 +116,14 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR
entity.setPid(dto.getPid());
if(!NumConstant.ZERO_STR.equals(dto.getPid())){
PointAdditiveRuleEntity parentEntity = baseDao.selectById(dto.getPid());
entity.setPids(parentEntity.getPids()+":"+parentEntity.getId());
if(null == parentEntity){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到父节点信息","未查到父节点信息");
}
if(StringUtils.isBlank(parentEntity.getPids())){
entity.setPids(parentEntity.getId());
}else{
entity.setPids(parentEntity.getPids()+":"+parentEntity.getId());
}
entity.setCategoryCode(parentEntity.getCategoryCode());
}
insert(entity);
@ -132,8 +141,15 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR
entity.setPid(dto.getPid());
if(!NumConstant.ZERO_STR.equals(dto.getPid())){
PointAdditiveRuleEntity parentEntity = baseDao.selectById(dto.getPid());
if(null == parentEntity){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到父节点信息","未查到父节点信息");
}
if(StringUtils.isBlank(parentEntity.getPids())){
entity.setPids(parentEntity.getId());
}else{
entity.setPids(parentEntity.getPids()+":"+parentEntity.getId());
}
entity.setCategoryCode(parentEntity.getCategoryCode());
entity.setPids(parentEntity.getPids()+":"+parentEntity.getId());
}
insert(entity);
return new Result().ok("新增成功!");

Loading…
Cancel
Save