package com.gkhy.system.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.gkhy.common.annotation.Log; import com.gkhy.common.core.controller.BaseController; import com.gkhy.common.core.domain.AjaxResult; import com.gkhy.common.enums.BusinessType; import com.gkhy.system.domain.SysSettings; import com.gkhy.system.service.ISysSettingsService; import com.gkhy.common.utils.poi.ExcelUtil; import com.gkhy.common.core.page.TableDataInfo; /** * 系统配置Controller * * @author expert * @date 2024-11-13 */ @RestController @RequestMapping("/system/settings") public class SysSettingsController extends BaseController { @Autowired private ISysSettingsService sysSettingsService; /** * 查询系统配置列表 */ @PreAuthorize("@ss.hasPermi('system:settings:list')") @GetMapping("/list") public TableDataInfo list(SysSettings sysSettings) { startPage(); List list = sysSettingsService.selectSysSettingsList(sysSettings); return getDataTable(list); } /** * 导出系统配置列表 */ @PreAuthorize("@ss.hasPermi('system:settings:export')") @Log(title = "系统配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SysSettings sysSettings) { List list = sysSettingsService.selectSysSettingsList(sysSettings); ExcelUtil util = new ExcelUtil(SysSettings.class); util.exportExcel(response, list, "系统配置数据"); } /** * 获取系统配置详细信息 */ @PreAuthorize("@ss.hasPermi('system:settings:query')") @GetMapping(value = "/{state}") public AjaxResult getInfo(@PathVariable("state") String state) { return success(sysSettingsService.selectSysSettingsByState(state)); } /** * 新增系统配置 */ @PreAuthorize("@ss.hasPermi('system:settings:add')") @Log(title = "系统配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysSettings sysSettings) { return toAjax(sysSettingsService.insertSysSettings(sysSettings)); } /** * 修改系统配置 */ @PreAuthorize("@ss.hasPermi('system:settings:edit')") @Log(title = "系统配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysSettings sysSettings) { return toAjax(sysSettingsService.updateSysSettings(sysSettings)); } /** * 删除系统配置 */ @PreAuthorize("@ss.hasPermi('system:settings:remove')") @Log(title = "系统配置", businessType = BusinessType.DELETE) @DeleteMapping("/{states}") public AjaxResult remove(@PathVariable String[] states) { return toAjax(sysSettingsService.deleteSysSettingsByStates(states)); } }