SysUserRoleRelationService.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. package com.jtzx.crm.module.sys.service;
  2. import cc.uncarbon.framework.core.context.UserContextHolder;
  3. import cc.uncarbon.framework.core.exception.BusinessException;
  4. import cc.uncarbon.framework.core.page.PageResult;
  5. import cc.uncarbon.framework.crud.entity.HelioBaseEntity;
  6. import cn.hutool.core.collection.CollUtil;
  7. import cn.hutool.core.util.StrUtil;
  8. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  9. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  10. import com.google.common.collect.Lists;
  11. import com.jtzx.crm.config.AsyncVThreadConfiguration;
  12. import com.jtzx.crm.module.api.util.CrmAdminStpUtil;
  13. import com.jtzx.crm.module.sys.entity.SysGroupEntity;
  14. import com.jtzx.crm.module.sys.entity.SysRoleEntity;
  15. import com.jtzx.crm.module.sys.entity.SysUserEntity;
  16. import com.jtzx.crm.module.sys.entity.SysUserRoleRelationEntity;
  17. import com.jtzx.crm.module.sys.mapper.SysGroupMapper;
  18. import com.jtzx.crm.module.sys.mapper.SysRoleMapper;
  19. import com.jtzx.crm.module.sys.mapper.SysUserMapper;
  20. import com.jtzx.crm.module.sys.mapper.SysUserRoleRelationMapper;
  21. import com.jtzx.crm.module.sys.model.request.UserRoleRelationDTO;
  22. import com.jtzx.crm.module.sys.model.request.UserRoleRelationInsertDTO;
  23. import com.jtzx.crm.module.sys.model.response.*;
  24. import lombok.RequiredArgsConstructor;
  25. import lombok.extern.slf4j.Slf4j;
  26. import org.springframework.stereotype.Service;
  27. import org.springframework.transaction.annotation.Transactional;
  28. import java.util.Comparator;
  29. import java.util.HashSet;
  30. import java.util.List;
  31. /**
  32. * 后台用户-角色关联
  33. */
  34. @RequiredArgsConstructor
  35. @Service
  36. @Slf4j
  37. public class SysUserRoleRelationService {
  38. private final SysUserRoleRelationMapper sysUserRoleRelationMapper;
  39. private final SysRoleMapper sysRoleMapper;
  40. private final SysUserMapper sysUserMapper;
  41. private final SysGroupMapper sysGroupMapper;
  42. private final AsyncVThreadConfiguration asyncVThreadConfiguration;
  43. /**
  44. * 更新用户redis中的角色信息
  45. *
  46. * @param userId
  47. */
  48. @Transactional(rollbackFor = Exception.class)
  49. public void updateUserRole(Long userId) {
  50. List<String> roleValueLists = Lists.newArrayList();
  51. List<Long> roleIdList = Lists.newArrayList();
  52. List<SysUserRoleRelationEntity> roleRelationEntityList =
  53. sysUserRoleRelationMapper.selectList(
  54. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  55. .select(
  56. SysUserRoleRelationEntity::getRoleValue,
  57. SysUserRoleRelationEntity::getRoleId
  58. )
  59. .eq(SysUserRoleRelationEntity::getUserId, userId)
  60. );
  61. if (CollUtil.isNotEmpty(roleRelationEntityList)) {
  62. roleValueLists.addAll(
  63. roleRelationEntityList.stream()
  64. .map(SysUserRoleRelationEntity::getRoleValue)
  65. .toList());
  66. roleIdList.addAll(
  67. roleRelationEntityList.stream()
  68. .map(SysUserRoleRelationEntity::getRoleId)
  69. .toList());
  70. }
  71. UserContextHolder.getUserContext().setRoles(roleValueLists.stream().distinct().toList());
  72. UserContextHolder.getUserContext().setRolesIds(new HashSet<>(roleIdList));
  73. }
  74. /**
  75. * 查询角色下拉数据列表
  76. *
  77. * @return
  78. */
  79. public List<SysRoleListBO> queryRoleData() {
  80. List<SysRoleEntity> sysRoleEntities = sysRoleMapper.selectList(
  81. new LambdaQueryWrapper<>(SysRoleEntity.class)
  82. .ne(SysRoleEntity::getValue, "Member")
  83. );
  84. List<SysRoleListBO> result = Lists.newArrayList();
  85. sysRoleEntities.stream()
  86. .sorted(Comparator.comparing(SysRoleEntity::getSortCode).reversed())
  87. .forEach(sysRoleEntity -> {
  88. SysRoleListBO bo = SysRoleListBO.builder().build();
  89. bo.setId(sysRoleEntity.getId());
  90. bo.setTitle(sysRoleEntity.getTitle());
  91. result.add(bo);
  92. });
  93. return result;
  94. }
  95. /**
  96. * 分页查询表格数据列表
  97. *
  98. * @param dto
  99. * @return
  100. */
  101. public PageResult<UserRoleRelationPageListBO> queryTableListByPage(UserRoleRelationDTO dto) {
  102. //查询角色数据
  103. List<SysRoleEntity> roleEntityList =
  104. sysRoleMapper.selectList(
  105. new LambdaQueryWrapper<>(SysRoleEntity.class)
  106. .select(
  107. SysRoleEntity::getSortCode,
  108. SysRoleEntity::getId,
  109. SysRoleEntity::getValue,
  110. SysRoleEntity::getTitle
  111. )
  112. .eq(dto.getRoleId() != null, SysRoleEntity::getId, dto.getRoleId())
  113. .ne(SysRoleEntity::getValue, "Member")
  114. );
  115. if (CollUtil.isEmpty(roleEntityList)) {
  116. return new PageResult<UserRoleRelationPageListBO>()
  117. .setCurrent(1)
  118. .setSize(dto.getPageSize())
  119. .setTotal(0)
  120. .setRecords(Lists.newArrayList());
  121. }
  122. //查询分组数据
  123. List<SysGroupEntity> groupEntityList =
  124. sysGroupMapper.selectList(
  125. new LambdaQueryWrapper<>(SysGroupEntity.class)
  126. .select(
  127. SysGroupEntity::getSortCode,
  128. SysGroupEntity::getId,
  129. SysGroupEntity::getTitle
  130. )
  131. .eq(dto.getGroupId() != null, HelioBaseEntity::getId, dto.getGroupId())
  132. );
  133. if (CollUtil.isEmpty(groupEntityList)) {
  134. return new PageResult<UserRoleRelationPageListBO>()
  135. .setCurrent(1)
  136. .setSize(dto.getPageSize())
  137. .setTotal(0)
  138. .setRecords(Lists.newArrayList());
  139. }
  140. //查询用户
  141. List<SysUserEntity> userEntityList =
  142. sysUserMapper.selectList(
  143. new LambdaQueryWrapper<>(SysUserEntity.class)
  144. .select(
  145. SysUserEntity::getUserName,
  146. SysUserEntity::getId,
  147. SysUserEntity::getPin
  148. )
  149. .eq(dto.getUserId() != null, SysUserEntity::getId, dto.getUserId())
  150. .eq(SysUserEntity::getStatus, 1)
  151. .and(StrUtil.isNotEmpty(dto.getQueryStr()), z -> z.like(SysUserEntity::getUserName, dto.getQueryStr())
  152. .or().like(SysUserEntity::getPin, dto.getQueryStr())
  153. )
  154. );
  155. if (CollUtil.isEmpty(userEntityList)) {
  156. return new PageResult<UserRoleRelationPageListBO>()
  157. .setCurrent(1)
  158. .setSize(dto.getPageSize())
  159. .setTotal(0)
  160. .setRecords(Lists.newArrayList());
  161. }
  162. List<Long> userIds =
  163. userEntityList.stream()
  164. .sorted(Comparator.comparing(SysUserEntity::getId))
  165. .map(SysUserEntity::getId)
  166. .toList();
  167. Page<SysUserRoleRelationEntity> entityPage =
  168. sysUserRoleRelationMapper.selectPage(
  169. new Page<>(dto.getPageNum(), dto.getPageSize()),
  170. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  171. .eq(dto.getRoleId() != null, SysUserRoleRelationEntity::getRoleId, dto.getRoleId())
  172. .eq(dto.getGroupId() != null, SysUserRoleRelationEntity::getGroupId, dto.getGroupId())
  173. .eq(dto.getUserId() != null && StrUtil.isEmpty(dto.getQueryStr()), SysUserRoleRelationEntity::getUserId, dto.getUserId())
  174. .in(StrUtil.isNotEmpty(dto.getQueryStr()), SysUserRoleRelationEntity::getUserId, userIds)
  175. .ne(SysUserRoleRelationEntity::getRoleValue, "Member")
  176. .orderByDesc(SysUserRoleRelationEntity::getCreatedAt)
  177. );
  178. if (CollUtil.isEmpty(entityPage.getRecords())) {
  179. return new PageResult<UserRoleRelationPageListBO>()
  180. .setCurrent(1)
  181. .setSize(dto.getPageSize())
  182. .setTotal(0)
  183. .setRecords(Lists.newArrayList());
  184. }
  185. List<UserRoleRelationPageListBO> result = Lists.newArrayList();
  186. entityPage.getRecords().forEach(record -> {
  187. UserRoleRelationPageListBO bo = UserRoleRelationPageListBO.builder().build();
  188. bo.setId(record.getId());
  189. bo.setGroupId(null);
  190. bo.setGroupName("-");
  191. if (record.getGroupId() != null) {
  192. groupEntityList.stream()
  193. .filter(x -> x.getId().equals(record.getGroupId()))
  194. .findFirst()
  195. .ifPresent(group -> {
  196. bo.setGroupId(group.getId());
  197. bo.setGroupName(group.getTitle());
  198. });
  199. }
  200. userEntityList.stream()
  201. .filter(x -> x.getId().equals(record.getUserId()))
  202. .findFirst()
  203. .ifPresent(user -> {
  204. bo.setUserId(user.getId());
  205. bo.setUserName(user.getUserName());
  206. bo.setAccount(user.getPin());
  207. });
  208. roleEntityList.stream()
  209. .filter(x -> x.getId().equals(record.getRoleId()))
  210. .findFirst()
  211. .ifPresent(role -> {
  212. bo.setRoleId(role.getId());
  213. bo.setRoleName(role.getTitle());
  214. });
  215. bo.setDelStatus(0);
  216. result.add(bo);
  217. });
  218. return new PageResult<UserRoleRelationPageListBO>()
  219. .setCurrent(entityPage.getCurrent())
  220. .setSize(entityPage.getSize())
  221. .setTotal(entityPage.getTotal())
  222. .setRecords(result);
  223. }
  224. /**
  225. * 查询用户下拉数据列表
  226. * @return
  227. */
  228. public List<RoleUserBO> queryUserData() {
  229. List<RoleUserBO> result = Lists.newArrayList();
  230. //查询关系数据
  231. List<SysUserRoleRelationEntity> relationEntityList = sysUserRoleRelationMapper.selectList(
  232. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  233. .ne(SysUserRoleRelationEntity::getRoleValue, "Member")
  234. .orderByDesc(SysUserRoleRelationEntity::getCreatedAt)
  235. );
  236. if (CollUtil.isNotEmpty(relationEntityList)) {
  237. List<Long> userIds =
  238. relationEntityList.stream()
  239. .map(SysUserRoleRelationEntity::getUserId)
  240. .distinct().toList();
  241. //查询用户
  242. List<SysUserEntity> sysUserEntityList =
  243. sysUserMapper.selectList(
  244. new LambdaQueryWrapper<>(SysUserEntity.class)
  245. .in(SysUserEntity::getId, userIds)
  246. .eq(SysUserEntity::getStatus, 1)
  247. );
  248. relationEntityList.forEach(record -> {
  249. if (CollUtil.isNotEmpty(sysUserEntityList)) {
  250. sysUserEntityList.stream()
  251. .filter(x -> x.getId().equals(record.getUserId()))
  252. .findFirst()
  253. .ifPresent(user -> {
  254. RoleUserBO bo = RoleUserBO.builder().build();
  255. bo.setId(record.getId());
  256. bo.setUserId(record.getUserId());
  257. bo.setUserName(sysUserMapper.selectById(record.getUserId()).getUserName());
  258. bo.setGroupId(record.getGroupId());
  259. bo.setRoleId(record.getRoleId());
  260. bo.setUserName(user.getUserName());
  261. bo.setAccount(user.getPin());
  262. result.add(bo);
  263. });
  264. }
  265. });
  266. }
  267. return result;
  268. }
  269. /**
  270. * 查询权限表格数据
  271. */
  272. public List<UserRoleRelationBO> queryTableData() {
  273. List<UserRoleRelationBO> userRoleRelationBOList = Lists.newArrayList();
  274. //查询关系数据
  275. List<SysUserRoleRelationEntity> relationEntityList = sysUserRoleRelationMapper.selectList(
  276. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  277. .ne(SysUserRoleRelationEntity::getRoleValue, "Member")
  278. );
  279. //查询角色
  280. List<SysRoleEntity> sysRoleEntities = sysRoleMapper.selectList(
  281. new LambdaQueryWrapper<>(SysRoleEntity.class)
  282. .ne(SysRoleEntity::getValue, "Member")
  283. );
  284. //查询用户
  285. List<SysUserEntity> sysUserEntityList =
  286. sysUserMapper.selectList(
  287. new LambdaQueryWrapper<>(SysUserEntity.class)
  288. .eq(SysUserEntity::getStatus, 1)
  289. );
  290. //查询分组数据
  291. List<SysGroupEntity> groupEntityList = sysGroupMapper.selectList(null);
  292. //数据处理
  293. if (CollUtil.isNotEmpty(sysRoleEntities)) {
  294. sysRoleEntities.stream()
  295. .sorted(Comparator.comparing(SysRoleEntity::getSortCode).reversed())
  296. .forEach(roleEntity -> {
  297. List<SysUserRoleRelationEntity> roleRelationEntityList = Lists.newArrayList();
  298. if (CollUtil.isNotEmpty(relationEntityList)) {
  299. roleRelationEntityList.addAll(
  300. relationEntityList.stream()
  301. .filter(relationEntity -> relationEntity.getRoleId().equals(roleEntity.getId()))
  302. .toList());
  303. }
  304. List<SysUserEntity> sysUserEntities = Lists.newArrayList();
  305. if (CollUtil.isNotEmpty(roleRelationEntityList) && CollUtil.isNotEmpty(sysUserEntityList)) {
  306. List<Long> userIds =
  307. roleRelationEntityList.stream()
  308. .map(SysUserRoleRelationEntity::getUserId)
  309. .distinct().toList();
  310. sysUserEntities.addAll(
  311. sysUserEntityList.stream()
  312. .filter(x -> userIds.contains(x.getId()))
  313. .toList());
  314. }
  315. //处理数据
  316. userRoleRelationBOList.add(
  317. this.handleResultData(roleEntity, groupEntityList, roleRelationEntityList, sysUserEntities));
  318. });
  319. }
  320. return userRoleRelationBOList;
  321. }
  322. /**
  323. * 处理数据
  324. *
  325. * @param roleEntity
  326. * @param groupEntityList
  327. * @param roleRelationEntityList
  328. * @param sysUserEntities
  329. * @return
  330. */
  331. public UserRoleRelationBO handleResultData(SysRoleEntity roleEntity,
  332. List<SysGroupEntity> groupEntityList,
  333. List<SysUserRoleRelationEntity> roleRelationEntityList,
  334. List<SysUserEntity> sysUserEntities) {
  335. UserRoleRelationBO roleRelationBO = UserRoleRelationBO.builder().build();
  336. roleRelationBO.setRoleId(roleEntity.getId());
  337. roleRelationBO.setRoleName(roleEntity.getTitle());
  338. roleRelationBO.setSortCode(roleEntity.getSortCode());
  339. //处理分组数据
  340. List<SysGroupBO> groupData = Lists.newArrayList();
  341. if (roleEntity.getValue().equals("GroupManager")) {
  342. groupEntityList.stream()
  343. .sorted(Comparator.comparing(SysGroupEntity::getSortCode))
  344. .forEach(groupEntity -> {
  345. SysGroupBO sysGroupBO = SysGroupBO.builder().build();
  346. sysGroupBO.setId(groupEntity.getId());
  347. sysGroupBO.setTitle(groupEntity.getTitle());
  348. sysGroupBO.setSortCode(groupEntity.getSortCode());
  349. groupData.add(sysGroupBO);
  350. });
  351. }
  352. roleRelationBO.setGroupData(groupData);
  353. //处理用户数据
  354. List<RoleUserBO> userData = Lists.newArrayList();
  355. if (CollUtil.isNotEmpty(roleRelationEntityList)) {
  356. if (CollUtil.isNotEmpty(groupData)) {
  357. groupData.stream()
  358. .sorted(Comparator.comparing(SysGroupBO::getSortCode))
  359. .forEach(sysGroupBO -> {
  360. List<SysUserRoleRelationEntity> userRoleRelationEntities =
  361. roleRelationEntityList.stream()
  362. .filter(x -> x.getGroupId().equals(sysGroupBO.getId()))
  363. .toList();
  364. if (CollUtil.isNotEmpty(userRoleRelationEntities)) {
  365. //处理用户数据
  366. userData.addAll(
  367. this.handleUserData(userRoleRelationEntities, sysUserEntities));
  368. }
  369. });
  370. } else {
  371. //处理用户数据
  372. userData.addAll(
  373. this.handleUserData(roleRelationEntityList, sysUserEntities));
  374. }
  375. }
  376. roleRelationBO.setUserData(userData);
  377. return roleRelationBO;
  378. }
  379. /**
  380. * 处理用户数据
  381. *
  382. * @param roleRelationEntityList
  383. * @param sysUserEntities
  384. * @return
  385. */
  386. public List<RoleUserBO> handleUserData(List<SysUserRoleRelationEntity> roleRelationEntityList,
  387. List<SysUserEntity> sysUserEntities) {
  388. List<RoleUserBO> userData = Lists.newArrayList();
  389. roleRelationEntityList.stream()
  390. .sorted(Comparator.comparing(HelioBaseEntity::getCreatedAt))
  391. .forEach(roleRelation -> {
  392. if (CollUtil.isNotEmpty(sysUserEntities)) {
  393. sysUserEntities.stream()
  394. .filter(x -> x.getId().equals(roleRelation.getUserId()))
  395. .findFirst()
  396. .ifPresent(user -> {
  397. if (CollUtil.isEmpty(userData) || userData.stream().map(RoleUserBO::getUserId).noneMatch(user.getId()::equals)) {
  398. RoleUserBO roleUserBO = RoleUserBO.builder().build();
  399. roleUserBO.setId(roleRelation.getId());
  400. roleUserBO.setUserId(user.getId());
  401. roleUserBO.setUserName(user.getUserName());
  402. roleUserBO.setAccount(user.getPin());
  403. roleUserBO.setGroupId(roleRelation.getGroupId());
  404. userData.add(roleUserBO);
  405. }
  406. });
  407. }
  408. });
  409. return userData;
  410. }
  411. /**
  412. * 后台管理-新增
  413. * 注:本方法较为特殊,仅供SysTenantFacadeImpl调用
  414. */
  415. @Transactional(rollbackFor = Exception.class)
  416. public Long adminInsert(UserRoleRelationInsertDTO dto) {
  417. long count =
  418. sysUserRoleRelationMapper.selectCount(
  419. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  420. .select(SysUserRoleRelationEntity::getUserId)
  421. .eq(SysUserRoleRelationEntity::getRoleId, dto.getRoleId())
  422. .eq(SysUserRoleRelationEntity::getUserId, dto.getUserId())
  423. .eq(dto.getGroupId() != null, SysUserRoleRelationEntity::getGroupId, dto.getGroupId())
  424. );
  425. if (count > 0) {
  426. throw new BusinessException(400, "请勿重复设置");
  427. }
  428. SysRoleEntity sysRoleEntity = sysRoleMapper.selectById(dto.getRoleId());
  429. SysUserRoleRelationEntity entity = new SysUserRoleRelationEntity()
  430. .setUserId(dto.getUserId()).setRoleId(dto.getRoleId()).setGroupId(dto.getGroupId()).setRoleValue(sysRoleEntity.getValue());
  431. sysUserRoleRelationMapper.insert(entity);
  432. CrmAdminStpUtil.kickout(dto.getUserId());
  433. this.updateUserRole(dto.getUserId());
  434. // if (sysRoleEntity.getValue().equals("Admin")) {
  435. // CrmAdminStpUtil.kickout(dto.getUserId());
  436. // }
  437. // else {
  438. // //异步执行更新用户角色问题
  439. // asyncVThreadConfiguration.getAsyncExecutor().execute(() ->
  440. // this.updateUserRole(dto.getUserId()));
  441. // }
  442. return entity.getId();
  443. }
  444. @Transactional(rollbackFor = Exception.class)
  445. public void adminInsertGroupUser(UserRoleRelationInsertDTO dto) {
  446. long count =
  447. sysUserRoleRelationMapper.selectCount(
  448. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  449. .select(SysUserRoleRelationEntity::getUserId)
  450. .eq(SysUserRoleRelationEntity::getRoleId, dto.getRoleId())
  451. .eq(SysUserRoleRelationEntity::getUserId, dto.getUserId())
  452. .eq(dto.getGroupId() != null, SysUserRoleRelationEntity::getGroupId, dto.getGroupId())
  453. );
  454. if (count == 0) {
  455. SysRoleEntity sysRoleEntity = sysRoleMapper.selectById(dto.getRoleId());
  456. SysUserRoleRelationEntity entity = new SysUserRoleRelationEntity()
  457. .setUserId(dto.getUserId()).setRoleId(dto.getRoleId()).setGroupId(dto.getGroupId()).setRoleValue(sysRoleEntity.getValue());
  458. sysUserRoleRelationMapper.insert(entity);
  459. this.updateUserRole(dto.getUserId());
  460. // if (sysRoleEntity.getValue().equals("Admin")) {
  461. // CrmAdminStpUtil.kickout(dto.getUserId());
  462. // } else {
  463. // //异步执行更新用户角色问题
  464. // asyncVThreadConfiguration.getAsyncExecutor().execute(() ->
  465. // this.updateUserRole(dto.getUserId()));
  466. // }
  467. }
  468. }
  469. @Transactional(rollbackFor = Exception.class)
  470. public void delete(Long id) {
  471. SysUserRoleRelationEntity roleRelationEntity = sysUserRoleRelationMapper.selectById(id);
  472. if (roleRelationEntity != null) {
  473. sysUserRoleRelationMapper.deleteById(id);
  474. //如果处理的是管理员,需要重新登陆
  475. CrmAdminStpUtil.kickout(roleRelationEntity.getUserId());
  476. // this.updateUserRole(roleRelationEntity.getUserId());
  477. // if (roleRelationEntity.getRoleValue().equals("Admin")) {
  478. // CrmAdminStpUtil.kickout(roleRelationEntity.getUserId());
  479. // } else {
  480. // //异步执行更新用户角色问题
  481. // asyncVThreadConfiguration.getAsyncExecutor().execute(() ->
  482. // this.updateUserRole(roleRelationEntity.getUserId()));
  483. // }
  484. }
  485. }
  486. @Transactional(rollbackFor = Exception.class)
  487. public void delete(Long userId, Long groupId, String roleValue) {
  488. sysUserRoleRelationMapper.delete(
  489. new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
  490. .eq(SysUserRoleRelationEntity::getUserId, userId)
  491. .eq(SysUserRoleRelationEntity::getGroupId, groupId)
  492. .eq(SysUserRoleRelationEntity::getRoleValue, roleValue)
  493. );
  494. }
  495. }