修改了首页,增加了标签字段

This commit is contained in:
wucongxing8150 2025-06-09 08:55:11 +08:00
parent a0b70e5029
commit bd5a9f819a
11 changed files with 141 additions and 2 deletions

View File

@ -2,6 +2,8 @@ package com.example.caseData.dto.caseClinicalArticle;
import cn.hutool.core.bean.BeanUtil;
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
import com.example.caseData.dto.caseClinicalArticleLabel.CaseClinicalArticleLabelDto;
import com.example.caseData.model.CaseClinicalArticleLabelModel;
import com.example.caseData.model.CaseClinicalArticleModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -43,6 +45,12 @@ public class CaseClinicalArticleDto {
@JsonProperty("collect_num")
private Integer collectNum;
/**
* 评论量
*/
@JsonProperty("comment_num")
private Integer commentNum;
/**
* 发表时间
*/
@ -73,6 +81,12 @@ public class CaseClinicalArticleDto {
@JsonProperty("author")
private List<CaseClinicalArticleAuthorDto> author;
/**
* 标签
*/
@JsonProperty("label")
private List<CaseClinicalArticleLabelDto> label;
/**
* 收藏状态
*/
@ -102,6 +116,12 @@ public class CaseClinicalArticleDto {
dto.setAuthor(caseClinicalArticleAuthorListDto);
}
// 标签
if (model.getLabel() != null && !model.getLabel().isEmpty()) {
List<CaseClinicalArticleLabelDto> caseClinicalArticleLabelListDto = CaseClinicalArticleLabelDto.GetListDto(model.getLabel());
dto.setLabel(caseClinicalArticleLabelListDto);
}
dto.setArticleContent("");
return dto;
})
@ -129,6 +149,12 @@ public class CaseClinicalArticleDto {
dto.setAuthor(caseClinicalArticleAuthorListDto);
}
// 标签
if (model.getLabel() != null && !model.getLabel().isEmpty()) {
List<CaseClinicalArticleLabelDto> caseClinicalArticleLabelListDto = CaseClinicalArticleLabelDto.GetListDto(model.getLabel());
dto.setLabel(caseClinicalArticleLabelListDto);
}
return dto;
}
}

View File

@ -1,8 +1,14 @@
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 {
@ -10,13 +16,13 @@ public class CaseClinicalArticleLabelDto {
* 主键id
*/
@JsonProperty("article_label_id")
private Long articleLabelId;
private String articleLabelId;
/**
* 临床文章id
*/
@JsonProperty("article_id")
private Long articleId;
private String articleId;
/**
* app唯一标识
@ -41,4 +47,26 @@ public class CaseClinicalArticleLabelDto {
*/
@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());
}
}

View File

@ -37,6 +37,12 @@ public class CaseClinicalArticleModel {
@TableField("collect_num")
private Integer collectNum;
/**
* 评论量
*/
@TableField("comment_num")
private Integer commentNum;
/**
* 发表时间
*/
@ -66,4 +72,8 @@ public class CaseClinicalArticleModel {
// 作者
@TableField(exist = false)
private List<CaseClinicalArticleAuthorModel> author;
// 标签
@TableField(exist = false)
private List<CaseClinicalArticleLabelModel> label;
}

View File

@ -40,6 +40,12 @@ public class CaseClinicalVideoModel {
@TableField("collect_num")
private Integer collectNum;
/**
* 评论量
*/
@TableField("comment_num")
private Integer commentNum;
/**
* 视频编号保利
*/

View File

@ -49,6 +49,12 @@ public class CaseExchangeModel {
@TableField("collect_num")
private Integer collectNum;
/**
* 评论量
*/
@TableField("comment_num")
private Integer commentNum;
/**
* 发表时间
*/

View File

@ -42,6 +42,12 @@ public class StatsCaseClinicalDoctorModel {
@TableField("article_collect_num")
private Integer articleCollectNum;
/**
* 总评论量-文章
*/
@TableField("article_comment_num")
private Integer articleCommentNum;
/**
* 数量-视频
*/
@ -60,6 +66,12 @@ public class StatsCaseClinicalDoctorModel {
@TableField("video_collect_num")
private Integer videoCollectNum;
/**
* 总评论量-视频
*/
@TableField("video_comment_num")
private Integer VideoCommentNum;
/**
* 创建时间
*/

View File

@ -39,6 +39,12 @@ public class StatsCaseClinicalHospitalModel {
@TableField("article_collect_num")
private Integer articleCollectNum;
/**
* 总评论量-文章
*/
@TableField("article_comment_num")
private Integer articleCommentNum;
/**
* 最后一篇文章发表时间
*/
@ -63,6 +69,12 @@ public class StatsCaseClinicalHospitalModel {
@TableField("video_collect_num")
private Integer videoCollectNum;
/**
* 总评论量-视频
*/
@TableField("video_comment_num")
private Integer VideoCommentNum;
/**
* 创建时间
*/

View File

@ -33,6 +33,12 @@ public class StatsCaseClinicalModel {
@TableField("article_collect_num")
private Integer articleCollectNum;
/**
* 总评论量-文章
*/
@TableField("article_comment_num")
private Integer articleCommentNum;
/**
* 数量-视频
*/
@ -51,6 +57,12 @@ public class StatsCaseClinicalModel {
@TableField("video_collect_num")
private Integer videoCollectNum;
/**
* 总评论量-视频
*/
@TableField("video_comment_num")
private Integer VideoCommentNum;
/**
* 创建时间
*/

View File

@ -36,6 +36,12 @@ public class StatsCaseExchangeModel {
@TableField("exchange_collect_num")
private Integer exchangeCollectNum;
/**
* 总评论量-病例交流
*/
@TableField("exchange_comment_num")
private Integer exchangeCommentNum;
/**
* 创建时间
*/

View File

@ -42,6 +42,12 @@ public class StatsCaseExchangeUserModel {
@TableField("exchange_collect_num")
private Integer exchangeCollectNum;
/**
* 总评论量-病例交流
*/
@TableField("exchange_comment_num")
private Integer exchangeCommentNum;
/**
* 创建时间
*/

View File

@ -38,6 +38,9 @@ public class IndexService {
@Resource
private BasicHospitalDao basicHospitalDao;
@Resource
private CaseClinicalArticleLabelDao caseClinicalArticleLabelDao;
/**
* 获取首页数据-临床病例库
*/
@ -65,6 +68,12 @@ public class IndexService {
}
article.setAuthor(caseClinicalArticleAuthors);
// 查找标签
LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, article.getArticleId());
List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
article.setLabel(caseClinicalArticleLabels);
}
@ -92,6 +101,12 @@ public class IndexService {
article.setAuthor(caseClinicalArticleAuthors);
// 查找标签
LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, article.getArticleId());
List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
article.setLabel(caseClinicalArticleLabels);
// 删除内容字段
article.setArticleContent("");
}