全局:增加 VO 数据翻译的支持
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.system.api.logger.dto;
|
||||
|
||||
import com.fhs.core.trans.anno.Trans;
|
||||
import com.fhs.core.trans.constant.TransType;
|
||||
import com.fhs.core.trans.vo.VO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -7,11 +10,16 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Schema(name = "RPC 服务 - 系统操作日志 Response DTO")
|
||||
@Data
|
||||
public class OperateLogV2RespDTO {
|
||||
public class OperateLogV2RespDTO implements VO {
|
||||
|
||||
@Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
|
||||
private String traceId;
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
|
||||
@Trans(type = TransType.RPC, targetClassName = "cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO",
|
||||
fields = "nickname", ref = "userName")
|
||||
private Long userId;
|
||||
@Schema(description = "用户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String userName;
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.api.user;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import com.fhs.core.trans.anno.AutoTrans;
|
||||
import com.fhs.trans.service.AutoTransable;
|
||||
import feign.FeignIgnore;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -13,9 +17,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.api.user.AdminUserApi.PREFIX;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 管理员用户")
|
||||
public interface AdminUserApi {
|
||||
@AutoTrans(namespace = PREFIX, fields = {"nickname"})
|
||||
public interface AdminUserApi extends AutoTransable<AdminUserRespDTO> {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/user";
|
||||
|
||||
@@ -71,4 +78,16 @@ public interface AdminUserApi {
|
||||
@Parameter(name = "ids", description = "用户编号数组", example = "3,5", required = true)
|
||||
CommonResult<Boolean> validateUserList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
@Override
|
||||
@FeignIgnore
|
||||
default List<AdminUserRespDTO> selectByIds(List<?> ids) {
|
||||
return getUserList(Convert.toList(Long.class, ids)).getCheckedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@FeignIgnore
|
||||
default AdminUserRespDTO selectById(Object id) {
|
||||
return getUser(Convert.toLong(id)).getCheckedData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.api.user.dto;
|
||||
|
||||
import com.fhs.core.trans.vo.VO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -7,7 +8,7 @@ import java.util.Set;
|
||||
|
||||
@Schema(description = "RPC 服务 - Admin 用户 Response DTO")
|
||||
@Data
|
||||
public class AdminUserRespDTO {
|
||||
public class AdminUserRespDTO implements VO {
|
||||
|
||||
@Schema(description = "用户 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
Reference in New Issue
Block a user