|
@@ -1,30 +1,17 @@
|
|
package com.ruoyi.web.controller.dragForm;
|
|
package com.ruoyi.web.controller.dragForm;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
|
-import com.alibaba.fastjson2.JSONArray;
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
-import com.ruoyi.common.constant.ButtonTypeConstants;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
-import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
|
import com.ruoyi.common.utils.form.FromUtils;
|
|
import com.ruoyi.common.utils.form.FromUtils;
|
|
import com.ruoyi.system.entity.CommonEntity;
|
|
import com.ruoyi.system.entity.CommonEntity;
|
|
import com.ruoyi.system.entity.DragForm;
|
|
import com.ruoyi.system.entity.DragForm;
|
|
import com.ruoyi.system.entity.DragTableBtn;
|
|
import com.ruoyi.system.entity.DragTableBtn;
|
|
-import com.ruoyi.system.entity.DragTableGroup;
|
|
|
|
-import com.ruoyi.system.entity.vo.DragTableGroupVo;
|
|
|
|
-import com.ruoyi.system.entity.vo.DragTableVo;
|
|
|
|
-import com.ruoyi.system.mapper.DragTableBtnMapper;
|
|
|
|
-import com.ruoyi.system.mapper.DragTableBtnRelevanceMapper;
|
|
|
|
-import com.ruoyi.system.mapper.DragTableGroupMapper;
|
|
|
|
import com.ruoyi.system.mapper.DragTableMapper;
|
|
import com.ruoyi.system.mapper.DragTableMapper;
|
|
import com.ruoyi.system.service.*;
|
|
import com.ruoyi.system.service.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author hanzihang
|
|
* @author hanzihang
|
|
@@ -49,33 +36,18 @@ public class CommonBtnController extends BaseController {
|
|
private DragTableMapper dragTableMapper;
|
|
private DragTableMapper dragTableMapper;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- private IDragTableGroupService dragTableGroupService;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ private IDragTableGroupService dragTableGroupService;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 处理按钮通用接口(新增、修改、删除)
|
|
|
|
|
|
+ * 处理按钮通用接口(新增、修改、删除...)
|
|
|
|
+ * 判断什么类型走什么接口: visible false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
|
|
|
|
+ * 是否提交表单操作 true是 false回显表单数据 commonEntity.getBasicMap().get("visible").toString()
|
|
*/
|
|
*/
|
|
@PostMapping("/commonBtnHandle")
|
|
@PostMapping("/commonBtnHandle")
|
|
- public AjaxResult commonBtnHandle(@RequestBody CommonEntity commonEntity) throws JsonProcessingException {
|
|
|
|
-
|
|
|
|
- //按钮类型
|
|
|
|
- Long btnType = Long.valueOf(commonEntity.getBasicMap().get("btnType").toString());
|
|
|
|
- String type = "";
|
|
|
|
- if (btnType == ButtonTypeConstants.INSERT) {
|
|
|
|
- type = "INSERT";
|
|
|
|
- } else if (btnType == ButtonTypeConstants.UPDATE) {
|
|
|
|
- type = "UPDATE";
|
|
|
|
- } else if (btnType == ButtonTypeConstants.DELETE) {
|
|
|
|
- type = "DELETE";
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * 判断什么类型走什么接口:
|
|
|
|
- * btnType 10:新增、8:修改、9:删除、5:脚本
|
|
|
|
- * visible false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
|
|
|
|
- * */
|
|
|
|
- //是否提交表单操作 true是 false回显表单数据 commonEntity.getBasicMap().get("visible").toString()
|
|
|
|
- switch (type) {
|
|
|
|
|
|
+ public AjaxResult commonBtnHandle(@RequestBody CommonEntity commonEntity) {
|
|
|
|
+ // 获取到按钮类型
|
|
|
|
+ String btnType = commonEntity.getBasicMap().get("btnType").toString();
|
|
|
|
+ switch (btnType) {
|
|
case "INSERT":
|
|
case "INSERT":
|
|
return insertBtn(commonEntity);
|
|
return insertBtn(commonEntity);
|
|
case "UPDATE":
|
|
case "UPDATE":
|
|
@@ -87,9 +59,14 @@ public class CommonBtnController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 新增类型按钮
|
|
|
|
+ *
|
|
|
|
+ * @param commonEntity
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
|
|
- // 新增类型按钮
|
|
|
|
- public AjaxResult insertBtn(CommonEntity commonEntity) throws JsonProcessingException {
|
|
|
|
|
|
+ public AjaxResult insertBtn(CommonEntity commonEntity) {
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
|
|
return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
|
|
} else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
|
|
} else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
|
|
@@ -101,8 +78,13 @@ public class CommonBtnController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- // 修改类型按钮
|
|
|
|
- public AjaxResult updateBtn(CommonEntity commonEntity) throws JsonProcessingException {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 修改类型按钮
|
|
|
|
+ *
|
|
|
|
+ * @param commonEntity
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public AjaxResult updateBtn(CommonEntity commonEntity) {
|
|
//是否开启弹窗
|
|
//是否开启弹窗
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
if (commonEntity.getBasicMap().containsKey("btnKey")) { // 按钮提交时会触发别的操作
|
|
if (commonEntity.getBasicMap().containsKey("btnKey")) { // 按钮提交时会触发别的操作
|
|
@@ -136,7 +118,12 @@ public class CommonBtnController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- // 删除类型按钮
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 删除类型按钮
|
|
|
|
+ *
|
|
|
|
+ * @param commonEntity
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
public AjaxResult deleteBtn(CommonEntity commonEntity) {
|
|
public AjaxResult deleteBtn(CommonEntity commonEntity) {
|
|
return toAjax(commonService.batchDelete(commonEntity));
|
|
return toAjax(commonService.batchDelete(commonEntity));
|
|
}
|
|
}
|