Merge branch 'test' of http://172.16.46.63:30001/gitlab/base-version/ztcloud into test
This commit is contained in:
@@ -41,7 +41,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
||||
public CommonResult<CursorPageResult<DatabusDeptData>> getPageByCursor(CursorPageReqDTO reqDTO) {
|
||||
// 构建游标查询条件
|
||||
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(DeptDO::getDeptSource, 3);
|
||||
// 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId)
|
||||
if (!reqDTO.isFirstPage()) {
|
||||
queryWrapper.and(w -> w
|
||||
@@ -105,6 +105,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
||||
Long total = null;
|
||||
if (reqDTO.isFirstPage()) {
|
||||
LambdaQueryWrapper<DeptDO> countWrapper = new LambdaQueryWrapper<>();
|
||||
countWrapper.eq(DeptDO::getDeptSource, 3);
|
||||
if (reqDTO.getTenantId() != null) {
|
||||
countWrapper.eq(DeptDO::getTenantId, reqDTO.getTenantId());
|
||||
}
|
||||
@@ -175,6 +176,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
||||
@Override
|
||||
public CommonResult<Long> count(Long tenantId) {
|
||||
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DeptDO::getDeptSource, 3);
|
||||
if (tenantId != null) {
|
||||
queryWrapper.eq(DeptDO::getTenantId, tenantId);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi {
|
||||
// 构建游标查询条件
|
||||
LambdaQueryWrapper<AdminUserDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// ⚠️ 只同步 userSource = 2 的用户
|
||||
queryWrapper.eq(AdminUserDO::getUserSource, 2);
|
||||
// ⚠️ 只同步 userSource = 3 的用户
|
||||
queryWrapper.eq(AdminUserDO::getUserSource, 3);
|
||||
|
||||
// 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId)
|
||||
if (!reqDTO.isFirstPage()) {
|
||||
@@ -103,8 +103,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi {
|
||||
Long total = null;
|
||||
if (reqDTO.isFirstPage()) {
|
||||
LambdaQueryWrapper<AdminUserDO> countWrapper = new LambdaQueryWrapper<>();
|
||||
// ⚠️ 只统计 userSource = 2 的用户
|
||||
countWrapper.eq(AdminUserDO::getUserSource, 2);
|
||||
// ⚠️ 只统计 userSource = 3 的用户
|
||||
countWrapper.eq(AdminUserDO::getUserSource, 3);
|
||||
if (reqDTO.getTenantId() != null) {
|
||||
countWrapper.eq(AdminUserDO::getTenantId, reqDTO.getTenantId());
|
||||
}
|
||||
@@ -148,8 +148,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi {
|
||||
@Override
|
||||
public CommonResult<Long> count(Long tenantId) {
|
||||
LambdaQueryWrapper<AdminUserDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// ⚠️ 只统计 userSource = 2 的用户
|
||||
queryWrapper.eq(AdminUserDO::getUserSource, 2);
|
||||
// ⚠️ 只统计 userSource = 3 的用户
|
||||
queryWrapper.eq(AdminUserDO::getUserSource, 3);
|
||||
if (tenantId != null) {
|
||||
queryWrapper.eq(AdminUserDO::getTenantId, tenantId);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,13 @@ public class UserRespVO{
|
||||
@DictFormat(DictTypeConstants.USER_SEX)
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "用户来源,参见 UserSourceEnum 枚举类", example = "1")
|
||||
private Integer userSource;
|
||||
|
||||
@Schema(description = "用户来源标签", example = "外部用户")
|
||||
@ExcelProperty("用户来源")
|
||||
private String userSourceLabel;
|
||||
|
||||
@Schema(description = "用户头像", example = "123456789")
|
||||
private String avatar;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.zt.plat.module.system.dal.dataobject.dept.DeptDO;
|
||||
import com.zt.plat.module.system.dal.dataobject.dept.PostDO;
|
||||
import com.zt.plat.module.system.dal.dataobject.permission.RoleDO;
|
||||
import com.zt.plat.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.zt.plat.module.system.enums.user.UserSourceEnum;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -32,6 +33,10 @@ public interface UserConvert {
|
||||
default UserRespVO convert(AdminUserDO user) {
|
||||
UserRespVO vo = BeanUtils.toBean(user, UserRespVO.class);
|
||||
vo.setAvatar(user.getAvatar());
|
||||
if (user.getUserSource() != null) {
|
||||
UserSourceEnum sourceEnum = UserSourceEnum.of(user.getUserSource());
|
||||
vo.setUserSourceLabel(sourceEnum != null ? sourceEnum.getName() : null);
|
||||
}
|
||||
if (user.getDeptIds() != null) {
|
||||
vo.setDeptIds(CollectionUtils.convertList(user.getDeptIds(), Long::longValue));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface UserDeptMapper extends BaseMapperX<UserDeptDO> {
|
||||
@Select("<script>" +
|
||||
"SELECT ud.* FROM system_user_dept ud " +
|
||||
"INNER JOIN system_users u ON ud.user_id = u.id " +
|
||||
"WHERE u.user_source = 2 " +
|
||||
"WHERE u.user_source = 3 " +
|
||||
"AND ud.deleted = 0 " +
|
||||
"<if test='tenantId != null'> AND ud.tenant_id = #{tenantId} </if>" +
|
||||
"<if test='cursorTime != null'>" +
|
||||
@@ -75,17 +75,17 @@ public interface UserDeptMapper extends BaseMapperX<UserDeptDO> {
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 统计用户-部门关系数量(只统计 userSource = 2 的用户)
|
||||
* 统计用户-部门关系数量(只统计 userSource = 3 的用户)
|
||||
* @param tenantId 租户ID(可选)
|
||||
* @return 数量
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT COUNT(*) FROM system_user_dept ud " +
|
||||
"INNER JOIN system_users u ON ud.user_id = u.id " +
|
||||
"WHERE u.user_source = 2 " +
|
||||
"WHERE u.user_source = 3 " +
|
||||
"AND ud.deleted = 0 " +
|
||||
"<if test='tenantId != null'> AND ud.tenant_id = #{tenantId} </if>" +
|
||||
"</script>")
|
||||
Long countWithUserSource(@Param("tenantId") Long tenantId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user