|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
+import com.mixsmart.utils.StringUtils;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.manager.dto.FormElementDTO2;
|
|
|
import org.springblade.manager.dto.WbsFormElementDTO;
|
|
@@ -57,7 +59,11 @@ public class WbsFormElementController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "新增", notes = "传入wbsFormElement")
|
|
|
public R save(@Valid @RequestBody WbsFormElementDTO wbsFormElement) {
|
|
|
- return R.data(wbsFormElementService.saveAndSyn(wbsFormElement, wbsFormElement.getInitTableName()));
|
|
|
+ if (StringUtils.isEmpty(wbsFormElement.getInitTableName())) {
|
|
|
+ throw new ServiceException("未获取到对应的实体表名称initTableName,操作失败");
|
|
|
+ } else {
|
|
|
+ return R.data(wbsFormElementService.saveAndSyn(wbsFormElement, wbsFormElement.getInitTableName()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -72,6 +78,7 @@ public class WbsFormElementController extends BladeController {
|
|
|
|
|
|
/**
|
|
|
* 新增或修改 wbs表单元素
|
|
|
+ *
|
|
|
* @deprecated 未使用
|
|
|
*/
|
|
|
@PostMapping("/submit")
|
|
@@ -99,10 +106,14 @@ public class WbsFormElementController extends BladeController {
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam("ids") String ids,
|
|
|
@RequestParam("eKey") String eKey, @RequestParam("initTableName") String initTableName) {
|
|
|
- if (wbsFormElementService.deleteAndSyn(ids, eKey, initTableName)) {
|
|
|
- return R.success("操作成功");
|
|
|
+ if (StringUtils.isEmpty(initTableName)) {
|
|
|
+ throw new ServiceException("未获取到对应的实体表名称initTableName,操作失败");
|
|
|
+ } else {
|
|
|
+ if (wbsFormElementService.deleteAndSyn(ids, eKey, initTableName)) {
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ return R.fail("操作失败");
|
|
|
}
|
|
|
- return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -114,7 +125,6 @@ public class WbsFormElementController extends BladeController {
|
|
|
public void exportWbsTree(HttpServletResponse response) {
|
|
|
List<WbsFormElementExcel> list = new ArrayList<>();
|
|
|
ExcelUtil.export(response, "WBS元素模板", "WBS元素模板", list, WbsFormElementExcel.class);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -230,7 +240,4 @@ public class WbsFormElementController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|