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.SchemeCategory; import com.smartor.service.ISchemeCategoryService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 方案分类Controller * * @author smartor * @date 2023-03-04 */ @RestController @RequestMapping("/smartor/schemecategory") public class SchemeCategoryController extends BaseController { @Autowired private ISchemeCategoryService schemeCategoryService; /** * 查询方案分类列表 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:list')") @PostMapping("/list") public TableDataInfo list(@RequestBody SchemeCategory schemeCategory) { startPage(); List list = schemeCategoryService.selectSchemeCategoryList(schemeCategory); return getDataTable(list); } /** * 导出方案分类列表 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:export')") @Log(title = "方案分类", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SchemeCategory schemeCategory) { List list = schemeCategoryService.selectSchemeCategoryList(schemeCategory); ExcelUtil util = new ExcelUtil(SchemeCategory.class); util.exportExcel(response, list, "方案分类数据"); } /** * 获取方案分类详细信息 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(schemeCategoryService.selectSchemeCategoryById(id)); } /** * 新增方案分类 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:add')") @Log(title = "方案分类", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult add(@RequestBody SchemeCategory schemeCategory) { return toAjax(schemeCategoryService.insertSchemeCategory(schemeCategory)); } /** * 修改方案分类 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:edit')") @Log(title = "方案分类", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody SchemeCategory schemeCategory) { return toAjax(schemeCategoryService.updateSchemeCategory(schemeCategory)); } /** * 删除方案分类 */ //@PreAuthorize("@ss.hasPermi('smartor:schemecategory:remove')") @Log(title = "方案分类", businessType = BusinessType.DELETE) @GetMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(schemeCategoryService.deleteSchemeCategoryByIds(ids)); } }