xuhy
2023-03-24 3ef0e72a9361a8d4dc23c2825c78711d3e3c3f71
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
package com.stylefeng.guns.modular.system.controller.general;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.modular.system.controller.util.LabelReplaceUtil;
import com.stylefeng.guns.modular.system.enums.HtmlTypeEnum;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.THtml;
import com.stylefeng.guns.modular.system.service.ITHtmlService;
 
/**
 * 控制器
 *
 * @author fengshuonan
 * @Date 2023-03-24 10:50:08
 */
@Controller
@RequestMapping("/tHtml")
public class THtmlController extends BaseController {
 
    private String PREFIX = "/system/tHtml/";
 
    @Autowired
    private ITHtmlService tHtmlService;
 
    /**
     * 跳转到首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "tHtml.html";
    }
 
    /**
     * 跳转到添加
     */
    @RequestMapping("/tHtml_add")
    public String tHtmlAdd() {
        return PREFIX + "tHtml_add.html";
    }
 
    /**
     * 跳转到修改
     */
    @RequestMapping("/tHtml_update/{tHtmlId}")
    public String tHtmlUpdate(@PathVariable Integer tHtmlId, Model model) {
        THtml tHtml = tHtmlService.selectById(tHtmlId);
        model.addAttribute("item",tHtml);
        LogObjectHolder.me().set(tHtml);
        return PREFIX + "tHtml_edit.html";
    }
 
    /**
     * 跳转到积分说明
     */
    @RequestMapping("/integralExplain")
    public String integralExplain(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.INTEGRAL_EXPLAIN.getCode());
        model.addAttribute("html",html);
        return PREFIX + "integralExplain.html";
    }
 
    /**
     * 跳转到佣金规则说明
     */
    @RequestMapping("/commissionRuleExplain")
    public String commissionRuleExplain(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.COMMISSION_RULE_EXPLAIN.getCode());
        model.addAttribute("html",html);
        return PREFIX + "commissionRuleExplain.html";
    }
 
    /**
     * 跳转到行程录音说明
     */
    @RequestMapping("/tripRecordingExplain")
    public String tripRecordingExplain(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.TRIP_RECORDING_EXPLAIN.getCode());
        model.addAttribute("html",html);
        return PREFIX + "tripRecordingExplain.html";
    }
 
    /**
     * 跳转到预估价格说明
     */
    @RequestMapping("/estimatedPriceExplain")
    public String estimatedPriceExplain(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.ESTIMATED_PRICE_EXPLAIN.getCode());
        model.addAttribute("html",html);
        return PREFIX + "estimatedPriceExplain.html";
    }
 
    /**
     * 跳转到起步价说明
     */
    @RequestMapping("/startingFareExplain")
    public String startingFareExplain(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.SPECIFICATION_STARTING_PRICE.getCode());
        model.addAttribute("html",html);
        return PREFIX + "estimatedPriceExplain.html";
    }
 
    /**
     * 跳转到注销协议
     */
    @RequestMapping("/cancellationAgreement")
    public String cancellationAgreement(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.CANCELLATION_AGREEMENT.getCode());
        model.addAttribute("html",html);
        return PREFIX + "cancellationAgreement.html";
    }
 
    /**
     * 跳转到关于我们
     */
    @RequestMapping("/aboutUs")
    public String aboutUs(Model model) {
        THtml html = queryHtmlByType(HtmlTypeEnum.ABOUT_US.getCode());
        model.addAttribute("html",html);
        return PREFIX + "aboutUs.html";
    }
 
    /**
     * 获取列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return tHtmlService.selectList(null);
    }
 
    /**
     * 通过类型查询配置
     */
    @RequestMapping(value = "/queryHtmlByType")
    @ResponseBody
    public THtml queryHtmlByType(Integer type) {
        return tHtmlService.selectOne(new EntityWrapper<THtml>().eq("type", type).last("LIMIT 1"));
    }
 
    /**
     * 新增
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(THtml tHtml) {
        tHtmlService.insert(tHtml);
        return SUCCESS_TIP;
    }
 
    /**
     * 删除
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer tHtmlId) {
        tHtmlService.deleteById(tHtmlId);
        return SUCCESS_TIP;
    }
 
    /**
     * 修改
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(THtml tHtml) {
        tHtml.setHtml(LabelReplaceUtil.replace(tHtml.getHtml()));
        tHtmlService.updateById(tHtml);
        return SUCCESS_TIP;
    }
 
    /**
     * 详情
     */
    @RequestMapping(value = "/detail/{tHtmlId}")
    @ResponseBody
    public Object detail(@PathVariable("tHtmlId") Integer tHtmlId) {
        return tHtmlService.selectById(tHtmlId);
    }
}