72 lines
1.8 KiB
Java
72 lines
1.8 KiB
Java
package com.example.caseData.dto.caseClinicalArticleLabel;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.example.caseData.dto.caseClinicalDoctor.CaseClinicalDoctorDto;
|
|
import com.example.caseData.model.CaseClinicalArticleLabelModel;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import lombok.Data;
|
|
import java.time.LocalDateTime;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
@Data
|
|
public class CaseClinicalArticleLabelDto {
|
|
/**
|
|
* 主键id
|
|
*/
|
|
@JsonProperty("article_label_id")
|
|
private String articleLabelId;
|
|
|
|
/**
|
|
* 临床文章id
|
|
*/
|
|
@JsonProperty("article_id")
|
|
private String articleId;
|
|
|
|
/**
|
|
* app唯一标识
|
|
*/
|
|
@JsonProperty("app_iden")
|
|
private String appIden;
|
|
|
|
/**
|
|
* 标签名称
|
|
*/
|
|
@JsonProperty("label_name")
|
|
private String labelName;
|
|
|
|
/**
|
|
* 创建时间
|
|
*/
|
|
@JsonProperty("created_at")
|
|
private LocalDateTime createdAt;
|
|
|
|
/**
|
|
* 修改时间
|
|
*/
|
|
@JsonProperty("updated_at")
|
|
private LocalDateTime updatedAt;
|
|
|
|
/**
|
|
* 列表
|
|
*/
|
|
public static List<CaseClinicalArticleLabelDto> GetListDto(List<CaseClinicalArticleLabelModel> models) {
|
|
if (models == null || models.isEmpty()) {
|
|
return Collections.emptyList();
|
|
}
|
|
|
|
return models.stream()
|
|
.map(model -> {
|
|
CaseClinicalArticleLabelDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleLabelDto.class);
|
|
|
|
// 示例:手动处理字段类型不一致
|
|
if (model.getArticleLabelId() != null) {
|
|
dto.setArticleLabelId(String.valueOf(model.getArticleLabelId())); // Long -> String
|
|
}
|
|
|
|
return dto;
|
|
})
|
|
.collect(Collectors.toList());
|
|
}
|
|
} |