|
@@ -2,13 +2,11 @@ package com.ruoyi.interfaces.controller;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.interfaces.domain.MdDataField;
|
|
import com.ruoyi.interfaces.domain.MdDataField;
|
|
|
-import com.ruoyi.interfaces.service.IMdDataFieldService;
|
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
|
|
+import com.ruoyi.interfaces.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -23,20 +21,18 @@ 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.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.interfaces.domain.MdDataSet;
|
|
import com.ruoyi.interfaces.domain.MdDataSet;
|
|
|
-import com.ruoyi.interfaces.service.IMdDataSetService;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 数据集Controller
|
|
* 数据集Controller
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @author 朱得糠
|
|
* @author 朱得糠
|
|
|
* @date 2025-07-30
|
|
* @date 2025-07-30
|
|
|
*/
|
|
*/
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/data/set")
|
|
@RequestMapping("/data/set")
|
|
|
-public class MdDataSetController extends BaseController
|
|
|
|
|
-{
|
|
|
|
|
|
|
+public class MdDataSetController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IMdDataSetService mdDataSetService;
|
|
private IMdDataSetService mdDataSetService;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -47,8 +43,7 @@ public class MdDataSetController extends BaseController
|
|
|
* 查询数据集列表
|
|
* 查询数据集列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(MdDataSet mdDataSet)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public TableDataInfo list(MdDataSet mdDataSet) {
|
|
|
startPage();
|
|
startPage();
|
|
|
List<MdDataSet> list = mdDataSetService.selectMdDataSetList(mdDataSet);
|
|
List<MdDataSet> list = mdDataSetService.selectMdDataSetList(mdDataSet);
|
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -59,8 +54,7 @@ public class MdDataSetController extends BaseController
|
|
|
*/
|
|
*/
|
|
|
@Log(title = "数据集", businessType = BusinessType.EXPORT)
|
|
@Log(title = "数据集", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, MdDataSet mdDataSet)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public void export(HttpServletResponse response, MdDataSet mdDataSet) {
|
|
|
List<MdDataSet> list = mdDataSetService.selectMdDataSetList(mdDataSet);
|
|
List<MdDataSet> list = mdDataSetService.selectMdDataSetList(mdDataSet);
|
|
|
ExcelUtil<MdDataSet> util = new ExcelUtil<MdDataSet>(MdDataSet.class);
|
|
ExcelUtil<MdDataSet> util = new ExcelUtil<MdDataSet>(MdDataSet.class);
|
|
|
util.exportExcel(response, list, "数据集数据");
|
|
util.exportExcel(response, list, "数据集数据");
|
|
@@ -70,14 +64,13 @@ public class MdDataSetController extends BaseController
|
|
|
* 获取数据集详细信息
|
|
* 获取数据集详细信息
|
|
|
*/
|
|
*/
|
|
|
@GetMapping(value = "/{dsCode}")
|
|
@GetMapping(value = "/{dsCode}")
|
|
|
- public AjaxResult getInfo(@PathVariable("dsCode") String dsCode)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("dsCode") String dsCode) {
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
MdDataSet mdDataSet = mdDataSetService.selectMdDataSetByDsCode(dsCode);
|
|
MdDataSet mdDataSet = mdDataSetService.selectMdDataSetByDsCode(dsCode);
|
|
|
- map.put("dataSet",mdDataSet);
|
|
|
|
|
|
|
+ map.put("dataSet", mdDataSet);
|
|
|
if (StringUtils.isNull(mdDataSet)) return error();
|
|
if (StringUtils.isNull(mdDataSet)) return error();
|
|
|
List<MdDataField> fieldList = mdDataFieldService.selectMdDataFieldByDsCode(mdDataSet.getDcCode());
|
|
List<MdDataField> fieldList = mdDataFieldService.selectMdDataFieldByDsCode(mdDataSet.getDcCode());
|
|
|
- map.put("fieldList",fieldList);
|
|
|
|
|
|
|
+ map.put("fieldList", fieldList);
|
|
|
return success(map);
|
|
return success(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -86,8 +79,7 @@ public class MdDataSetController extends BaseController
|
|
|
*/
|
|
*/
|
|
|
@Log(title = "数据集", businessType = BusinessType.INSERT)
|
|
@Log(title = "数据集", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody MdDataSet mdDataSet)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody MdDataSet mdDataSet) {
|
|
|
return toAjax(mdDataSetService.insertMdDataSet(mdDataSet));
|
|
return toAjax(mdDataSetService.insertMdDataSet(mdDataSet));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -96,8 +88,7 @@ public class MdDataSetController extends BaseController
|
|
|
*/
|
|
*/
|
|
|
@Log(title = "数据集", businessType = BusinessType.UPDATE)
|
|
@Log(title = "数据集", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody MdDataSet mdDataSet)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody MdDataSet mdDataSet) {
|
|
|
return toAjax(mdDataSetService.updateMdDataSet(mdDataSet));
|
|
return toAjax(mdDataSetService.updateMdDataSet(mdDataSet));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -105,11 +96,35 @@ public class MdDataSetController extends BaseController
|
|
|
* 删除数据集
|
|
* 删除数据集
|
|
|
*/
|
|
*/
|
|
|
@Log(title = "数据集", businessType = BusinessType.DELETE)
|
|
@Log(title = "数据集", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{dsCodes}")
|
|
|
|
|
- public AjaxResult remove(@PathVariable String[] dsCodes)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ @DeleteMapping("/{dsCodes}")
|
|
|
|
|
+ public AjaxResult remove(@PathVariable String[] dsCodes) {
|
|
|
return toAjax(mdDataSetService.deleteMdDataSetByDsCodes(dsCodes));
|
|
return toAjax(mdDataSetService.deleteMdDataSetByDsCodes(dsCodes));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMdDataSetApiService setApiService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMdDataSetFileService setFileService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMdDataSetSqlService setSqlService;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getSetConfig")
|
|
|
|
|
+ public AjaxResult getSetConfig(MdDataSet dataSet) {
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isNull(dataSet.getDcCode())) return error("数据集不可为空");
|
|
|
|
|
+ if (StringUtils.isNull(dataSet.getDcType())) return error("请配置数据集类型");
|
|
|
|
|
+ switch (dataSet.getDcType()) {
|
|
|
|
|
+ case "sql":
|
|
|
|
|
+ return success(setSqlService.selectMdDataSetSqlByDcCode(dataSet.getDcCode()));
|
|
|
|
|
+ case "api":
|
|
|
|
|
+ return success(setApiService.selectMdDataSetApiByDcCode(dataSet.getDcCode()));
|
|
|
|
|
+ case "file":
|
|
|
|
|
+ return success(setFileService.selectMdDataSetFileByDcCode(dataSet.getDcCode()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return error("数据集类型异常");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|