package com.boman.system.controller; import java.util.List; import java.io.IOException; import javax.servlet.http.HttpServletResponse; import com.boman.common.core.utils.poi.ExcelUtil; import com.boman.common.core.web.controller.BaseController; import com.boman.domain.dto.AjaxResult; import com.boman.domain.TableDataInfo; import com.boman.common.log.annotation.Log; import com.boman.common.log.enums.BusinessType; import com.boman.common.security.annotation.PreAuthorize; import com.boman.system.service.ISysRoleDataService; 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.boman.domain.SysRoleData; /** * 角色权限数据Controller * * @author ruoyi * @date 2021-04-26 */ @RestController @RequestMapping("/roleData") public class SysRoleDataController extends BaseController { @Autowired private ISysRoleDataService sysRoleDataService; /** * 查询角色权限数据列表 */ //@PreAuthorize(hasPermi = "system:data:list") @GetMapping("/list") public TableDataInfo list(SysRoleData roleData) { startPage(); List list = sysRoleDataService.selectSysRoleDataList(roleData); return getDataTable(list); } /** * 导出角色权限数据列表 */ @PreAuthorize(hasPermi = "system:data:export") @Log(title = "角色权限数据", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SysRoleData sysRoleData) throws IOException { List list = sysRoleDataService.selectSysRoleDataList(sysRoleData); ExcelUtil util = new ExcelUtil(SysRoleData.class); util.exportExcel(response, list, "data"); } /** * 获取角色权限数据详细信息 */ @PreAuthorize(hasPermi = "system:data:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(sysRoleDataService.selectSysRoleDataById(id)); } /** * 获取角色权限数据详细信息 */ @PostMapping(value = "/listByRoleIdList") public List listByRoleIdList(@RequestBody List idList) { return sysRoleDataService.listByRoleIdList(idList); } /** * 功能描述: 根据roleIds和tableName查找 * * @param roleIds 逗号相隔的roleIdS * @param tableName tableName * @return java.util.List */ @GetMapping(value = "/list/roleIds/{roleIds}/tableName/{tableName}") public List listByRoleIdListTableName(@PathVariable("roleIds") String roleIds, @PathVariable("tableName") String tableName) { return sysRoleDataService.listByRoleIdListTableName(roleIds, tableName); } /** * 新增角色权限数据 */ @PreAuthorize(hasPermi = "system:data:add") @Log(title = "角色权限数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysRoleData sysRoleData) { return toAjax(sysRoleDataService.insertSysRoleData(sysRoleData)); } /** * 修改角色权限数据 */ @PreAuthorize(hasPermi = "system:data:edit") @Log(title = "角色权限数据", businessType = BusinessType.UPDATE) @PostMapping("/put") public AjaxResult edit(@RequestBody SysRoleData sysRoleData) { return toAjax(sysRoleDataService.updateSysRoleData(sysRoleData)); } /** * 删除角色权限数据 */ @PreAuthorize(hasPermi = "system:data:remove") @Log(title = "角色权限数据", businessType = BusinessType.DELETE) @GetMapping(value = "/delete/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(sysRoleDataService.deleteSysRoleDataByIds(ids)); } }