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