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.HeLocallibrary; import com.smartor.service.IHeLocallibraryService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 宣教库Controller * * @author smartor * @date 2023-03-04 */ @RestController @RequestMapping("/smartor/helibrary") public class HeLocallibraryController extends BaseController { @Autowired private IHeLocallibraryService heLocallibraryService; /** * 查询宣教库列表 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:list')") @GetMapping("/list") public TableDataInfo list(HeLocallibrary heLocallibrary) { startPage(); List list = heLocallibraryService.selectHeLocallibraryList(heLocallibrary); return getDataTable(list); } /** * 导出宣教库列表 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:export')") @Log(title = "宣教库", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HeLocallibrary heLocallibrary) { List list = heLocallibraryService.selectHeLocallibraryList(heLocallibrary); ExcelUtil util = new ExcelUtil(HeLocallibrary.class); util.exportExcel(response, list, "宣教库数据"); } /** * 获取宣教库详细信息 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(heLocallibraryService.selectHeLocallibraryById(id)); } /** * 新增宣教库 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:add')") @Log(title = "宣教库", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HeLocallibrary heLocallibrary) { return toAjax(heLocallibraryService.insertHeLocallibrary(heLocallibrary)); } /** * 修改宣教库 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:edit')") @Log(title = "宣教库", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HeLocallibrary heLocallibrary) { return toAjax(heLocallibraryService.updateHeLocallibrary(heLocallibrary)); } /** * 删除宣教库 */ @PreAuthorize("@ss.hasPermi('smartor:helibrary:remove')") @Log(title = "宣教库", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(heLocallibraryService.deleteHeLocallibraryByIds(ids)); } }