|
@@ -16,11 +16,15 @@ 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.manage.service.IGameAuthService;
|
|
|
+import com.zanxiang.game.module.mybatis.entity.GameAuth;
|
|
|
import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
|
|
|
import com.zanxiang.game.module.mybatis.mapper.GameAuthRoleMapper;
|
|
|
import com.zanxiang.module.util.bean.BeanUtil;
|
|
|
+import com.zanxiang.module.util.exception.BaseException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -40,6 +44,9 @@ public class GameAuthRoleServiceImpl extends ServiceImpl<GameAuthRoleMapper, Gam
|
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
|
private ISysUserRpc sysUserRpc;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGameAuthService gameAuthService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<Long, String> getUserByAuthType(String authType) {
|
|
|
List<GameAuthRole> authRoleList = super.list(new LambdaQueryWrapper<GameAuthRole>()
|
|
@@ -96,6 +103,16 @@ public class GameAuthRoleServiceImpl extends ServiceImpl<GameAuthRoleMapper, Gam
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean deleteById(Long id) {
|
|
|
+ //查询用户是否存在游戏
|
|
|
+ GameAuthRole gameAuthRole = super.getById(id);
|
|
|
+ if (gameAuthRole == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (gameAuthService.count(new LambdaQueryWrapper<GameAuth>()
|
|
|
+ .eq(GameAuth::getUserId, gameAuthRole.getUserId())
|
|
|
+ ) > 0) {
|
|
|
+ throw new BaseException("该角色存在分配的游戏, 禁止删除");
|
|
|
+ }
|
|
|
return super.removeById(id);
|
|
|
}
|
|
|
|