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