| | |
| | | package com.gkhy.system.controller; |
| | | package com.gkhy.web.controller.system; |
| | | |
| | | 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.annotation.Anonymous; |
| | | import com.gkhy.common.annotation.RepeatSubmit; |
| | | 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.domain.R; |
| | | import com.gkhy.common.core.page.TableDataInfo; |
| | | import com.gkhy.system.domain.ApplyRecord; |
| | | import com.gkhy.system.service.ISysSettingsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统配置Controller |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/settings") |
| | | @Api(tags = "专家申请系统设置-前端控制器") |
| | | public class SysSettingsController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysSettingsService sysSettingsService; |
| | | |
| | | /** |
| | | * 查询系统配置列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:settings:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysSettings sysSettings) |
| | | { |
| | | startPage(); |
| | | List<SysSettings> 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<SysSettings> list = sysSettingsService.selectSysSettingsList(sysSettings); |
| | | ExcelUtil<SysSettings> util = new ExcelUtil<SysSettings>(SysSettings.class); |
| | | util.exportExcel(response, list, "系统配置数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取系统配置详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:settings:query')") |
| | | @GetMapping(value = "/{state}") |
| | | public AjaxResult getInfo(@PathVariable("state") String state) |
| | | @GetMapping(value = "/getSettings") |
| | | @RepeatSubmit |
| | | @ApiOperation(value = "获取是否开启1开启2关闭") |
| | | @Anonymous |
| | | public R<String> getSettings() |
| | | { |
| | | 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)); |
| | | return R.ok(sysSettingsService.selectSysSettings()); |
| | | } |
| | | |
| | | /** |
| | | * 修改系统配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:settings:edit')") |
| | | @Log(title = "系统配置", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysSettings sysSettings) |
| | | @GetMapping("/updateSettings") |
| | | @RepeatSubmit |
| | | @ApiOperation(value = "专家申请系统设置开关") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "sysSettings", dataType = "String", required = false, value = "1开启2关闭") |
| | | }) |
| | | public AjaxResult updateSettings(String 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)); |
| | | @PreAuthorize("@ss.hasPermi('system:record:list')") |
| | | @GetMapping("/applyList") |
| | | @ApiOperation(value = "专家申请系统设置记录") |
| | | public TableDataInfo applyList() { |
| | | startPage(); |
| | | List<ApplyRecord> list = sysSettingsService.selectApplyRecordList(); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | } |