package com.smartor.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.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.smartor.domain.SvyCategory; import com.smartor.service.ISvyCategoryService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 问卷分类Controller * * @author ruoyi * @date 2023-03-02 */ @RestController @RequestMapping("/smartor/svycategory") public class SvyCategoryController extends BaseController { @Autowired private ISvyCategoryService svyCategoryService; /** * 查询问卷分类列表 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:list')") @GetMapping("/list") public TableDataInfo list(SvyCategory svyCategory) { startPage(); List list = svyCategoryService.selectSvyCategoryList(svyCategory); return getDataTable(list); } /** * 导出问卷分类列表 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:export')") @Log(title = "问卷分类", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SvyCategory svyCategory) { List list = svyCategoryService.selectSvyCategoryList(svyCategory); ExcelUtil util = new ExcelUtil(SvyCategory.class); util.exportExcel(response, list, "问卷分类数据"); } /** * 获取问卷分类详细信息 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(svyCategoryService.selectSvyCategoryById(id)); } /** * 新增问卷分类 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:add')") @Log(title = "问卷分类", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SvyCategory svyCategory) { return toAjax(svyCategoryService.insertSvyCategory(svyCategory)); } /** * 修改问卷分类 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:edit')") @Log(title = "问卷分类", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SvyCategory svyCategory) { return toAjax(svyCategoryService.updateSvyCategory(svyCategory)); } /** * 删除问卷分类 */ @PreAuthorize("@ss.hasPermi('smartor:svycategory:remove')") @Log(title = "问卷分类", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(svyCategoryService.deleteSvyCategoryByIds(ids)); } }