package com.se.system.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; 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.se.common.log.annotation.Log; import com.se.common.log.enums.BusinessType; import com.se.common.security.annotation.RequiresPermissions; import com.se.system.domain.SysRes; import com.se.system.service.inte.ISysResService; import com.se.common.core.web.controller.BaseController; import com.se.common.core.web.domain.AjaxResult; import com.se.common.core.utils.poi.ExcelUtil; import com.se.common.core.web.page.TableDataInfo; /** * 资源Controller * * @author se * @date 2024-11-22 */ @RestController @RequestMapping("/res") public class SysResController extends BaseController { @Autowired private ISysResService sysResService; /** * 查询资源列表 */ @RequiresPermissions("system:res:list") @GetMapping("/list") public TableDataInfo list(SysRes sysRes) { startPage(); List list = sysResService.selectSysResList(sysRes); return getDataTable(list); } /** * 导出资源列表 */ @RequiresPermissions("system:res:export") @Log(title = "资源", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SysRes sysRes) { List list = sysResService.selectSysResList(sysRes); ExcelUtil util = new ExcelUtil(SysRes.class); util.exportExcel(response, list, "资源数据"); } /** * 获取资源详细信息 */ @RequiresPermissions("system:res:query") @GetMapping(value = "/{resId}") public AjaxResult getInfo(@PathVariable("resId") Long resId) { return success(sysResService.selectSysResByResId(resId)); } /** * 新增资源 */ @RequiresPermissions("system:res:add") @Log(title = "资源", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysRes sysRes) { return toAjax(sysResService.insertSysRes(sysRes)); } /** * 修改资源 */ @RequiresPermissions("system:res:edit") @Log(title = "资源", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysRes sysRes) { return toAjax(sysResService.updateSysRes(sysRes)); } /** * 删除资源 */ @RequiresPermissions("system:res:remove") @Log(title = "资源", businessType = BusinessType.DELETE) @DeleteMapping("/{resIds}") public AjaxResult remove(@PathVariable Long[] resIds) { return toAjax(sysResService.deleteSysResByResIds(resIds)); } }