fix 管理员信息响应数据类型问题

This commit is contained in:
ximu-tao
2025-04-23 16:17:51 +08:00
parent c86c52225a
commit e21e5675f2
2 changed files with 20 additions and 3 deletions

View File

@@ -4,11 +4,15 @@ import com.cool.core.base.TenantEntity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.tangzc.mybatisflex.autotable.annotation.ColumnDefine;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.dromara.autotable.annotation.Ignore;
import org.dromara.autotable.annotation.Index;
import org.dromara.autotable.annotation.enums.IndexTypeEnum;
import java.util.List;
@Getter
@Setter
@Table(value = "base_sys_user", comment = "系统用户表")
@@ -58,4 +62,11 @@ public class BaseSysUserEntity extends TenantEntity<BaseSysUserEntity> {
@ColumnDefine(comment = "socketId")
private String socketId;
@Ignore
@Schema( description = "角色列表" )
private List<Long> roleIdList;
}

View File

@@ -30,6 +30,8 @@ import lombok.RequiredArgsConstructor;
import org.dromara.autotable.core.constants.DatabaseDialect;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 系统用户
*/
@@ -171,13 +173,17 @@ public class BaseSysUserServiceImpl extends BaseServiceImpl<BaseSysUserMapper, B
}
@Override
public Object info(Long id) {
public BaseSysUserEntity info(Long id) {
BaseSysUserEntity userEntity = getById(id);
Long[] roleIdList = baseSysPermsService.getRoles(id);
BaseSysDepartmentEntity departmentEntity = baseSysDepartmentMapper.selectOneById(
userEntity.getDepartmentId());
userEntity.setPassword(null);
return Dict.parse(userEntity).set("roleIdList", roleIdList).set("departmentName",
departmentEntity != null ? departmentEntity.getName() : null);
userEntity.setRoleIdList(List.of(roleIdList));
userEntity.setDepartmentName(departmentEntity != null ? departmentEntity.getName() : userEntity.getDepartmentName() );
return userEntity;
}
}