ソースを参照

fix : 角色权限

bilingfeng 1 年間 前
コミット
e8d3442c3c
14 ファイル変更483 行追加56 行削除
  1. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java
  2. 39 4
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameAuthController.java
  3. 34 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/enums/GameAuthEnum.java
  4. 15 26
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthAddParam.java
  5. 25 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleAddParam.java
  6. 25 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleListParam.java
  7. 30 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleUpdateParam.java
  8. 52 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameAuthRoleVO.java
  9. 49 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameAuthRoleService.java
  10. 106 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthRoleServiceImpl.java
  11. 27 17
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthServiceImpl.java
  12. 0 8
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuth.java
  13. 68 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuthRole.java
  14. 12 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/mapper/GameAuthRoleMapper.java

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 用户授权接口> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 角色权限> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 39 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameAuthController.java

@@ -2,10 +2,10 @@ package com.zanxiang.game.module.manage.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zanxiang.erp.security.annotation.PreAuthorize;
-import com.zanxiang.game.module.manage.pojo.params.GameAuthAddParam;
-import com.zanxiang.game.module.manage.pojo.params.GameAuthListParam;
-import com.zanxiang.game.module.manage.pojo.params.GameAuthUpdateParam;
+import com.zanxiang.game.module.manage.pojo.params.*;
+import com.zanxiang.game.module.manage.pojo.vo.GameAuthRoleVO;
 import com.zanxiang.game.module.manage.pojo.vo.GameAuthVO;
+import com.zanxiang.game.module.manage.service.IGameAuthRoleService;
 import com.zanxiang.game.module.manage.service.IGameAuthService;
 import com.zanxiang.module.util.pojo.ResultVO;
 import io.swagger.annotations.Api;
@@ -31,6 +31,9 @@ public class GameAuthController {
     @Autowired
     private IGameAuthService gameAuthService;
 
+    @Autowired
+    private IGameAuthRoleService gameAuthRoleService;
+
     @ApiOperation(value = "新增用户授权")
     @PostMapping(value = "/add")
     @PreAuthorize(permissionKey = "manage:gameAuth:add")
@@ -43,7 +46,7 @@ public class GameAuthController {
     @PostMapping(value = "/update")
     @PreAuthorize(permissionKey = "manage:gameAuth:update")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> gameAuthAdd(@Validated @RequestBody GameAuthUpdateParam param) {
+    public ResultVO<Boolean> gameAuthUpdate(@Validated @RequestBody GameAuthUpdateParam param) {
         return ResultVO.ok(gameAuthService.gameAuthUpdate(param));
     }
 
@@ -62,4 +65,36 @@ public class GameAuthController {
     public ResultVO<Boolean> deleteById(@RequestParam Long id) {
         return ResultVO.ok(gameAuthService.deleteById(id));
     }
+
+    @ApiOperation(value = "新增用户角色")
+    @PostMapping(value = "/add/role")
+    @PreAuthorize(permissionKey = "manage:gameAuth:addRole")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> gameAuthRoleAdd(@Validated @RequestBody GameAuthRoleAddParam param) {
+        return ResultVO.ok(gameAuthRoleService.gameAuthRoleAdd(param));
+    }
+
+    @ApiOperation(value = "更新用户角色")
+    @PostMapping(value = "/update/role")
+    @PreAuthorize(permissionKey = "manage:gameAuth:updateRole")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> gameAuthRoleUpdate(@Validated @RequestBody GameAuthRoleUpdateParam param) {
+        return ResultVO.ok(gameAuthRoleService.gameAuthRoleUpdate(param));
+    }
+
+    @ApiOperation(value = "删除用户角色")
+    @DeleteMapping(value = "/delete/role")
+    @PreAuthorize(permissionKey = "manage:gameServer:deleteRole")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> roleDeleteById(@RequestParam Long id) {
+        return ResultVO.ok(gameAuthRoleService.deleteById(id));
+    }
+
+    @ApiOperation(value = "游戏授权用户列表")
+    @PostMapping(value = "/list/role")
+    @PreAuthorize(permissionKey = "manage:gameAuth:listRole")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameAuthRoleVO.class)})
+    public ResultVO<IPage<GameAuthRoleVO>> roleListOfPage(@Validated @RequestBody GameAuthRoleListParam param) {
+        return ResultVO.ok(gameAuthRoleService.listOfPage(param));
+    }
 }

+ 34 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/enums/GameAuthEnum.java

@@ -0,0 +1,34 @@
+package com.zanxiang.game.module.manage.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色枚举
+ */
+@Getter
+@AllArgsConstructor
+public enum GameAuthEnum {
+
+    /**
+     * 运营
+     */
+    PITCHER("PITCHER", "运营"),
+
+    /**
+     * 投手
+     */
+    OPERATE("OPERATE", "投手");
+
+    /**
+     * 角色
+     */
+    private String value;
+
+    /**
+     * 名称
+     */
+    private String name;
+}

