添加功能
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import com.ruoyi.cms.domain.ModelWarningIndicator;
|
||||
import com.ruoyi.cms.domain.vo.TreeVo;
|
||||
import com.ruoyi.cms.service.ModelWarningIndicatorService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 就业失业预警指标
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/1
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model/warningIndicator")
|
||||
@RequiredArgsConstructor
|
||||
public class ModelWarningIndicatorController extends BaseController {
|
||||
|
||||
private final ModelWarningIndicatorService modelWarningIndicatorService;
|
||||
|
||||
/**
|
||||
* 创建指标
|
||||
*
|
||||
* @param modelWarningIndicator 指标
|
||||
* @return 创建结果
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
public AjaxResult createIndicator(@Valid @RequestBody ModelWarningIndicator modelWarningIndicator) {
|
||||
modelWarningIndicatorService.create(modelWarningIndicator);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新指标
|
||||
*
|
||||
* @param modelWarningIndicator 指标
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public AjaxResult updateIndicator(@Valid @RequestBody ModelWarningIndicator modelWarningIndicator) {
|
||||
modelWarningIndicatorService.update(modelWarningIndicator);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指标
|
||||
*
|
||||
* @param id 指标id
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public AjaxResult deleteIndicator(@RequestParam Long id) {
|
||||
modelWarningIndicatorService.delete(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指标详情
|
||||
*
|
||||
* @param id ID
|
||||
* @return 指标
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(@RequestParam Long id) {
|
||||
ModelWarningIndicator indicator = modelWarningIndicatorService.detail(id);
|
||||
return AjaxResult.success(indicator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页列表
|
||||
*
|
||||
* @param modelWarningIndicator 指标
|
||||
* @return 分页列表
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
@ResponseBody
|
||||
public TableDataInfo page(@RequestBody ModelWarningIndicator modelWarningIndicator) {
|
||||
startPage();
|
||||
List<ModelWarningIndicator> list = modelWarningIndicatorService.list(modelWarningIndicator);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 树结构
|
||||
*
|
||||
* @return 树结构
|
||||
*/
|
||||
@GetMapping("/tree")
|
||||
public AjaxResult tree() {
|
||||
|
||||
List<TreeVo> treeList = new ArrayList<>();
|
||||
treeList.add(TreeVo.builder()
|
||||
.id(1L)
|
||||
.code("1")
|
||||
.desc("就业指标")
|
||||
.children(modelWarningIndicatorService.tree(1))
|
||||
.build());
|
||||
treeList.add(TreeVo.builder()
|
||||
.id(2L)
|
||||
.code("2")
|
||||
.desc("失业指标")
|
||||
.children(modelWarningIndicatorService.tree(2))
|
||||
.build());
|
||||
treeList.add(TreeVo.builder()
|
||||
.id(3L)
|
||||
.code("3")
|
||||
.desc("经济指标")
|
||||
.children(modelWarningIndicatorService.tree(3))
|
||||
.build());
|
||||
|
||||
return AjaxResult.success(treeList);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user