懒羊羊
2023-08-30 71e81ed1d12e4d69f53c8ad9e066650ad4186293
提交 | 用户 | 时间
71e81e 1 package cn.stylefeng.guns.sys.modular.consts.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.sys.modular.consts.entity.SysConfig;
5 import cn.stylefeng.guns.sys.modular.consts.model.params.SysConfigParam;
6 import cn.stylefeng.guns.sys.modular.consts.service.SysConfigService;
7 import cn.stylefeng.roses.core.base.controller.BaseController;
8 import cn.stylefeng.roses.core.util.ToolUtil;
9 import cn.stylefeng.roses.kernel.model.response.ResponseData;
10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Controller;
12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestParam;
14 import org.springframework.web.bind.annotation.ResponseBody;
15
16
17 /**
18  * 参数配置控制器
19  *
20  * @author stylefeng
21  * @Date 2019-06-20 14:32:21
22  */
23 @Controller
24 @RequestMapping("/sysConfig")
25 public class SysConfigController extends BaseController {
26
27     private String PREFIX = "/modular/sysConfig";
28
29     @Autowired
30     private SysConfigService sysConfigService;
31
32     /**
33      * 跳转到主页面
34      *
35      * @author stylefeng
36      * @Date 2019-06-20
37      */
38     @RequestMapping("")
39     public String index() {
40         return PREFIX + "/sysConfig.html";
41     }
42
43     /**
44      * 新增页面
45      *
46      * @author stylefeng
47      * @Date 2019-06-20
48      */
49     @RequestMapping("/add")
50     public String add() {
51         return PREFIX + "/sysConfig_add.html";
52     }
53
54     /**
55      * 编辑页面
56      *
57      * @author stylefeng
58      * @Date 2019-06-20
59      */
60     @RequestMapping("/edit")
61     public String edit() {
62         return PREFIX + "/sysConfig_edit.html";
63     }
64
65     /**
66      * 新增接口
67      *
68      * @author stylefeng
69      * @Date 2019-06-20
70      */
71     @RequestMapping("/addItem")
72     @ResponseBody
73     public ResponseData addItem(SysConfigParam sysConfigParam) {
74         this.sysConfigService.add(sysConfigParam);
75         return ResponseData.success();
76     }
77
78     /**
79      * 编辑接口
80      *
81      * @author stylefeng
82      * @Date 2019-06-20
83      */
84     @RequestMapping("/editItem")
85     @ResponseBody
86     public ResponseData editItem(SysConfigParam sysConfigParam) {
87         this.sysConfigService.update(sysConfigParam);
88         return ResponseData.success();
89     }
90
91     /**
92      * 删除接口
93      *
94      * @author stylefeng
95      * @Date 2019-06-20
96      */
97     @RequestMapping("/delete")
98     @ResponseBody
99     public ResponseData delete(SysConfigParam sysConfigParam) {
100         this.sysConfigService.delete(sysConfigParam);
101         return ResponseData.success();
102     }
103
104     /**
105      * 查看详情接口
106      *
107      * @author stylefeng
108      * @Date 2019-06-20
109      */
110     @RequestMapping("/detail")
111     @ResponseBody
112     public ResponseData detail(SysConfigParam sysConfigParam) {
113         SysConfig detail = this.sysConfigService.getById(sysConfigParam.getId());
114         return ResponseData.success(detail);
115     }
116
117     /**
118      * 查询列表
119      *
120      * @author stylefeng
121      * @Date 2019-06-20
122      */
123     @ResponseBody
124     @RequestMapping("/list")
125     public LayuiPageInfo list(@RequestParam(value = "condition", required = false) String condition) {
126
127         SysConfigParam sysConfigParam = new SysConfigParam();
128
129         if (ToolUtil.isNotEmpty(condition)) {
130             sysConfigParam.setCode(condition);
131             sysConfigParam.setName(condition);
132             sysConfigParam.setRemark(condition);
133             sysConfigParam.setValue(condition);
134         }
135
136         return this.sysConfigService.findPageBySpec(sysConfigParam);
137     }
138
139 }
140
141