|
@@ -1,13 +1,21 @@
|
|
package org.springblade.manager.service.impl;
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
|
+import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
|
+import org.springblade.core.tool.utils.StringPool;
|
|
|
|
+import org.springblade.manager.entity.WbsTree;
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
import org.springblade.manager.service.IWbsTreePrivateService;
|
|
import org.springblade.manager.service.IWbsTreePrivateService;
|
|
|
|
+import org.springblade.manager.vo.WbsNodeTableVO;
|
|
import org.springblade.manager.vo.WbsTreePrivateVO;
|
|
import org.springblade.manager.vo.WbsTreePrivateVO;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -22,6 +30,49 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
return ForestNodeMerger.merge(baseMapper.tree(wbsId, projectId));
|
|
return ForestNodeMerger.merge(baseMapper.tree(wbsId, projectId));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean submit(WbsTreePrivate dept) {
|
|
|
|
+ if (Func.isEmpty(dept.getParentId())) {
|
|
|
|
+ dept.setTenantId(AuthUtil.getTenantId());
|
|
|
|
+ dept.setParentId(BladeConstant.TOP_PARENT_ID);
|
|
|
|
+ dept.setAncestors(String.valueOf(BladeConstant.TOP_PARENT_ID));
|
|
|
|
+ }
|
|
|
|
+ if (dept.getParentId() > 0) {
|
|
|
|
+ WbsTreePrivate parent = getById(dept.getParentId());
|
|
|
|
+ if (Func.toLong(dept.getParentId()) == Func.toLong(dept.getId())) {
|
|
|
|
+ throw new ServiceException("父节点不可选择自身!");
|
|
|
|
+ }
|
|
|
|
+ dept.setTenantId(parent.getTenantId());
|
|
|
|
+ String ancestors = parent.getAncestors() + StringPool.COMMA + dept.getParentId();
|
|
|
|
+ dept.setAncestors(ancestors);
|
|
|
|
+ }
|
|
|
|
+ dept.setStatus(1);
|
|
|
|
+ dept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
|
|
|
+ return saveOrUpdate(dept);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<WbsNodeTableVO> selectByNodeTable(String id, String wbsId, String projectId) {
|
|
|
|
+ //查询节点下的所有表单
|
|
|
|
+ List<WbsNodeTableVO> wbsNodeTableVOS = baseMapper.selectByNodeTable(id, wbsId, projectId);
|
|
|
|
+ return wbsNodeTableVOS;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean removeTableByCondition(String id, String wbsId, String projectId) {
|
|
|
|
+ UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.set("is_deleted", 1);
|
|
|
|
+ updateWrapper.eq("id", id);
|
|
|
|
+ updateWrapper.eq("wbs_id", wbsId);
|
|
|
|
+ updateWrapper.eq("project_id", projectId);
|
|
|
|
+ updateWrapper.eq("sataus", 1);
|
|
|
|
+ int integer = baseMapper.delete(updateWrapper);
|
|
|
|
+ if (integer > 0) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public List<WbsTreePrivate> findAllNodeList(String wbsTreeIds, String projectId) {
|
|
public List<WbsTreePrivate> findAllNodeList(String wbsTreeIds, String projectId) {
|
|
String[] ids = wbsTreeIds.split(",");
|
|
String[] ids = wbsTreeIds.split(",");
|