package com.ruoyi.controller; import java.util.List; import javax.annotation.Resource; 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.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.cs.domain.CsSetTemplate; import com.ruoyi.cs.service.ICsSetTemplateService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 模版设置Controller * * @author ruoyi * @date 2024-06-21 */ @RestController @RequestMapping("/cs/csSetTemplate") public class CsSetTemplateController extends BaseController { @Resource private ICsSetTemplateService csSetTemplateService; /** * 查询模版设置列表 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:list')") @GetMapping("/list") public TableDataInfo list(CsSetTemplate csSetTemplate) { startPage(); csSetTemplate.setDelFlag("0"); List list = csSetTemplateService.selectCsSetTemplateList(csSetTemplate); return getDataTable(list); } /** * 导出模版设置列表 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:export')") @Log(title = "模版设置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CsSetTemplate csSetTemplate) { List list = csSetTemplateService.selectCsSetTemplateList(csSetTemplate); ExcelUtil util = new ExcelUtil(CsSetTemplate.class); util.exportExcel(response, list, "模版设置数据"); } /** * 获取模版设置详细信息 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:query')") @GetMapping(value = "/{templateId}") public AjaxResult getInfo(@PathVariable("templateId") String templateId) { return AjaxResult.success(csSetTemplateService.selectCsSetTemplateByTemplateId(templateId)); } /** * 新增模版设置 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:add')") @Log(title = "模版设置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CsSetTemplate csSetTemplate) { return toAjax(csSetTemplateService.insertCsSetTemplate(csSetTemplate)); } /** * 修改模版设置 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:edit')") @Log(title = "模版设置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CsSetTemplate csSetTemplate) { return toAjax(csSetTemplateService.updateCsSetTemplate(csSetTemplate)); } /** * 删除模版设置 */ @PreAuthorize("@ss.hasPermi('cs:csSetTemplate:remove')") @Log(title = "模版设置", businessType = BusinessType.DELETE) @DeleteMapping("/{templateIds}") public AjaxResult remove(@PathVariable String[] templateIds) { return toAjax(csSetTemplateService.deleteCsSetTemplateByTemplateIds(templateIds)); } /** * 通过表单值获取模版设置详细信息 */ @GetMapping(value = "/getInfoByFormValue") public AjaxResult getInfoByFormValue(CsSetTemplate csSetTemplate) { return AjaxResult.success(csSetTemplateService.getInfoByFormValue(csSetTemplate.getFormValue())); } }