Browse Source

Merge branch 'develop' of gitadmin/tuoheng_oidc into release

tags/v2.3.0^2
gitadmin 1 year ago
parent
commit
06dd33fd9a
4 changed files with 30 additions and 2 deletions
  1. +11
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java
  2. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/UserPo.java
  3. +13
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  4. +2
    -2
      tuoheng_oidc_admin/src/main/resources/mapper/ClientUserMapper.xml

+ 11
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java View File

@@ -20,6 +20,17 @@ public class CreateClientUserDto {
@NotEmpty(message = "password can not be empty!")
private String password;

/**
* 如果不是租户,传值:用户所属租户名称
*/
private String tenantName;

/**
* 是否为租户标识
* 0:不是;1:是
*/
private Integer tenantFlag;

@NotNull(message = "clientRoleDtoList can not be null!")
private List<ClientRoleDto> clientRoleDtoList;


+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/UserPo.java View File

@@ -20,4 +20,8 @@ public class UserPo extends BasePo {

private Integer enabled;

private Long tenantId;

private Integer isTenant;

}

+ 13
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java View File

@@ -57,6 +57,19 @@ public class ClientUserServiceImpl implements ClientUserSevice {
.setUsername(createClientUserDto.getUsername())
.setPassword("{bcrypt}" + new BCryptPasswordEncoder().encode(createClientUserDto.getPassword()));
userPo.setCreateUser(loginUser.getUserId());
//租户逻辑新增 start
if(createClientUserDto.getTenantFlag() != null){
if(createClientUserDto.getTenantFlag() == 1){
userPo.setIsTenant(1);
}else {
userPo.setIsTenant(0);
UserPo po = clientUserMapper.getUserByUserName(createClientUserDto.getTenantName());
if(po != null){
userPo.setTenantId(po.getId());
}
}
}
//租户逻辑新增 end
clientUserMapper.insertClientUser(userPo);

List<AuthoritiesPo> authoritiesPos = new ArrayList<>();

+ 2
- 2
tuoheng_oidc_admin/src/main/resources/mapper/ClientUserMapper.xml View File

@@ -3,8 +3,8 @@
<mapper namespace="com.tuoheng.mapper.ClientUserMapper">

<insert id="insertClientUser" parameterType="com.tuoheng.model.po.UserPo" keyProperty="id" useGeneratedKeys="true">
insert into users (username, password, create_user)
values (#{username}, #{password}, #{createUser})
insert into users (username, password, create_user, tenant_id, is_tenant)
values (#{username}, #{password}, #{createUser}, #{tenantId}, #{isTenant})
</insert>

<select id="judgeCreateByUserName" parameterType="java.lang.String" resultType="int">

Loading…
Cancel
Save