Kaynağa Gözat

更新租户对应用户查询为分页查询

tags/v2.4.1
xiaoying 1 yıl önce
ebeveyn
işleme
9f154b0f28
12 değiştirilmiş dosya ile 59 ekleme ve 16 silme
  1. +4
    -3
      tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/UserController.java
  2. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientUserMapper.java
  3. +16
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/UserQuery.java
  4. +3
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java
  5. +18
    -11
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  6. +7
    -0
      tuoheng_oidc_admin/src/main/resources/mapper/ClientUserMapper.xml
  7. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/controller/UserController.class
  8. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class
  9. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/po/TenantPo.class
  10. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/ClientUserSevice.class
  11. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class
  12. +7
    -0
      tuoheng_oidc_admin/target/classes/mapper/ClientUserMapper.xml

+ 4
- 3
tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/UserController.java Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.param.CreateClientUserDto;
import com.tuoheng.model.param.UpdateUserClientRoleDto;
import com.tuoheng.model.param.UpdateUserPassDto;
import com.tuoheng.model.query.UserQuery;
import com.tuoheng.service.ClientUserSevice;
import com.tuoheng.service.CurrentUser;
import com.tuoheng.until.JsonResult;
@@ -63,12 +64,12 @@ public class UserController {

/**
* 查询对应租户下的所有用户数据
* @param tenantId
* @param query
* @return
*/
@GetMapping("/findUserList")
public JsonResult findUserList(Long tenantId){
return clientUserSevice.findUserList(tenantId);
public JsonResult findUserList(UserQuery query){
return clientUserSevice.findUserList(query);
}

}

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientUserMapper.java Dosyayı Görüntüle

@@ -1,6 +1,8 @@
package com.tuoheng.mapper;

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

@@ -25,4 +27,6 @@ public interface ClientUserMapper {
UserPo selectByUserId(@Param("userId") Long userId);

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

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

+ 16
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/UserQuery.java Dosyayı Görüntüle

@@ -0,0 +1,16 @@
package com.tuoheng.model.query;

import com.tuoheng.common.BaseQuery;
import lombok.Data;

/**
* @Author xiaoying
* @Date 2023/2/23 17:13
*/
@Data
public class UserQuery extends BaseQuery {
/**
* 租户id
*/
private Long tenantId;
}

+ 3
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java Dosyayı Görüntüle

@@ -7,6 +7,7 @@ import com.tuoheng.model.param.CreateClientUserDto;
import com.tuoheng.model.param.UpdateUserClientRoleDto;
import com.tuoheng.model.param.UpdateUserPassDto;
import com.tuoheng.model.query.TenantQuery;
import com.tuoheng.model.query.UserQuery;
import com.tuoheng.until.JsonResult;

/**
@@ -50,8 +51,8 @@ public interface ClientUserSevice {
JsonResult updateAuthorities(CreateClientUserDto createClientUserDto, LoginUser loginUser);
/**
* 查询对应租户下的所有用户数据
* @param tenantId
* @param query
* @return
*/
JsonResult findUserList(Long tenantId);
JsonResult findUserList(UserQuery query);
}

+ 18
- 11
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java Dosyayı Görüntüle

@@ -15,6 +15,7 @@ import com.tuoheng.model.po.ClientUserRolePo;
import com.tuoheng.model.po.TenantPo;
import com.tuoheng.model.po.UserPo;
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.service.ClientUserSevice;
@@ -221,13 +222,19 @@ public class ClientUserServiceImpl implements ClientUserSevice {
/**
* 查询对应租户下的所有用户数据
*
* @param tenantId
* @param query
* @return
*/
@Override
public JsonResult findUserList(Long tenantId) {
List<UserPo> userPos = clientUserMapper.selectByTenantId(tenantId);
return JsonResult.success(userPos);
public JsonResult findUserList(UserQuery query) {

if (ObjectUtil.isNull(query.getPage()) || ObjectUtil.isNull(query.getLimit())) {
return JsonResult.error("分页参数不能为空");
}
//开启分页
IPage<UserPo> page = new Page<>(query.getPage(), query.getLimit());
IPage<UserPo> pageData = clientUserMapper.selectByTenantIdAndPage(query.getTenantId(), page);
return JsonResult.success(pageData);
}

/**
@@ -469,7 +476,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
String url = platform.getPlatformUrl();

//根据不同业务平台进行动态匹配
switch (platform.getPlatformCode()){
switch (platform.getPlatformCode()) {
//河湖长
case HhzUrlConstant.HHZ_CLIENT:
url = url + HhzUrlConstant.CREATE_TENANT;
@@ -487,7 +494,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
default:
break;
}
log.info("请求url:{}",url);
log.info("请求url:{}", url);
ResponseEntity<JsonResult> response;
try {
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class);
@@ -527,7 +534,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
//设置地址(hhz平台)
String url = platform.getPlatformUrl();
//根据不同业务平台进行动态匹配
switch (platform.getPlatformCode()){
switch (platform.getPlatformCode()) {
//河湖长
case HhzUrlConstant.HHZ_CLIENT:
url = url + HhzUrlConstant.UPDATE_TENANT;
@@ -545,10 +552,10 @@ public class ClientUserServiceImpl implements ClientUserSevice {
default:
break;
}
log.info("请求url:{}",url);
log.info("请求url:{}", url);
ResponseEntity<JsonResult> response;
try {
log.info("请求url:{}",url);
log.info("请求url:{}", url);
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class);
} catch (Exception e) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "业务平台更新租户失败");
@@ -586,7 +593,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
//设置地址(hhz平台)
String url = platform.getPlatformUrl();
//根据不同业务平台进行动态匹配
switch (platform.getPlatformCode()){
switch (platform.getPlatformCode()) {
//河湖长
case HhzUrlConstant.HHZ_CLIENT:
url = url + HhzUrlConstant.DELETE_TENANT;
@@ -604,7 +611,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
default:
break;
}
log.info("请求url:{}",url);
log.info("请求url:{}", url);
ResponseEntity<JsonResult> response;
try {
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class);

+ 7
- 0
tuoheng_oidc_admin/src/main/resources/mapper/ClientUserMapper.xml Dosyayı Görüntüle

@@ -36,6 +36,13 @@
# 用户没有被删除
and enabled = 1
</select>
<select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.po.UserPo">
SELECT *
FROM users
WHERE tenant_id = #{tenantId}
# 用户没有被删除
and enabled = 1
</select>

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

BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/controller/UserController.class Dosyayı Görüntüle


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class Dosyayı Görüntüle


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/po/TenantPo.class Dosyayı Görüntüle


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/ClientUserSevice.class Dosyayı Görüntüle


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class Dosyayı Görüntüle


+ 7
- 0
tuoheng_oidc_admin/target/classes/mapper/ClientUserMapper.xml Dosyayı Görüntüle

@@ -36,6 +36,13 @@
# 用户没有被删除
and enabled = 1
</select>
<select id="selectByTenantIdAndPage" resultType="com.tuoheng.model.po.UserPo">
SELECT *
FROM users
WHERE tenant_id = #{tenantId}
# 用户没有被删除
and enabled = 1
</select>

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

Yükleniyor…
İptal
Kaydet