guoshilong
2023-05-13 27663a18014d15bfeac14bdeaa3d99bf3d947bb9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package cn.gistack.sm.resDataCheck.controller;
 
import cn.gistack.sm.resDataCheck.entity.RulesCondition;
import cn.gistack.sm.resDataCheck.service.IRulesConditionService;
import cn.gistack.sm.resDataCheck.service.IRulesService;
import cn.gistack.sm.resDataCheck.vo.RulesVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
 
import java.util.Arrays;
 
/**
 * @Description: 数据规则校验
 */
@Slf4j
@Api(tags = "数据规则校验")
@RestController
@RequestMapping("/resDataCheck/rulesCondition")
@AllArgsConstructor
public class ConditionController extends BladeController {
 
    private IRulesConditionService conditionService;
 
    /**
     * 分页列表查询
     */
    @ApiOperation(value = "数据规则校验-分页列表查询", notes = "数据规则校验-分页列表查询")
    @GetMapping(value = "/list")
    public R<IPage<RulesCondition>> queryPageList(RulesCondition rulesCondition, Query query) {
        IPage<RulesCondition> pageList = conditionService.selectRulesConditionPage(Condition.getPage(query), rulesCondition);
        return R.data(pageList);
    }
 
    /**
     * 添加
     *
     * @param rulesCondition
     * @return
     */
    @ApiOperation(value = "数据规则校验-添加", notes = "数据规则校验-添加")
    @PostMapping(value = "/add")
    public R add(@RequestBody RulesCondition rulesCondition) {
        return R.data(conditionService.save(rulesCondition));
    }
 
    /**
     * 编辑
     *
     * @param rulesCondition
     * @return
     */
    @ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public R edit(@RequestBody RulesCondition rulesCondition) {
        return R.data(conditionService.updateById(rulesCondition));
    }
 
    /**
     * 通过id删除
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "数据规则校验-通过id删除", notes = "数据规则校验-通过id删除")
    @DeleteMapping(value = "/delete")
    public R delete(@RequestParam(name = "id", required = true) String id) {
        return R.data(conditionService.removeById(id));
    }
 
    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @ApiOperation(value = "数据规则校验-批量删除", notes = "数据规则校验-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public R deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        return R.data(conditionService.removeByIds(Arrays.asList(ids.split(","))));
    }
 
    /**
     * 通过id查询
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询")
    @GetMapping(value = "/queryById")
    public R queryById(@RequestParam(name = "id", required = true) String id) {
        RulesCondition rulesCondition = conditionService.getById(id);
        return R.data(rulesCondition);
    }
 
 
 
}