Browse Source

更新用户信息查询返回相关参数

tags/v2.5.0
xiaoying 1 year ago
parent
commit
8e9efbc312
4 changed files with 43 additions and 10 deletions
  1. +17
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/AuthoritiesDto.java
  2. +2
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/ClientRoleDto.java
  3. +1
    -1
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/UserBaseInfoDto.java
  4. +23
    -9
      tuoheng_oidc_server/src/main/resources/mapper/UserMapper.xml

+ 17
- 0
tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/AuthoritiesDto.java View File

package com.tuoheng.model.dto;

import lombok.Data;

/**
* @Author xiaoying
* @Date 2023/7/3 9:49
*/
@Data
public class AuthoritiesDto {

private String authority;

private Integer status;


}

+ 2
- 0
tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/ClientRoleDto.java View File



private Integer roleId; private Integer roleId;


private Integer status;

} }

+ 1
- 1
tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/UserBaseInfoDto.java View File

/** /**
* 可以访问的 client * 可以访问的 client
*/ */
private List<String> authorityList;
private List<AuthoritiesDto> authorityList;


/** /**
* 可以访问的 client 以及 role * 可以访问的 client 以及 role

+ 23
- 9
tuoheng_oidc_server/src/main/resources/mapper/UserMapper.xml View File

<mapper namespace="com.tuoheng.mapper.UserMapper"> <mapper namespace="com.tuoheng.mapper.UserMapper">


<resultMap type="com.tuoheng.model.dto.UserBaseInfoDto" id="UserBaseInfoMap"> <resultMap type="com.tuoheng.model.dto.UserBaseInfoDto" id="UserBaseInfoMap">
<id column="userId" jdbcType="INTEGER" property="userId" />
<result column="userName" jdbcType="VARCHAR" property="userName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<collection property="authorityList" ofType="java.lang.String" javaType="java.util.List">
<result column="authority" jdbcType="VARCHAR"/>
<id column="userId" jdbcType="INTEGER" property="userId"/>
<result column="userName" jdbcType="VARCHAR" property="userName"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
<collection property="authorityList" ofType="com.tuoheng.model.dto.AuthoritiesDto" javaType="java.util.List">
<result column="authority" jdbcType="VARCHAR" property="authority"/>
<result column="status" jdbcType="INTEGER" property="status"/>
</collection> </collection>
<collection property="clientRoleDtoList" ofType="com.tuoheng.model.dto.ClientRoleDto" javaType="java.util.List"> <collection property="clientRoleDtoList" ofType="com.tuoheng.model.dto.ClientRoleDto" javaType="java.util.List">
<result column="clientId" jdbcType="VARCHAR" property="clientId" />
<result column="roleId" jdbcType="INTEGER" property="roleId" />
<result column="clientId" jdbcType="VARCHAR" property="clientId"/>
<result column="roleId" jdbcType="INTEGER" property="roleId"/>
<result column="status" jdbcType="INTEGER" property="status"/>
</collection> </collection>
</resultMap> </resultMap>


</insert> </insert>


<select id="getUserBaseInfo" resultMap="UserBaseInfoMap"> <select id="getUserBaseInfo" resultMap="UserBaseInfoMap">
select a.id as userId, a.username as userName, a.password , b.authority, c.client_id as clientId, c.role_id as roleId
select a.id as userId,
a.username as userName,
a.password,
b.authority,
c.client_id as clientId,
c.role_id as roleId
from users a from users a
left join authorities b on a.id = b.user_id left join authorities b on a.id = b.user_id
left join t_client_user_role c on a.id = c.user_id left join t_client_user_role c on a.id = c.user_id
</select> </select>


<select id="getMpUserInfo" resultMap="UserBaseInfoMap"> <select id="getMpUserInfo" resultMap="UserBaseInfoMap">
select a.id as userId, a.username as userName, a.password , b.authority, c.client_id as clientId, c.role_id as roleId
select a.id as userId,
a.username as userName,
a.password,
b.authority,
b.status,
c.client_id as clientId,
c.role_id as roleId,
c.status as status
from users a from users a
left join authorities b on a.id = b.user_id left join authorities b on a.id = b.user_id
left join t_client_user_role c on a.id = c.user_id left join t_client_user_role c on a.id = c.user_id

Loading…
Cancel
Save