|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
@ -87,6 +88,17 @@ public class BaseMaterialTypeServiceImpl implements IBaseMaterialTypeService {
|
|
|
|
|
public Boolean insertByBo(BaseMaterialTypeBo bo) {
|
|
|
|
|
BaseMaterialType add = MapstructUtils.convert(bo, BaseMaterialType.class);
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
|
|
|
|
|
//获取父节点信息
|
|
|
|
|
BaseMaterialTypeVo query = baseMapper.selectVoById(bo.getParentId());
|
|
|
|
|
if (ObjectUtils.isNotEmpty(query)) {
|
|
|
|
|
//若父节点不为空,则将父节点的ancestors拼接父节点id拼接成ancestors
|
|
|
|
|
add.setAncestors(query.getAncestors() + "," + bo.getParentId());
|
|
|
|
|
}else{
|
|
|
|
|
//若父节点为空,则ancestors仅有父节点id
|
|
|
|
|
add.setAncestors(bo.getParentId().toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
bo.setMatrialTypeId(add.getMatrialTypeId());
|
|
|
|
@ -135,7 +147,7 @@ public class BaseMaterialTypeServiceImpl implements IBaseMaterialTypeService {
|
|
|
|
|
if(isValid){
|
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
for (Long id : ids) {
|
|
|
|
|
//TODO 校验是否需要删除
|
|
|
|
|
//监测删除的节点是否有子节点
|
|
|
|
|
BaseMaterialType query = new BaseMaterialType();
|
|
|
|
|
query.setParentId(id);
|
|
|
|
|
if (baseMapper.selectCount(Wrappers.lambdaQuery(query)) > 0) {
|
|
|
|
|