|
@@ -0,0 +1,86 @@
|
|
|
+package org.springblade.manager.controller;
|
|
|
+
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.core.cache.utils.CacheUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.support.Kv;
|
|
|
+import org.springblade.manager.dto.WbsTreeDTO;
|
|
|
+import org.springblade.manager.entity.WbsFormElement;
|
|
|
+import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
+import org.springblade.manager.service.IWbsTreePrivateService;
|
|
|
+import org.springblade.manager.vo.WbsNodeTableVO;
|
|
|
+import org.springblade.system.cache.DictCache;
|
|
|
+import org.springblade.system.enums.DictEnum;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/wbsPrivate")
|
|
|
+@Api(value = "项目级私有wbs动态库", tags = "项目级私有wbs动态库接口")
|
|
|
+public class WbsTreePrivateController extends BladeController {
|
|
|
+
|
|
|
+ private final IWbsTreePrivateService wbsTreePrivateService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * wbs私有库新增节点接口
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "新增或修改节点", notes = "WbsTreePrivate")
|
|
|
+ public R submit(@Valid @RequestBody WbsTreePrivate wbsTreePrivate) {
|
|
|
+ if (wbsTreePrivateService.submit(wbsTreePrivate)) {
|
|
|
+ CacheUtil.clear(SYS_CACHE);
|
|
|
+ // 返回懒加载树更新节点所需字段
|
|
|
+ Kv kv = Kv.create().set("id", String.valueOf(wbsTreePrivate.getId())).set("tenantId", wbsTreePrivate.getTenantId())
|
|
|
+ .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, wbsTreePrivate.getDeptCategory()));
|
|
|
+ return R.data(kv);
|
|
|
+ }
|
|
|
+ return R.fail("操作失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询当前节点下所有表单(根据节点ID查询当前表单)
|
|
|
+ */
|
|
|
+ @GetMapping("/findNodeTableByCondition")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "查询当前节点下所有元素表", notes = "传入父节点id、wbsId、projectId")
|
|
|
+ public R<List<WbsNodeTableVO>> findNodeTableByCondition(@RequestParam("parentId") String parentId,
|
|
|
+ @RequestParam("wbsId") String wbsId,
|
|
|
+ @RequestParam("projectId") String projectId) {
|
|
|
+ List<WbsNodeTableVO> rs = wbsTreePrivateService.selectByNodeTable(parentId, wbsId, projectId);
|
|
|
+ if (!("").equals(rs) && rs.size() > 0) {
|
|
|
+ return R.data(rs);
|
|
|
+ }
|
|
|
+ return R.fail(200, "未查询到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/removeTableByCondition")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "表单删除", notes = "传入表单id、wbsId、projectId")
|
|
|
+ public R removeTableByCondition(@RequestParam("id") String id,
|
|
|
+ @RequestParam("wbsId") String wbsId,
|
|
|
+ @RequestParam("projectId") String projectId) {
|
|
|
+ //删除表单
|
|
|
+ boolean restul = wbsTreePrivateService.removeTableByCondition(id,wbsId,projectId);
|
|
|
+ if (restul) {
|
|
|
+ return R.success("删除成功");
|
|
|
+ }
|
|
|
+ return R.fail("删除失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|