|
@@ -16,17 +16,24 @@
|
|
|
*/
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.manager.dto.TableInfoDTO;
|
|
|
+import org.springblade.manager.entity.WbsTree;
|
|
|
+import org.springblade.manager.service.impl.WbsTreeServiceImpl;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -49,90 +56,109 @@ import java.util.List;
|
|
|
@Api(value = "实体主表信息", tags = "实体主表信息接口")
|
|
|
public class TableInfoController extends BladeController {
|
|
|
|
|
|
- private final ITableInfoService tableInfoService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 详情
|
|
|
- */
|
|
|
- @GetMapping("/detail")
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation(value = "详情", notes = "传入tableInfo")
|
|
|
- public R<TableInfo> detail(TableInfo tableInfo) {
|
|
|
- TableInfo detail = tableInfoService.getOne(Condition.getQueryWrapper(tableInfo));
|
|
|
- return R.data(detail);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页 实体主表信息
|
|
|
- */
|
|
|
- @GetMapping("/list")
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @ApiOperation(value = "分页", notes = "传入tableInfo")
|
|
|
- public R<IPage<TableInfo>> list(TableInfo tableInfo, Query query) {
|
|
|
- IPage<TableInfo> pages = tableInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(tableInfo));
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 自定义分页 实体主表信息
|
|
|
- */
|
|
|
- @GetMapping("/page")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "分页", notes = "传入tableInfo")
|
|
|
- public R<IPage<TableInfoVO>> page(TableInfoVO tableInfo, Query query) {
|
|
|
- IPage<TableInfoVO> pages = tableInfoService.selectTableInfoPage(Condition.getPage(query), tableInfo);
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增 实体主表信息
|
|
|
- */
|
|
|
- @PostMapping("/save")
|
|
|
- @ApiOperationSupport(order = 4)
|
|
|
- @ApiOperation(value = "新增", notes = "传入tableInfo")
|
|
|
- public R save(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
- return R.status(tableInfoService.save(tableInfo));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改 实体主表信息
|
|
|
- */
|
|
|
- @PostMapping("/update")
|
|
|
- @ApiOperationSupport(order = 5)
|
|
|
- @ApiOperation(value = "修改", notes = "传入tableInfo")
|
|
|
- public R update(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
- return R.status(tableInfoService.updateById(tableInfo));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增或修改 实体主表信息
|
|
|
- */
|
|
|
- @PostMapping("/submit")
|
|
|
- @ApiOperationSupport(order = 6)
|
|
|
- @ApiOperation(value = "新增或修改", notes = "传入tableInfo")
|
|
|
- public R submit(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
- return R.status(tableInfoService.saveOrUpdate(tableInfo));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除 实体主表信息
|
|
|
- */
|
|
|
- @PostMapping("/remove")
|
|
|
- @ApiOperationSupport(order = 7)
|
|
|
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
- return R.status(tableInfoService.deleteLogic(Func.toLongList(ids)));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 元素库的修改
|
|
|
- */
|
|
|
- @ApiOperationSupport(order = 8)
|
|
|
- @ApiOperation(value = "元素修改节点信息", notes = "传入List<WbsTree>")
|
|
|
- @RequestMapping(value = "/update-batch-tableInfo", method = RequestMethod.POST)
|
|
|
- public R updateBatchTableInfo(@RequestBody List<TableInfo> tableInfos) {
|
|
|
- //
|
|
|
- return R.status(tableInfoService.updateBatchById(tableInfos));
|
|
|
- }
|
|
|
+ private final ITableInfoService tableInfoService;
|
|
|
+ private final WbsTreeServiceImpl wbsTreeService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入tableInfo")
|
|
|
+ public R<TableInfo> detail(TableInfo tableInfo) {
|
|
|
+ TableInfo detail = tableInfoService.getOne(Condition.getQueryWrapper(tableInfo));
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页 实体主表信息
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入tableInfo")
|
|
|
+ public R<IPage<TableInfo>> list(TableInfo tableInfo, Query query) {
|
|
|
+ IPage<TableInfo> pages = tableInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(tableInfo));
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义分页 实体主表信息
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入tableInfo")
|
|
|
+ public R<IPage<TableInfoVO>> page(TableInfoVO tableInfo, Query query) {
|
|
|
+ IPage<TableInfoVO> pages = tableInfoService.selectTableInfoPage(Condition.getPage(query), tableInfo);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增 实体主表信息
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "新增", notes = "传入tableInfo")
|
|
|
+ public R save(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
+ return R.status(tableInfoService.save(tableInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改 实体主表信息
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入tableInfo")
|
|
|
+ public R update(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
+ return R.status(tableInfoService.updateById(tableInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或修改 实体主表信息
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "新增或修改", notes = "传入tableInfo")
|
|
|
+ public R submit(@Valid @RequestBody TableInfo tableInfo) {
|
|
|
+ return R.status(tableInfoService.saveOrUpdate(tableInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除 实体主表信息
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(tableInfoService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元素库的修改
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "元素修改节点信息", notes = "传入List<WbsTree>")
|
|
|
+ @RequestMapping(value = "/update-batch-tableInfo", method = RequestMethod.POST)
|
|
|
+ public R updateBatchTableInfo(@RequestBody List<TableInfoDTO> tableInfos) {
|
|
|
+ for (TableInfoDTO tableInfo : tableInfos) {
|
|
|
+ WbsTree wbsTree = wbsTreeService.getBaseMapper().selectById(tableInfo.getId());
|
|
|
+ if (wbsTree != null) {
|
|
|
+ wbsTree.setFillRate(tableInfo.getFillRate());
|
|
|
+ wbsTree.setNodeName(tableInfo.getNodeName());
|
|
|
+ wbsTree.setFullName(tableInfo.getNodeName());
|
|
|
+ wbsTree.setTableOwner(tableInfo.getTableOwner());
|
|
|
+ wbsTree.setTableType(tableInfo.getTabType());
|
|
|
+ wbsTreeService.updateById(wbsTree);
|
|
|
+
|
|
|
+ TableInfo tableInfoObj = BeanUtil.copyProperties(tableInfo, TableInfo.class);
|
|
|
+ if (tableInfoObj != null) {
|
|
|
+ tableInfoObj.setTabChName(wbsTree.getNodeName());
|
|
|
+ tableInfoService.updateById(tableInfoObj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|