管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-09-26 b8712ac91f36e0d4a15ea3a623342af5368c898c
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
package com.lf.server.controller.data;
 
 
import com.lf.server.entity.data.DictEntity;
import com.lf.server.service.data.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 字典管理
 * @author sws
 * @date 2022-09.26
 */
@Api(tags = "DictController", description = "字典管理")
@RestController
@RequestMapping("/Dict")
public class DictController {
    @Autowired
    DictService dictService;
 
    @ApiOperation(value = "查询记录数", notes = "查询记录数")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", required = false, example = "sys_dict")
    })
    @GetMapping({"/selectCount"})
    public Integer selectCount(String tab) {
        return dictService.selectCount(tab);
    }
 
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", required = false, example = "sys_dict"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页索引(从0开始)", dataType = "Integer", paramType = "query", example = "0")
    })
    @GetMapping(value = "/selectByPage")
    public List<DictEntity> selectByPage(String tab, Integer pageSize, Integer pageIndex) {
        if (pageSize < 1 || pageIndex < 0) {
            return null;
        }
 
        return dictService.selectByPage(tab, pageSize, pageSize * pageIndex);
    }
 
    @RequestMapping(value = "/insertDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public Integer insertDict(DictEntity dictEntity) {
 
        return dictService.insertDict(dictEntity);
    }
 
    @RequestMapping(value = "/insertDicts", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public Integer insertDicts(@RequestBody List<DictEntity> dictEntity) {
 
        return dictService.insertDicts(dictEntity);
    }
 
    @ResponseBody
    @RequestMapping(value = "/deleteDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public Integer deleteStyle(int id) {
        return dictService.deleteDict(id);
    }
 
 
    @RequestMapping(value = "/deleteDicts", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public Integer deleteDicts(@RequestBody List<Integer> ids) {
        if (!ids.isEmpty()) {
            return dictService.deleteDicts(ids);
        } else {
            return -1;
        }
    }
 
    @ResponseBody
    @RequestMapping(value = "/updateDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public Integer updateDict(DictEntity dictEntity) {
        return dictService.updateDict(dictEntity);
    }
 
    @GetMapping(value = "/selectDict")
    public DictEntity selectDict(int id) {
        return dictService.selectDict(id);
    }
 
    @GetMapping(value = "/selectDictAll")
    public List<DictEntity> selectDictAll() {
        return dictService.selectDictAll();
    }
 
 
    @GetMapping(value = "/selectDictTab")
    public List<DictEntity> selectDictTab() {
        return dictService.selectDictTab();
    }
}