懒羊羊
2023-10-17 5d91e0a52879bf16511817b3cd20496f07717ab1
提交 | 用户 | 时间
1ac2bc 1 package cn.stylefeng.guns.modular.zsx.sys.codingRule.controller;
2
3 import cn.stylefeng.guns.base.auth.context.LoginContextHolder;
4 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
5 import cn.stylefeng.guns.modular.zsx.sys.codingRule.entity.CodingRule;
6 import cn.stylefeng.guns.modular.zsx.sys.codingRule.model.params.CodingRuleParam;
7 import cn.stylefeng.guns.modular.zsx.sys.codingRule.service.CodingRuleService;
8 import cn.stylefeng.guns.sys.modular.system.service.DictService;
9 import cn.stylefeng.guns.sys.modular.system.service.DictTypeService;
10 import cn.stylefeng.roses.core.base.controller.BaseController;
11 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
12 import cn.stylefeng.roses.kernel.model.response.ResponseData;
13 import org.apache.commons.lang3.StringUtils;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Controller;
16 import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.ResponseBody;
18
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
21
22
23 /**
24  * 编码规则控制器
25  *
26  * @author ruimin
27  * @Date 2023-08-23 09:56:31
28  */
29 @Controller
30 @RequestMapping("/codingRule")
31 public class CodingRuleController extends BaseController {
32
33     private String PREFIX = "/modular/sys/codingRule";
34
35     @Autowired
36     private CodingRuleService codingRuleService;
37
38     /**
39      * 跳转到主页面
40      *
41      * @author ruimin
42      * @Date 2023-08-23
43      */
44     @RequestMapping("")
45     public String index() {
46         return PREFIX + "/codingRule.html";
47     }
48
49     /**
50      * 新增页面
51      *
52      * @author ruimin
53      * @Date 2023-08-23
54      */
55     @RequestMapping("/add")
56     public String add() {
57         return PREFIX + "/codingRule_add.html";
58     }
59
60     /**
61      * 编辑页面
62      *
63      * @author ruimin
64      * @Date 2023-08-23
65      */
66     @RequestMapping("/edit")
67     public String edit() {
68         return PREFIX + "/codingRule_edit.html";
69     }
70
71     /**
72      * 新增接口
73      *
74      * @author ruimin
75      * @Date 2023-08-23
76      */
77     @RequestMapping("/addItem")
78     @ResponseBody
79     @DataSource(name = "self")
80     public ResponseData addItem(CodingRuleParam codingRuleParam) {
81         this.codingRuleService.add(codingRuleParam);
82         return ResponseData.success();
83     }
84
85     @RequestMapping("/addItemCodingRule")
86     @ResponseBody
87     @DataSource(name = "self")
88     public ResponseData addItemCodingRule(CodingRuleParam codingRuleParam) {
89         this.codingRuleService.addItemCodingRule(codingRuleParam);
90         return ResponseData.success();
91     }
92
93     /**
94      * 编辑接口
95      *
96      * @author ruimin
97      * @Date 2023-08-23
98      */
99     @RequestMapping("/editItem")
100     @ResponseBody
101     @DataSource(name = "self")
102     public ResponseData editItem(CodingRuleParam codingRuleParam) {
103         this.codingRuleService.update(codingRuleParam);
104         return ResponseData.success();
105     }
106
107     /**
108      * 删除接口
109      *
110      * @author ruimin
111      * @Date 2023-08-23
112      */
113     @RequestMapping("/delete")
114     @ResponseBody
115     @DataSource(name = "self")
116     public ResponseData delete(CodingRuleParam codingRuleParam) {
117         this.codingRuleService.delete(codingRuleParam);
118         return ResponseData.success();
119     }
120
121     /**
122      * 查看详情接口
123      *
124      * @author ruimin
125      * @Date 2023-08-23
126      */
127     @RequestMapping("/detail")
128     @ResponseBody
129     @DataSource(name = "self")
130     public ResponseData detail(CodingRuleParam codingRuleParam) {
131         CodingRule detail = this.codingRuleService.getById(codingRuleParam.getId());
132         return ResponseData.success(detail);
133     }
134
135     /**
136      * 查询列表
137      *
138      * @author ruimin
139      * @Date 2023-08-23
140      */
141     @ResponseBody
142     @RequestMapping("/list")
143     @DataSource(name = "self")
144     public LayuiPageInfo list(CodingRuleParam codingRuleParam) {
145         return this.codingRuleService.findPageBySpec(codingRuleParam);
146     }
147
148     public static void main(String[] args) {
149         String paddedString = StringUtils.leftPad("1", 3, "0");
150         System.out.println(paddedString); // 输出:00123
151     }
152
153 }
154
155