|
@@ -64,7 +64,7 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean gameAuthAdd(GameAuthAddParam param) {
|
|
|
List<Long> userIdList = param.getUserIdList();
|
|
|
- List<Long> gameIdList = param.getGameIdList();
|
|
|
+ List<GameAuthAddParam.GameAuthBean> gameAuthList = param.getGameAuthList();
|
|
|
List<GameAuth> addList = new ArrayList<>();
|
|
|
userIdList.forEach(userId -> {
|
|
|
//判断角色是否正确
|
|
@@ -75,15 +75,15 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
|
|
|
throw new BaseException("参数错误, 提交得用户存在权限不匹配");
|
|
|
}
|
|
|
//循环添加
|
|
|
- gameIdList.forEach(gameId -> {
|
|
|
+ gameAuthList.forEach(gameAuthBean -> {
|
|
|
//判断提交的参数数据是否已经存在
|
|
|
if (super.count(new LambdaQueryWrapper<GameAuth>()
|
|
|
- .eq(GameAuth::getGameId, gameId)
|
|
|
+ .eq(GameAuth::getGameId, gameAuthBean.getGameId())
|
|
|
.eq(GameAuth::getUserId, userId)
|
|
|
) > 0) {
|
|
|
throw new BaseException("参数错误, 提交的用户存在重复权限");
|
|
|
}
|
|
|
- addList.add(this.transform(gameId, userId));
|
|
|
+ addList.add(this.transform(gameAuthBean, userId));
|
|
|
});
|
|
|
});
|
|
|
if (addList.isEmpty()) {
|
|
@@ -92,15 +92,16 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
|
|
|
return super.saveBatch(addList);
|
|
|
}
|
|
|
|
|
|
- private GameAuth transform(Long gameId, Long userId) {
|
|
|
+ private GameAuth transform(GameAuthAddParam.GameAuthBean gameAuthBean, Long userId) {
|
|
|
return GameAuth.builder()
|
|
|
- .gameId(gameId)
|
|
|
+ .gameId(gameAuthBean.getGameId())
|
|
|
.userId(userId)
|
|
|
.isDelete(DeleteEnum.NO.getCode())
|
|
|
.createBy(SecurityUtil.getUserId())
|
|
|
.createTime(LocalDateTime.now())
|
|
|
.updateBy(SecurityUtil.getUserId())
|
|
|
.updateTime(LocalDateTime.now())
|
|
|
+ .defaultAgent(gameAuthBean.getDefaultAgent())
|
|
|
.build();
|
|
|
}
|
|
|
|