+ 15 - 26
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthAddParam.java

@@ -1,9 +1,9 @@
 package com.zanxiang.game.module.manage.pojo.params;
 
+import com.zanxiang.game.module.manage.enums.GameAuthEnum;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import java.util.List;
 
@@ -16,34 +16,23 @@ import java.util.List;
 public class GameAuthAddParam {
 
     /**
-     * 游戏id
+     * 权限类型
      */
-    @NotNull(message = "游戏id不可为空")
-    @ApiModelProperty(notes = "主键id")
-    private Long gameId;
+    @NotNull(message = "权限类型不可为空")
+    @ApiModelProperty(notes = "权限类型, 调接口, 获取权限类型枚举")
+    private GameAuthEnum gameAuthEnum;
 
     /**
-     * 用户列表
+     * 用户id列表
      */
-    @NotEmpty(message = "用户列表不可为空")
-    @ApiModelProperty(notes = "用户列表")
-    private List<GameAuthUserBean> userAuthList;
+    @NotNull(message = "用户id列表不可为空")
+    @ApiModelProperty(notes = "用户id列表, 调接口, 从接口中给的人中选择")
+    private List<Long> userIdList;
 
-    @Data
-    public static class GameAuthUserBean {
-
-        /**
-         * 用户id
-         */
-        @NotNull(message = "用户id不可为空")
-        @ApiModelProperty(notes = "用户id")
-        private Long userId;
-
-        /**
-         * 权限类型, 1 : 投手, 2 : 运营
-         */
-        @NotNull(message = "权限类型不可为空")
-        @ApiModelProperty(notes = "权限类型, 1 : 投手, 2 : 运营")
-        private Integer type;
-    }
+    /**
+     * 游戏id列表
+     */
+    @NotNull(message = "游戏id列表不可为空")
+    @ApiModelProperty(notes = "游戏id列表, 所有游戏下拉选择")
+    private List<Long> gameIdList;
 }

+ 25 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleAddParam.java

@@ -0,0 +1,25 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import com.zanxiang.game.module.manage.enums.GameAuthEnum;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色新增或者修改
+ */
+@Data
+public class GameAuthRoleAddParam {
+
+    /**
+     * 授权类型
+     */
+    private GameAuthEnum authType;
+
+    /**
+     * 用户id列表
+     */
+    private List<Long> userIdList;
+}

+ 25 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleListParam.java

@@ -0,0 +1,25 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import com.zanxiang.game.module.manage.enums.GameAuthEnum;
+import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
+import com.zanxiang.module.web.pojo.BaseListDTO;
+import lombok.Data;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+@Data
+public class GameAuthRoleListParam extends BaseListDTO<GameAuthRole> {
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 授权类型
+     */
+    private GameAuthEnum authType;
+}

+ 30 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthRoleUpdateParam.java

@@ -0,0 +1,30 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import com.zanxiang.game.module.manage.enums.GameAuthEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色更新
+ */
+@Data
+public class GameAuthRoleUpdateParam {
+
+    /**
+     * 主键id
+     */
+    @NotNull(message = "主键id不可为空")
+    @ApiModelProperty(notes = "主键id")
+    private Long id;
+
+    /**
+     * 授权类型
+     */
+    @NotNull(message = "授权类型不可为空")
+    @ApiModelProperty(notes = "授权类型")
+    private GameAuthEnum authType;
+}

+ 52 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameAuthRoleVO.java

@@ -0,0 +1,52 @@
+package com.zanxiang.game.module.manage.pojo.vo;
+
+import com.zanxiang.game.module.manage.enums.GameAuthEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+@Data
+public class GameAuthRoleVO {
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(notes = "主键id")
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(notes = "用户id")
+    private Long userId;
+
+    /**
+     * 用户名称
+     */
+    @ApiModelProperty(notes = "用户名称")
+    private String userName;
+
+    /**
+     * 权限类型
+     */
+    @ApiModelProperty(notes = "权限类型")
+    private GameAuthEnum authType;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(notes = "创建时间")
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(notes = "更新时间")
+    private LocalDateTime updateTime;
+}

+ 49 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameAuthRoleService.java

@@ -0,0 +1,49 @@
+package com.zanxiang.game.module.manage.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleAddParam;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleListParam;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleUpdateParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameAuthRoleVO;
+import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+public interface IGameAuthRoleService extends IService<GameAuthRole> {
+
+    /**
+     * 游戏身份验证角色添加
+     *
+     * @param param 参数
+     * @return boolean
+     */
+    boolean gameAuthRoleAdd(GameAuthRoleAddParam param);
+
+    /**
+     * 游戏更新认证作用
+     *
+     * @param param 参数
+     * @return boolean
+     */
+    boolean gameAuthRoleUpdate(GameAuthRoleUpdateParam param);
+
+    /**
+     * 删除通过id
+     *
+     * @param id id
+     * @return boolean
+     */
+    boolean deleteById(Long id);
+
+    /**
+     * 列表页面
+     *
+     * @param param 参数
+     * @return {@link IPage}<{@link GameAuthRoleVO}>
+     */
+    IPage<GameAuthRoleVO> listOfPage(GameAuthRoleListParam param);
+}

