yantian yue
2023-10-17 487b2f2a353b89ab46cd9b784226b600b7b915b8
提交 | 用户 | 时间
3d2401 1 package cn.stylefeng.guns.modular.zsx.bs.custom.controller;
2
3 import cn.hutool.log.Log;
4 import cn.stylefeng.guns.base.auth.context.LoginContextHolder;
5 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
6 import cn.stylefeng.guns.modular.zsx.bs.custom.entity.CustomInfo;
7 import cn.stylefeng.guns.modular.zsx.bs.custom.model.params.CustomInfoParam;
8 import cn.stylefeng.guns.modular.zsx.bs.custom.service.CustomInfoService;
9 import cn.stylefeng.roses.core.base.controller.BaseController;
10 import cn.stylefeng.roses.kernel.model.response.ResponseData;
11 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Controller;
14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.ResponseBody;
16
17 import java.util.Date;
18
19
20 /**
21  * 客户信息控制器
22  *
23  * @author ruimin
24  * @Date 2023-09-18 15:38:50
25  */
26 @Controller
27 @RequestMapping("/customInfo")
28 public class CustomInfoController extends BaseController {
29
30     private String PREFIX = "/modular/bs/customInfo";
31
32     @Autowired
33     private CustomInfoService customInfoService;
34
35     /**
36      * 跳转到主页面
37      *
38      * @author ruimin
39      * @Date 2023-09-18
40      */
41     @RequestMapping("")
42     public String index() {
43         return PREFIX + "/customInfo.html";
44     }
45
46     /**
47      * 新增页面
48      *
49      * @author ruimin
50      * @Date 2023-09-18
51      */
52     @RequestMapping("/add")
53     public String add() {
54         return PREFIX + "/customInfo_add.html";
55     }
56
57     /**
58      * 编辑页面
59      *
60      * @author ruimin
61      * @Date 2023-09-18
62      */
63     @RequestMapping("/edit")
64     public String edit() {
65         return PREFIX + "/customInfo_edit.html";
66     }
67
68     /**
69      * 新增接口
70      *
71      * @author ruimin
72      * @Date 2023-09-18
73      */
74     @RequestMapping("/addItem")
75     @ResponseBody
76     @DataSource(name = "self")
77     public ResponseData addItem(CustomInfoParam customInfoParam) {
78         customInfoParam.setCreateTime(new Date());
79         customInfoParam.setCreateUser(LoginContextHolder.getContext().getUser().getName());
80         this.customInfoService.add(customInfoParam);
81         return ResponseData.success();
82     }
83
84     /**
85      * 编辑接口
86      *
87      * @author ruimin
88      * @Date 2023-09-18
89      */
90     @RequestMapping("/editItem")
91     @ResponseBody
92     @DataSource(name = "self")
93     public ResponseData editItem(CustomInfoParam customInfoParam) {
94         customInfoParam.setUpdateTime(new Date());
95         customInfoParam.setUpdateUser(LoginContextHolder.getContext().getUser().getName());
96         this.customInfoService.update(customInfoParam);
97         return ResponseData.success();
98     }
99
100     /**
101      * 删除接口
102      *
103      * @author ruimin
104      * @Date 2023-09-18
105      */
106     @RequestMapping("/delete")
107     @ResponseBody
108     @DataSource(name = "self")
109     public ResponseData delete(CustomInfoParam customInfoParam) {
110         this.customInfoService.delete(customInfoParam);
111         return ResponseData.success();
112     }
113
114     /**
115      * 查看详情接口
116      *
117      * @author ruimin
118      * @Date 2023-09-18
119      */
120     @RequestMapping("/detail")
121     @ResponseBody
122     @DataSource(name = "self")
123     public ResponseData detail(CustomInfoParam customInfoParam) {
124         CustomInfo detail = this.customInfoService.getById(customInfoParam.getId());
125         return ResponseData.success(detail);
126     }
127
128     /**
129      * 查询列表
130      *
131      * @author ruimin
132      * @Date 2023-09-18
133      */
134     @ResponseBody
135     @RequestMapping("/list")
136     @DataSource(name = "self")
137     public LayuiPageInfo list(CustomInfoParam customInfoParam) {
138         return this.customInfoService.findPageBySpec(customInfoParam);
139     }
140
141 }
142
143