123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package com.fs.company.controller;
- import java.util.List;
- 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.fs.common.annotation.Log;
- import com.fs.common.core.controller.BaseController;
- import com.fs.common.core.domain.AjaxResult;
- import com.fs.common.enums.BusinessType;
- import com.fs.company.domain.CompanyRoleMenu;
- import com.fs.company.service.ICompanyRoleMenuService;
- import com.fs.common.utils.poi.ExcelUtil;
- import com.fs.common.core.page.TableDataInfo;
- /**
- * 角色和菜单关联Controller
- *
- * @author fs
- * @date 2021-10-04
- */
- @RestController
- @RequestMapping("/company/companyRoleMenu")
- public class CompanyRoleMenuController extends BaseController
- {
- @Autowired
- private ICompanyRoleMenuService companyRoleMenuService;
- /**
- * 查询角色和菜单关联列表
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:list')")
- @GetMapping("/list")
- public TableDataInfo list(CompanyRoleMenu companyRoleMenu)
- {
- startPage();
- List<CompanyRoleMenu> list = companyRoleMenuService.selectCompanyRoleMenuList(companyRoleMenu);
- return getDataTable(list);
- }
- /**
- * 导出角色和菜单关联列表
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:export')")
- @Log(title = "角色和菜单关联", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(CompanyRoleMenu companyRoleMenu)
- {
- List<CompanyRoleMenu> list = companyRoleMenuService.selectCompanyRoleMenuList(companyRoleMenu);
- ExcelUtil<CompanyRoleMenu> util = new ExcelUtil<CompanyRoleMenu>(CompanyRoleMenu.class);
- return util.exportExcel(list, "companyRoleMenu");
- }
- /**
- * 获取角色和菜单关联详细信息
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:query')")
- @GetMapping(value = "/{roleId}")
- public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
- {
- return AjaxResult.success(companyRoleMenuService.selectCompanyRoleMenuById(roleId));
- }
- /**
- * 新增角色和菜单关联
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:add')")
- @Log(title = "角色和菜单关联", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody CompanyRoleMenu companyRoleMenu)
- {
- return toAjax(companyRoleMenuService.insertCompanyRoleMenu(companyRoleMenu));
- }
- /**
- * 修改角色和菜单关联
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:edit')")
- @Log(title = "角色和菜单关联", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody CompanyRoleMenu companyRoleMenu)
- {
- return toAjax(companyRoleMenuService.updateCompanyRoleMenu(companyRoleMenu));
- }
- /**
- * 删除角色和菜单关联
- */
- @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:remove')")
- @Log(title = "角色和菜单关联", businessType = BusinessType.DELETE)
- @DeleteMapping("/{roleIds}")
- public AjaxResult remove(@PathVariable Long[] roleIds)
- {
- return toAjax(companyRoleMenuService.deleteCompanyRoleMenuByIds(roleIds));
- }
- }
|