package com.javaweb.geo.controller; import java.util.List; import com.javaweb.geotdp.domain.ResponseResult; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.javaweb.common.annotation.Log; import com.javaweb.common.enums.BusinessType; import com.javaweb.geo.domain.ExceptionConfig; import com.javaweb.geo.service.IExceptionConfigService; import com.javaweb.common.core.controller.BaseController; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.poi.ExcelUtil; import com.javaweb.common.core.page.TableDataInfo; /** * 异常配置Controller * * @author cxy * @date 2022-11-14 */ @Controller @RequestMapping("/geo/config") public class ExceptionConfigController extends BaseController { private String prefix = "geo/config"; @Autowired private IExceptionConfigService exceptionConfigService; @RequiresPermissions("geo:config:view") @GetMapping() public String config() { return prefix + "/config"; } /** * 查询异常配置列表 */ @RequiresPermissions("geo:config:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(ExceptionConfig exceptionConfig) { startPage(); List list = exceptionConfigService.selectExceptionConfigList(exceptionConfig); return getDataTable(list); } /** * 导出异常配置列表 */ @RequiresPermissions("geo:config:export") @Log(title = "异常配置", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(ExceptionConfig exceptionConfig) { List list = exceptionConfigService.selectExceptionConfigList(exceptionConfig); ExcelUtil util = new ExcelUtil(ExceptionConfig.class); return util.exportExcel(list, "config"); } /** * 新增异常配置 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存异常配置 */ @RequiresPermissions("geo:config:add") @Log(title = "异常配置", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(ExceptionConfig exceptionConfig) { return exceptionConfigService.insertExceptionConfig(exceptionConfig); } /** * 修改异常配置 */ @GetMapping("/edit/{ids}") public String edit(@PathVariable("ids") Long ids, ModelMap mmap) { ExceptionConfig exceptionConfig = exceptionConfigService.selectExceptionConfigById(ids); mmap.put("exceptionConfig", exceptionConfig); return prefix + "/edit"; } /** * 修改保存异常配置 */ @RequiresPermissions("geo:config:edit") @Log(title = "异常配置", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(ExceptionConfig exceptionConfig) { return toAjax(exceptionConfigService.updateExceptionConfig(exceptionConfig)); } /** * 删除异常配置 */ @RequiresPermissions("geo:config:remove") @Log(title = "异常配置", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(exceptionConfigService.deleteExceptionConfigByIds(ids)); } /** * 查询异常配置 */ @GetMapping( "/configInfo") @ResponseBody public ResponseResult configInfo() { return exceptionConfigService.configInfo(); } }