+ 106 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthRoleServiceImpl.java

@@ -0,0 +1,106 @@
+package com.zanxiang.game.module.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.erp.base.ErpServer;
+import com.zanxiang.erp.base.rpc.ISysUserRpc;
+import com.zanxiang.erp.security.util.SecurityUtil;
+import com.zanxiang.game.module.base.pojo.enums.DeleteEnum;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleAddParam;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleListParam;
+import com.zanxiang.game.module.manage.pojo.params.GameAuthRoleUpdateParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameAuthRoleVO;
+import com.zanxiang.game.module.manage.service.IGameAuthRoleService;
+import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
+import com.zanxiang.game.module.mybatis.mapper.GameAuthRoleMapper;
+import com.zanxiang.module.util.bean.BeanUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.*;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+@Slf4j
+@Service
+public class GameAuthRoleServiceImpl extends ServiceImpl<GameAuthRoleMapper, GameAuthRole> implements IGameAuthRoleService {
+
+    @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
+    private ISysUserRpc sysUserRpc;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean gameAuthRoleAdd(GameAuthRoleAddParam param) {
+        //游戏id
+        List<Long> userIdList = param.getUserIdList();
+        List<GameAuthRole> addList = new ArrayList<>();
+        userIdList.forEach(userId -> {
+            //判断提交的参数数据是否已经存在
+            if (super.count(new LambdaQueryWrapper<GameAuthRole>()
+                    .eq(GameAuthRole::getUserId, userId)
+            ) > 0) {
+                return;
+            }
+            addList.add(this.transform(userId, param.getAuthType().getValue()));
+        });
+        if (addList.isEmpty()) {
+            return Boolean.FALSE;
+        }
+        return super.saveBatch(addList);
+    }
+
+    private GameAuthRole transform(Long userId, String authType) {
+        return GameAuthRole.builder()
+                .authType(authType)
+                .userId(userId)
+                .isDelete(DeleteEnum.NO.getCode())
+                .createBy(SecurityUtil.getUserId())
+                .createTime(LocalDateTime.now())
+                .updateBy(SecurityUtil.getUserId())
+                .updateTime(LocalDateTime.now())
+                .build();
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean gameAuthRoleUpdate(GameAuthRoleUpdateParam param) {
+        return super.update(new LambdaUpdateWrapper<GameAuthRole>()
+                .set(GameAuthRole::getAuthType, param.getAuthType().getValue())
+                .eq(GameAuthRole::getId, param.getId()));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean deleteById(Long id) {
+        return super.removeById(id);
+    }
+
+    @Override
+    public IPage<GameAuthRoleVO> listOfPage(GameAuthRoleListParam param) {
+        return page(param.toPage(), new QueryWrapper<GameAuthRole>().lambda()
+                .eq(param.getUserId() != null, GameAuthRole::getUserId, param.getUserId())
+                .eq(param.getAuthType() != null, GameAuthRole::getAuthType, param.getAuthType() == null ? null : param.getAuthType().getValue())
+                .orderByDesc(GameAuthRole::getUpdateTime)
+        ).convert(this::toVo);
+    }
+
+    private GameAuthRoleVO toVo(GameAuthRole gameAuthRole) {
+        if (Objects.isNull(gameAuthRole)) {
+            return null;
+        }
+        GameAuthRoleVO gameAuthRoleVO = BeanUtil.copy(gameAuthRole, GameAuthRoleVO.class);
+        Map<Long, String> userMap = sysUserRpc.getUserNameByIds(Collections.singletonList(gameAuthRoleVO.getUserId())).getData();
+        gameAuthRoleVO.setUserName(userMap.get(gameAuthRoleVO.getUserId()));
+        return gameAuthRoleVO;
+    }
+
+}

+ 27 - 17
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthServiceImpl.java

@@ -14,9 +14,11 @@ import com.zanxiang.game.module.manage.pojo.params.GameAuthAddParam;
 import com.zanxiang.game.module.manage.pojo.params.GameAuthListParam;
 import com.zanxiang.game.module.manage.pojo.params.GameAuthUpdateParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameAuthVO;
+import com.zanxiang.game.module.manage.service.IGameAuthRoleService;
 import com.zanxiang.game.module.manage.service.IGameAuthService;
 import com.zanxiang.game.module.manage.service.IGameService;
 import com.zanxiang.game.module.mybatis.entity.GameAuth;
+import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
 import com.zanxiang.game.module.mybatis.mapper.GameAuthMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
@@ -41,26 +43,37 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
     @Autowired
     private IGameService gameService;
 
+    @Autowired
+    private IGameAuthRoleService gameAuthRoleService;
+
     @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
     private ISysUserRpc sysUserRpc;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean gameAuthAdd(GameAuthAddParam param) {
-        //游戏id
-        Long gameId = param.getGameId();
-        List<GameAuthAddParam.GameAuthUserBean> userAuthList = param.getUserAuthList();
+        List<Long> userIdList = param.getUserIdList();
+        List<Long> gameIdList = param.getGameIdList();
         List<GameAuth> addList = new ArrayList<>();
-        userAuthList.forEach(userAuth -> {
-            //判断提交的参数数据是否已经存在
-            if (super.count(new LambdaQueryWrapper<GameAuth>()
-                    .eq(GameAuth::getGameId, gameId)
-                    .eq(GameAuth::getUserId, userAuth.getUserId())
-                    .eq(GameAuth::getType, userAuth.getType())
-            ) > 0) {
-                return;
+        userIdList.forEach(userId -> {
+            //判断角色是否正确
+            if (gameAuthRoleService.count(new LambdaQueryWrapper<GameAuthRole>()
+                    .eq(GameAuthRole::getUserId, userId)
+                    .eq(GameAuthRole::getAuthType, param.getGameAuthEnum().getValue())
+            ) <= 0) {
+                throw new BaseException("参数错误, 提交得用户存在权限不匹配");
             }
-            addList.add(this.transform(gameId, userAuth));
+            //循环添加
+            gameIdList.forEach(gameId -> {
+                //判断提交的参数数据是否已经存在
+                if (super.count(new LambdaQueryWrapper<GameAuth>()
+                        .eq(GameAuth::getGameId, gameId)
+                        .eq(GameAuth::getUserId, userId)
+                ) <= 0) {
+                    throw new BaseException("参数错误, 提交的用户存在重复权限");
+                }
+                addList.add(this.transform(gameId, userId));
+            });
         });
         if (addList.isEmpty()) {
             return Boolean.FALSE;
@@ -68,11 +81,10 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
         return super.saveBatch(addList);
     }
 
-    private GameAuth transform(Long gameId, GameAuthAddParam.GameAuthUserBean gameAuthUserBean) {
+    private GameAuth transform(Long gameId, Long userId) {
         return GameAuth.builder()
                 .gameId(gameId)
-                .userId(gameAuthUserBean.getUserId())
-                .type(gameAuthUserBean.getType())
+                .userId(userId)
                 .isDelete(DeleteEnum.NO.getCode())
                 .createBy(SecurityUtil.getUserId())
                 .createTime(LocalDateTime.now())
@@ -88,7 +100,6 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
         if (super.count(new LambdaQueryWrapper<GameAuth>()
                 .eq(GameAuth::getGameId, param.getGameId())
                 .eq(GameAuth::getUserId, param.getUserId())
-                .eq(GameAuth::getType, param.getType())
         ) > 0) {
             throw new BaseException("参数错误, 要修改的数据已经存在相同数据");
         }
@@ -96,7 +107,6 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
         return super.update(new LambdaUpdateWrapper<GameAuth>()
                 .set(GameAuth::getGameId, param.getGameId())
                 .set(GameAuth::getUserId, param.getUserId())
-                .set(GameAuth::getType, param.getType())
                 .set(GameAuth::getUpdateBy, SecurityUtil.getUserId())
                 .set(GameAuth::getUpdateTime, LocalDateTime.now())
                 .eq(GameAuth::getId, param.getId()));

+ 0 - 8
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuth.java

@@ -24,9 +24,6 @@ public class GameAuth implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    public static final int TYPE_PITCHER = 1;
-    public static final int TYPE_OPERATE = 2;
-
     /**
      * 主键id
      */
@@ -43,11 +40,6 @@ public class GameAuth implements Serializable {
      */
     private Long userId;
 
-    /**
-     * 类型
-     */
-    private Integer type;
-
     /**
      * 1 删除  0 正常
      */

+ 68 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuthRole.java

@@ -0,0 +1,68 @@
+package com.zanxiang.game.module.mybatis.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+@Builder
+@TableName("t_game_auth_role")
+public class GameAuthRole implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 授权类型
+     */
+    private String authType;
+
+    /**
+     * 1 删除  0 正常
+     */
+    @TableLogic
+    private Integer isDelete;
+
+    /**
+     * 创建者
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新者
+     */
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

+ 12 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/mapper/GameAuthRoleMapper.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.module.mybatis.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-17
+ * @description : 游戏授权角色
+ */
+public interface GameAuthRoleMapper extends BaseMapper<GameAuthRole> {
+}