123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package edu.travel.tenant.web;
- import edu.travel.interfaces.InsertGroups;
- import edu.travel.resp.BaseResponse;
- import edu.travel.tenant.entity.EduTenant;
- import edu.travel.tenant.entity.SysRole;
- import edu.travel.tenant.service.ISysRoleService;
- import edu.travel.web.BaseController;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.security.core.context.SecurityContextHolder;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * SysRoleController 类。
- * <p>
- * 描述:
- *
- * @author huangwenwen
- * @date 2025/2/6
- */
- @RestController
- @RequestMapping("/sysRole")
- public class SysRoleController extends BaseController<SysRole> {
- @Autowired
- private ISysRoleService sysRoleService;
- /**
- * 新增管理角色
- */
- @PostMapping("/add")
- @Transactional
- // @PreAuthorize("hasAuthority = '超级管理员'")
- public BaseResponse<Boolean> add(@Validated(InsertGroups.class) @RequestBody SysRole sysRole) {
- EduTenant principal = (EduTenant) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- sysRoleService.add(sysRole,principal);
- return new BaseResponse<>(200,"success",true) ;
- }
- /**
- * 删除角色
- */
- @PostMapping("/delete")
- public BaseResponse<Boolean> delete(@RequestBody String ids) {
- // sysRoleService.deleteByIds(ids);
- return new BaseResponse<>(200,"success",true) ;
- }
- }
|