package com.stylefeng.guns.modular.system.controller.general;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
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.TSystemConfig;
|
import com.stylefeng.guns.modular.system.service.ITSystemConfigService;
|
|
/**
|
* 控制器
|
*
|
* @author fengshuonan
|
* @Date 2023-03-02 17:09:55
|
*/
|
@Controller
|
@RequestMapping("/tSystemConfig")
|
public class TSystemConfigController extends BaseController {
|
|
private String PREFIX = "/system/tSystemConfig/";
|
|
@Autowired
|
private ITSystemConfigService tSystemConfigService;
|
|
/**
|
* 跳转到首页
|
*/
|
@RequestMapping("")
|
public String index() {
|
return PREFIX + "tSystemConfig.html";
|
}
|
|
/**
|
* 跳转到添加
|
*/
|
@RequestMapping("/tSystemConfig_add")
|
public String tSystemConfigAdd() {
|
return PREFIX + "tSystemConfig_add.html";
|
}
|
|
/**
|
* 跳转到修改
|
*/
|
@RequestMapping("/tSystemConfig_update/{tSystemConfigId}")
|
public String tSystemConfigUpdate(@PathVariable Integer tSystemConfigId, Model model) {
|
TSystemConfig tSystemConfig = tSystemConfigService.selectById(tSystemConfigId);
|
model.addAttribute("item",tSystemConfig);
|
LogObjectHolder.me().set(tSystemConfig);
|
return PREFIX + "tSystemConfig_edit.html";
|
}
|
|
/**
|
* 跳转到派单规则
|
*/
|
@RequestMapping("/dispatchRules")
|
public String dispatchRules(Model model) {
|
TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 1)
|
.last("LIMIT 1"));
|
JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent());
|
model.addAttribute("num1",jsonObject.getInteger("num1"));
|
model.addAttribute("num2",jsonObject.getInteger("num2"));
|
model.addAttribute("num3",jsonObject.getInteger("num3"));
|
model.addAttribute("num4",jsonObject.getInteger("num4"));
|
model.addAttribute("num5",jsonObject.getInteger("num5"));
|
return PREFIX + "tSystemConfigDispatchRules.html";
|
}
|
|
/**
|
* 跳转到佣金分成规则
|
*/
|
@RequestMapping("/commissionShareRules")
|
public String commissionShareRules(Model model) {
|
TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 2)
|
.last("LIMIT 1"));
|
JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent());
|
model.addAttribute("num1",jsonObject.getInteger("num1"));
|
model.addAttribute("num2",jsonObject.getInteger("num2"));
|
model.addAttribute("num3",jsonObject.getInteger("num3"));
|
model.addAttribute("num4",jsonObject.getInteger("num4"));
|
model.addAttribute("num5",jsonObject.getInteger("num5"));
|
model.addAttribute("num6",jsonObject.getInteger("num6"));
|
model.addAttribute("num7",jsonObject.getInteger("num7"));
|
return PREFIX + "tSystemConfigCommissionShareRules.html";
|
}
|
|
/**
|
* 获取列表
|
*/
|
@RequestMapping(value = "/systemConfigSubmit")
|
@ResponseBody
|
public Object systemConfigSubmit(Integer type,String content) {
|
|
TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", type)
|
.last("LIMIT 1"));
|
|
tSystemConfig.setContent(content);
|
|
return tSystemConfigService.updateById(tSystemConfig);
|
}
|
/**
|
* 获取列表
|
*/
|
@RequestMapping(value = "/list")
|
@ResponseBody
|
public Object list(String condition) {
|
return tSystemConfigService.selectList(null);
|
}
|
|
/**
|
* 新增
|
*/
|
@RequestMapping(value = "/add")
|
@ResponseBody
|
public Object add(TSystemConfig tSystemConfig) {
|
tSystemConfigService.insert(tSystemConfig);
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 删除
|
*/
|
@RequestMapping(value = "/delete")
|
@ResponseBody
|
public Object delete(@RequestParam Integer tSystemConfigId) {
|
tSystemConfigService.deleteById(tSystemConfigId);
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 修改
|
*/
|
@RequestMapping(value = "/update")
|
@ResponseBody
|
public Object update(TSystemConfig tSystemConfig) {
|
tSystemConfigService.updateById(tSystemConfig);
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 详情
|
*/
|
@RequestMapping(value = "/detail/{tSystemConfigId}")
|
@ResponseBody
|
public Object detail(@PathVariable("tSystemConfigId") Integer tSystemConfigId) {
|
return tSystemConfigService.selectById(tSystemConfigId);
|
}
|
}
|