|
@@ -24,11 +24,15 @@ import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.manager.dto.WbsInfoDTO;
|
|
|
import org.springblade.manager.entity.WbsInfo;
|
|
|
+import org.springblade.manager.entity.WbsTree;
|
|
|
+import org.springblade.manager.service.IWbsTreeService;
|
|
|
import org.springblade.manager.vo.WbsInfoVO;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -49,6 +53,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
public class WbsInfoController extends BladeController {
|
|
|
|
|
|
private final IWbsInfoService wbsInfoService;
|
|
|
+ private final IWbsTreeService wbsTreeService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
@@ -117,8 +122,30 @@ public class WbsInfoController extends BladeController {
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入wbsInfo")
|
|
|
@ApiImplicitParam(value = "id",name = "id",required = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R submit(@Valid @RequestBody WbsInfoDTO wbsInfo) {
|
|
|
- return R.status(wbsInfoService.saveOrUpdate(wbsInfo));
|
|
|
+ boolean result1 = wbsInfoService.saveOrUpdate(wbsInfo);
|
|
|
+ if (result1){
|
|
|
+ Long wbsId = wbsInfo.getId();
|
|
|
+ String nodeName = wbsInfo.getWbsName();
|
|
|
+ //初始化wbs动态库树的根节点
|
|
|
+ WbsTree wbsTree = new WbsTree();
|
|
|
+ wbsTree.setWbsId(String.valueOf(wbsId));
|
|
|
+ wbsTree.setTenantId(AuthUtil.getTenantId());
|
|
|
+ wbsTree.setParentId(0L);
|
|
|
+ wbsTree.setAncestors("0");
|
|
|
+ wbsTree.setDeptCategory(1);
|
|
|
+ wbsTree.setDeptName(nodeName);
|
|
|
+ wbsTree.setFullName(nodeName);
|
|
|
+// wbsTree.setSort(1);
|
|
|
+ wbsTree.setType(1);
|
|
|
+// wbsTree.setTableType(-1);
|
|
|
+ boolean result2 = wbsTreeService.save(wbsTree);
|
|
|
+ if (result2){
|
|
|
+ return R.data(wbsInfo,"操作成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
|