新增我的收藏
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.UserDao;
|
||||
import com.example.caseData.dto.PublicDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.UserModel;
|
||||
import com.example.caseData.request.PublicRequest;
|
||||
import com.example.caseData.request.UserRequest;
|
||||
import com.example.caseData.service.UserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.BasicHospitalDao;
|
||||
import com.example.caseData.dao.CaseClinicalDoctorDao;
|
||||
import com.example.caseData.dao.UserDao;
|
||||
import com.example.caseData.dao.*;
|
||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||
import com.example.caseData.dto.user.UserDto;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.user.UserDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
import com.example.caseData.model.UserModel;
|
||||
import com.example.caseData.request.UserRequest;
|
||||
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||
import com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto;
|
||||
import com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto;
|
||||
import com.example.caseData.model.*;
|
||||
import com.example.caseData.request.UserRequest.UserRequest;
|
||||
import com.example.caseData.request.UserRequest.getUserCollectSearchPage;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -41,6 +39,21 @@ public class UserController extends BaseController {
|
||||
@Resource
|
||||
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private UserCollectClinicalArticleDao userCollectClinicalArticleDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
|
||||
|
||||
@Resource
|
||||
private UserCollectClinicalVideoDao userCollectClinicalVideoDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalVideoAuthorDao caseClinicalVideoAuthorDao;
|
||||
|
||||
@Resource
|
||||
private UserCollectExchangeDao userCollectExchangeDao;
|
||||
|
||||
// // 查询所有用户
|
||||
// @GetMapping("/users")
|
||||
// public Response<Map<String, Object>> getUserPage(@Validated({UserRequest.Page.class}) @ModelAttribute UserRequest request) {
|
||||
@@ -106,10 +119,158 @@ public class UserController extends BaseController {
|
||||
return Response.success(g);
|
||||
}
|
||||
|
||||
// 用户参与-病例交流
|
||||
/**
|
||||
* 收藏记录-搜索-分页
|
||||
*/
|
||||
@PostMapping("/user/collect/search")
|
||||
public Response<Map<String, Object>> getUserCollectSearchPage(
|
||||
@Validated()
|
||||
@RequestBody getUserCollectSearchPage request
|
||||
) {
|
||||
String userId = (String) httpServletRequest.getAttribute("userId");
|
||||
|
||||
// 用户参与-文章病例库
|
||||
// 用户参与-视频病例库
|
||||
// 收藏搜索-分页
|
||||
// 浏览列表-分页
|
||||
request.validateForPage();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
if (request.getType() == 1){
|
||||
// 文章
|
||||
Page<UserCollectClinicalArticleDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取文章数据
|
||||
IPage<UserCollectClinicalArticleDto> resultPage = userCollectClinicalArticleDao.getUserCollectClinicalArticleSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
userId
|
||||
);
|
||||
|
||||
for (UserCollectClinicalArticleDto dto : resultPage.getRecords()) {
|
||||
UserCollectClinicalArticleDto.DataDto data = dto.getData();
|
||||
List<UserCollectClinicalArticleDto.DataAuthorDto> dataAuthors = new ArrayList<>();
|
||||
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, dto.getId());
|
||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||
UserCollectClinicalArticleDto.DataAuthorDto dataAuthor = new UserCollectClinicalArticleDto.DataAuthorDto();
|
||||
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
// // 获取当前用户所属医院
|
||||
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
// if (basicHospital == null) {
|
||||
// return Response.error();
|
||||
// }
|
||||
|
||||
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||
// dataAuthor.setHospitalName(basicHospital.getHospitalName());
|
||||
|
||||
dataAuthors.add(dataAuthor);
|
||||
}
|
||||
|
||||
data.setAuthor(dataAuthors);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
}else if (request.getType() == 2){
|
||||
// 视频
|
||||
Page<UserCollectClinicalVideoDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取文章数据
|
||||
IPage<UserCollectClinicalVideoDto> resultPage = userCollectClinicalVideoDao.getUserCollectClinicalVideoSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
userId
|
||||
);
|
||||
|
||||
for (UserCollectClinicalVideoDto dto : resultPage.getRecords()) {
|
||||
UserCollectClinicalVideoDto.DataDto data = dto.getData();
|
||||
List<UserCollectClinicalVideoDto.DataAuthorDto> dataAuthors = new ArrayList<>();
|
||||
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, dto.getId());
|
||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||
UserCollectClinicalVideoDto.DataAuthorDto dataAuthor = new UserCollectClinicalVideoDto.DataAuthorDto();
|
||||
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
// // 获取当前用户所属医院
|
||||
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
// if (basicHospital == null) {
|
||||
// return Response.error();
|
||||
// }
|
||||
|
||||
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||
// dataAuthor.setHospitalName(basicHospital.getHospitalName());
|
||||
|
||||
dataAuthors.add(dataAuthor);
|
||||
}
|
||||
|
||||
data.setAuthor(dataAuthors);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
} else if (request.getType() == 3) {
|
||||
// 病例交流
|
||||
Page<UserCollectExchangeDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取文章数据
|
||||
IPage<UserCollectExchangeDto> resultPage = userCollectExchangeDao.getUserCollectExchangeSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
userId
|
||||
);
|
||||
|
||||
for (UserCollectExchangeDto dto : resultPage.getRecords()) {
|
||||
UserCollectExchangeDto.DataDto data = dto.getData();
|
||||
List<UserCollectExchangeDto.DataAuthorDto> dataAuthors = new ArrayList<>();
|
||||
|
||||
UserModel user = userDao.selectById(Long.valueOf(userId));
|
||||
if (user == null) {
|
||||
return Response.error();
|
||||
}
|
||||
|
||||
// 获取当前用户所属医院
|
||||
BasicHospitalModel basicHospital = basicHospitalDao.selectById(user.getHospitalId());
|
||||
if (basicHospital == null) {
|
||||
return Response.error();
|
||||
}
|
||||
|
||||
UserCollectExchangeDto.DataAuthorDto dataAuthor = new UserCollectExchangeDto.DataAuthorDto();
|
||||
dataAuthor.setDoctorName(user.getUserName());
|
||||
dataAuthor.setHospitalName(basicHospital.getHospitalName());
|
||||
dataAuthors.add(dataAuthor);
|
||||
|
||||
data.setAuthor(dataAuthors);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
}else{
|
||||
return Response.error();
|
||||
}
|
||||
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
|
||||
// 浏览记录-搜索-分页
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseReadModel;
|
||||
import com.example.caseData.model.UserModel;
|
||||
|
||||
public interface CaseReadDao extends BaseMapper<CaseReadModel> {
|
||||
}
|
||||
@@ -1,7 +1,27 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||
import com.example.caseData.model.UserCollectClinicalArticleModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserCollectClinicalArticleDao extends BaseMapper<UserCollectClinicalArticleModel> {
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* @param page 分页数据
|
||||
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||
*/
|
||||
IPage<UserCollectClinicalArticleDto> getUserCollectClinicalArticleSearchPage(
|
||||
Page<?> page,
|
||||
@Param("keyword") String keyword,
|
||||
@Param("hospitalId") String hospitalId,
|
||||
@Param("doctorId") String doctorId,
|
||||
@Param("userId") String userId
|
||||
);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,24 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||
import com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto;
|
||||
import com.example.caseData.model.UserCollectClinicalVideoModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface UserCollectClinicalVideoDao extends BaseMapper<UserCollectClinicalVideoModel> {
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* @param page 分页数据
|
||||
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||
*/
|
||||
IPage<UserCollectClinicalVideoDto> getUserCollectClinicalVideoSearchPage(
|
||||
Page<?> page,
|
||||
@Param("keyword") String keyword,
|
||||
@Param("hospitalId") String hospitalId,
|
||||
@Param("doctorId") String doctorId,
|
||||
@Param("userId") String userId
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,27 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||
import com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto;
|
||||
import com.example.caseData.model.CaseExchangeModel;
|
||||
import com.example.caseData.model.UserCollectExchangeModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface UserCollectExchangeDao extends BaseMapper<UserCollectExchangeModel> {
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* @param page 分页数据
|
||||
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||
*/
|
||||
IPage<UserCollectExchangeDto> getUserCollectExchangeSearchPage(
|
||||
Page<?> page,
|
||||
@Param("keyword") String keyword,
|
||||
@Param("hospitalId") String hospitalId,
|
||||
@Param("doctorId") String doctorId,
|
||||
@Param("userId") String userId
|
||||
);
|
||||
}
|
||||
|
||||
+72
-6
@@ -1,8 +1,14 @@
|
||||
package com.example.caseData.dto.userCollectClinicalArticle;
|
||||
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||
import com.example.caseData.request.caseExchangeRequest.addCaseExchange;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserCollectClinicalArticleDto {
|
||||
@@ -10,19 +16,19 @@ public class UserCollectClinicalArticleDto {
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("collect_id")
|
||||
private Long collectId;
|
||||
private String collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
* 对应的id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private Long articleId;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
@@ -35,4 +41,64 @@ public class UserCollectClinicalArticleDto {
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private DataDto data;
|
||||
|
||||
@Data
|
||||
public static class DataDto {
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<DataAuthorDto> author;
|
||||
}
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@Data
|
||||
public static class DataAuthorDto {
|
||||
/**
|
||||
* 医生名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
}
|
||||
}
|
||||
+67
-5
@@ -1,8 +1,10 @@
|
||||
package com.example.caseData.dto.userCollectClinicalVideo;
|
||||
|
||||
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserCollectClinicalVideoDto {
|
||||
@@ -10,19 +12,19 @@ public class UserCollectClinicalVideoDto {
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("collect_id")
|
||||
private Long collectId;
|
||||
private String collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
* 对应的id
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private Long videoId;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
@@ -35,4 +37,64 @@ public class UserCollectClinicalVideoDto {
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private UserCollectClinicalVideoDto.DataDto data;
|
||||
|
||||
@Data
|
||||
public static class DataDto {
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<UserCollectClinicalVideoDto.DataAuthorDto> author;
|
||||
}
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@Data
|
||||
public static class DataAuthorDto {
|
||||
/**
|
||||
* 医生名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.example.caseData.dto.userCollectExchange;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserCollectExchangeDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("collect_id")
|
||||
private String collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 对应的id
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private DataDto data;
|
||||
|
||||
@Data
|
||||
public static class DataDto {
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<DataAuthorDto> author;
|
||||
}
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@Data
|
||||
public static class DataAuthorDto {
|
||||
/**
|
||||
* 医生名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 病例-阅读记录实体类
|
||||
*/
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_read`") // 指定数据库表名
|
||||
public class CaseReadModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long readId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 关联id(可能为文章/视频/病例交流)
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型(1:文章 2:视频 3:病例交流)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 阅读次数
|
||||
*/
|
||||
@TableField("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
+2
@@ -4,6 +4,7 @@ package com.example.caseData.request.CaseClinicalArticleRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -30,6 +31,7 @@ public class getClinicalArticleCommentPage {
|
||||
private String rootId;
|
||||
|
||||
// 是否需要子评论(0:否 1:是)
|
||||
@NotNull(message = "错误")
|
||||
@JsonProperty("is_have_sub_comment")
|
||||
private Integer isHaveSubComment;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.example.caseData.request;
|
||||
package com.example.caseData.request.UserRequest;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.example.caseData.request.UserRequest;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class getUserCollectSearchPage {
|
||||
// ✅ 分页参数
|
||||
@Min(value = 1,message = "页码最小为 1")
|
||||
private Integer page = 1;
|
||||
|
||||
@JsonProperty("page_size")
|
||||
@Min(value = 1, message = "每页个数最小为 1")
|
||||
private Integer pageSize = 20;
|
||||
|
||||
// 类型(1:文章 2:视频 3:病例交流)
|
||||
@NotNull(message = "错误")
|
||||
@JsonProperty("type")
|
||||
private Integer type;
|
||||
|
||||
// 标题/作者名称/疾病名称
|
||||
@JsonProperty("keyword")
|
||||
private String keyword;
|
||||
|
||||
// 医院id
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId;
|
||||
|
||||
// 医生id
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
// ✅ 校验分页参数
|
||||
public void validateForPage() {
|
||||
// 如果 page 为空,设为默认值 1
|
||||
if (page == null) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
if (pageSize == null) {
|
||||
pageSize = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user