Browse Source

新增查询租户对应用户列表时增加平台信息以及对应的平台筛选

tags/v2.4.1
xiaoying 1 year ago
parent
commit
50dd2eef50
7 changed files with 82 additions and 13 deletions
  1. +3
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientUserMapper.java
  2. +11
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/UserQuery.java
  3. +23
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/UserVo.java
  4. +27
    -6
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  5. +18
    -6
      tuoheng_oidc_admin/src/main/resources/mapper/ClientUserMapper.xml
  6. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class
  7. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class

+ 3
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientUserMapper.java View File

@@ -2,7 +2,9 @@ package com.tuoheng.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tuoheng.model.po.UserPo;
import com.tuoheng.model.query.UserQuery;
import com.tuoheng.model.vo.TenantVo;
import com.tuoheng.model.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@@ -28,5 +30,5 @@ public interface ClientUserMapper {

List<UserPo> selectByTenantId(@Param("tenantId") Long id);

IPage<UserPo> selectByTenantIdAndPage(Long tenantId, IPage<UserPo> page);
IPage<UserVo> selectByTenantIdAndPage(UserQuery query, IPage<UserPo> page);
}

+ 11
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/UserQuery.java View File

@@ -9,6 +9,17 @@ import lombok.Data;
*/
@Data
public class UserQuery extends BaseQuery {

/**
*平台Code
*/
private String platformCode;

/**
* 用户名
*/
private String username;

/**
* 租户id
*/

+ 23
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/UserVo.java View File

@@ -0,0 +1,23 @@
package com.tuoheng.model.vo;

import com.tuoheng.model.po.UserPo;
import lombok.Data;

/**
* @Author xiaoying
* @Date 2023/3/1 14:03
*/
@Data
public class UserVo extends UserPo {

/**
* 平台code
*/
private String platformCode;

/**
* 平台名称
*/
private String platformName;

}

+ 27
- 6
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java View File

@@ -8,7 +8,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.common.ServiceException;
import com.tuoheng.constant.*;
import com.tuoheng.mapper.*;
import com.tuoheng.model.dto.*;
import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.dto.OidcTenantDto;
import com.tuoheng.model.dto.Platform;
import com.tuoheng.model.dto.TTenant;
import com.tuoheng.model.param.*;
import com.tuoheng.model.po.AuthoritiesPo;
import com.tuoheng.model.po.ClientUserRolePo;
@@ -18,10 +21,12 @@ import com.tuoheng.model.query.TenantQuery;
import com.tuoheng.model.query.UserQuery;
import com.tuoheng.model.vo.BusinessSystemVo;
import com.tuoheng.model.vo.TenantVo;
import com.tuoheng.model.vo.UserVo;
import com.tuoheng.service.ClientUserSevice;
import com.tuoheng.until.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.http.*;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
@@ -249,7 +254,23 @@ public class ClientUserServiceImpl implements ClientUserSevice {
}
//开启分页
IPage<UserPo> page = new Page<>(query.getPage(), query.getLimit());
IPage<UserPo> pageData = clientUserMapper.selectByTenantIdAndPage(query.getTenantId(), page);
IPage<UserVo> pageData = clientUserMapper.selectByTenantIdAndPage(query, page);
pageData.convert(x -> {

String platformCode = x.getPlatformCode();
if (platformCode.contains(HhzUrlConstant.HHZ_CLIENT)) {
x.setPlatformName(HhzUrlConstant.HHZ_NAME);
} else if (platformCode.contains(WaterWayConstant.WATERWAY_CLIENT)) {
x.setPlatformName(WaterWayConstant.WATERWAY_NAME);
} else if (platformCode.contains(FreeWayConstant.FREEWAY_CLIENT)) {
x.setPlatformName(FreeWayConstant.FREEWAY_NAME);
} else if (platformCode.contains(PilotConstant.PILOT_CLIENT)) {
x.setPlatformName(PilotConstant.PILOT_NAME);
} else if (platformCode.contains(AirportConstant.AIRPORT_CLIENT)) {
x.setPlatformName(AirportConstant.AIRPORT_NAME);
}
return x;
});
return JsonResult.success(pageData);
}

@@ -354,13 +375,13 @@ public class ClientUserServiceImpl implements ClientUserSevice {
//TODO 后期维护各个业务平台
if (authoritiesPo.getAuthority().contains("hhz")) {
businessSystemVoList.add(getbusinessSystemVo(HhzUrlConstant.HHZ_CLIENT, HhzUrlConstant.HHZ_NAME));
}else if (authoritiesPo.getAuthority().contains("airport")) {
} else if (authoritiesPo.getAuthority().contains("airport")) {
businessSystemVoList.add(getbusinessSystemVo(AirportConstant.AIRPORT_CLIENT, AirportConstant.AIRPORT_NAME));
}else if (authoritiesPo.getAuthority().contains("waterway")) {
} else if (authoritiesPo.getAuthority().contains("waterway")) {
businessSystemVoList.add(getbusinessSystemVo(WaterWayConstant.WATERWAY_CLIENT, WaterWayConstant.WATERWAY_NAME));
}else if (authoritiesPo.getAuthority().contains("freeway")) {
} else if (authoritiesPo.getAuthority().contains("freeway")) {
businessSystemVoList.add(getbusinessSystemVo(FreeWayConstant.FREEWAY_CLIENT, FreeWayConstant.FREEWAY_NAME));
}else if(authoritiesPo.getAuthority().contains("pilot")) {
} else if (authoritiesPo.getAuthority().contains("pilot")) {
businessSystemVoList.add(getbusinessSystemVo(PilotConstant.PILOT_CLIENT, PilotConstant.PILOT_NAME));
}
}

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

@@ -36,12 +36,24 @@
# 用户没有被删除
and enabled = 1
</select>
<select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.po.UserPo">
SELECT *
FROM users
WHERE tenant_id = #{tenantId}
# 用户没有被删除
and enabled = 1
<select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.vo.UserVo">
SELECT
u.*,
a.authority platformCode
FROM
users u,
authorities a
WHERE
u.tenant_id = #{query.tenantId}
<if test="query.username != null and query.username != ''">
and u.username LIKE concat('%',#{query.username},'%')
</if>
<if test="query.platformCode != null and query.platformCode != ''">
and a.authority LIKE concat('%',#{query.platformCode},'%')
</if>
AND u.tenant_id = a.create_user
and u.enabled =1
GROUP BY u.username
</select>

<update id="updatePass" parameterType="com.tuoheng.model.po.UserPo">

BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class View File


Loading…
Cancel
Save