|
@@ -1,30 +1,12 @@
|
|
package com.platform.rest.controller.workflow;
|
|
package com.platform.rest.controller.workflow;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
-import com.google.gson.JsonObject;
|
|
|
|
-import com.platform.common.bean.AbstractPageResultBean;
|
|
|
|
-import com.platform.common.exception.BusinessException;
|
|
|
|
-import com.platform.common.util.BeanConverterUtil;
|
|
|
|
import com.platform.common.util.R;
|
|
import com.platform.common.util.R;
|
|
-import com.platform.common.validation.group.AddGroup;
|
|
|
|
-import com.platform.common.validation.group.UpdateGroup;
|
|
|
|
-import com.platform.dao.dto.workflow.WorkflowConditionSwitchDTO;
|
|
|
|
-import com.platform.dao.entity.workflow.WorkflowConditionSwitch;
|
|
|
|
-import com.platform.dao.util.ExcelUtil;
|
|
|
|
-import com.platform.dao.vo.export.workflow.ExportWorkflowConditionSwitchVO;
|
|
|
|
-import com.platform.dao.vo.query.workflow.WorkflowConditionSwitchVO;
|
|
|
|
-import com.platform.rest.log.annotation.SysLog;
|
|
|
|
-import com.platform.service.util.DatabaseUtil;
|
|
|
|
-import com.platform.service.workflow.WorkflowConditionSwitchService;
|
|
|
|
|
|
+import com.platform.service.custom.DataBaseOperatorService;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-import org.springframework.util.unit.DataUnit;
|
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description 流程审核条件分支表 控制器
|
|
* @Description 流程审核条件分支表 控制器
|
|
@@ -37,62 +19,15 @@ import java.util.List;
|
|
@RequestMapping("/database/data")
|
|
@RequestMapping("/database/data")
|
|
public class DatabaseController {
|
|
public class DatabaseController {
|
|
|
|
|
|
-
|
|
|
|
- public static void main(String[] args) {
|
|
|
|
- String h ="shabi_ga_gawe";
|
|
|
|
- String[] arr =h.split("_");
|
|
|
|
- String str = h;
|
|
|
|
- if (arr.length>1){
|
|
|
|
- str = arr[0];
|
|
|
|
- for (int i=1;i<arr.length;i++){
|
|
|
|
- arr[i] = arr[i].substring(0,1).toUpperCase()+arr[i].substring(1);
|
|
|
|
- str+=arr[i];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- System.out.println(str);
|
|
|
|
- }
|
|
|
|
|
|
+ private final DataBaseOperatorService dataBaseOperatorService;
|
|
/**
|
|
/**
|
|
* 通过id查询单条记录
|
|
* 通过id查询单条记录
|
|
- *
|
|
|
|
* @param tableName 主键
|
|
* @param tableName 主键
|
|
* @return R
|
|
* @return R
|
|
*/
|
|
*/
|
|
@GetMapping("/getTableInfos/{tableName}")
|
|
@GetMapping("/getTableInfos/{tableName}")
|
|
public R getTableInfos(@PathVariable("tableName") String tableName) {
|
|
public R getTableInfos(@PathVariable("tableName") String tableName) {
|
|
- if (tableName==null){
|
|
|
|
- throw new BusinessException("表名为空!");
|
|
|
|
- }
|
|
|
|
- List<String> columnNames2 = DatabaseUtil.getColumnNames(tableName);
|
|
|
|
- List<String> columnNames = new ArrayList<>();
|
|
|
|
- for (int j=0;j<columnNames2.size();j++ ) {
|
|
|
|
- String[] arr = columnNames2.get(j).split("_");
|
|
|
|
- String str = columnNames2.get(j);
|
|
|
|
- if (arr.length > 1) {
|
|
|
|
- str = arr[0];
|
|
|
|
- for (int i = 1; i < arr.length; i++) {
|
|
|
|
- arr[i] = arr[i].substring(0, 1).toUpperCase() + arr[i].substring(1);
|
|
|
|
- str += arr[i];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- columnNames.add(str);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<String> columnComments = DatabaseUtil.getColumnComments(tableName);
|
|
|
|
- List<JSONObject> list = new ArrayList<>();
|
|
|
|
- for (int i = 0;i<columnNames.size();i++){
|
|
|
|
- for (int j = 0;j<columnComments.size();j++){
|
|
|
|
- if (i==j){
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- jsonObject.put("columnName",columnNames.get(i));
|
|
|
|
- jsonObject.put("columnComment",columnComments.get(j));
|
|
|
|
- list.add(jsonObject);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new R<>(list);
|
|
|
|
|
|
+ return new R(dataBaseOperatorService.getColumnsByTableName(tableName));
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|