新增我的收藏
This commit is contained in:
parent
003c4eea74
commit
25d03491be
@ -1,17 +1,10 @@
|
|||||||
package com.example.caseData.controller;
|
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.common.Response;
|
||||||
import com.example.caseData.dao.UserDao;
|
|
||||||
import com.example.caseData.dto.PublicDto;
|
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.PublicRequest;
|
||||||
import com.example.caseData.request.UserRequest;
|
|
||||||
import com.example.caseData.service.UserService;
|
import com.example.caseData.service.UserService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +1,25 @@
|
|||||||
package com.example.caseData.controller;
|
package com.example.caseData.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.example.caseData.common.Response;
|
import com.example.caseData.common.Response;
|
||||||
import com.example.caseData.dao.BasicHospitalDao;
|
import com.example.caseData.dao.*;
|
||||||
import com.example.caseData.dao.CaseClinicalDoctorDao;
|
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||||
import com.example.caseData.dao.UserDao;
|
|
||||||
import com.example.caseData.dto.user.UserDto;
|
import com.example.caseData.dto.user.UserDto;
|
||||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||||
import com.example.caseData.dto.user.UserDto;
|
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||||
import com.example.caseData.model.BasicHospitalModel;
|
import com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto;
|
||||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
import com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto;
|
||||||
import com.example.caseData.model.UserModel;
|
import com.example.caseData.model.*;
|
||||||
import com.example.caseData.request.UserRequest;
|
import com.example.caseData.request.UserRequest.UserRequest;
|
||||||
|
import com.example.caseData.request.UserRequest.getUserCollectSearchPage;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -41,6 +39,21 @@ public class UserController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
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")
|
// @GetMapping("/users")
|
||||||
// public Response<Map<String, Object>> getUserPage(@Validated({UserRequest.Page.class}) @ModelAttribute UserRequest request) {
|
// 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);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 浏览记录-搜索-分页
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/main/java/com/example/caseData/dao/CaseReadDao.java
Normal file
8
src/main/java/com/example/caseData/dao/CaseReadDao.java
Normal file
@ -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;
|
package com.example.caseData.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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 com.example.caseData.model.UserCollectClinicalArticleModel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface UserCollectClinicalArticleDao extends BaseMapper<UserCollectClinicalArticleModel> {
|
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;
|
package com.example.caseData.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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 com.example.caseData.model.UserCollectClinicalVideoModel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface UserCollectClinicalVideoDao extends BaseMapper<UserCollectClinicalVideoModel> {
|
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;
|
package com.example.caseData.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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.CaseExchangeModel;
|
||||||
import com.example.caseData.model.UserCollectExchangeModel;
|
import com.example.caseData.model.UserCollectExchangeModel;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface UserCollectExchangeDao extends BaseMapper<UserCollectExchangeModel> {
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
package com.example.caseData.dto.userCollectClinicalArticle;
|
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 com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserCollectClinicalArticleDto {
|
public class UserCollectClinicalArticleDto {
|
||||||
@ -10,19 +16,19 @@ public class UserCollectClinicalArticleDto {
|
|||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("collect_id")
|
@JsonProperty("collect_id")
|
||||||
private Long collectId;
|
private String collectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("user_id")
|
@JsonProperty("user_id")
|
||||||
private Long userId;
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 临床文章id
|
* 对应的id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("article_id")
|
@JsonProperty("id")
|
||||||
private Long articleId;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
@ -35,4 +41,64 @@ public class UserCollectClinicalArticleDto {
|
|||||||
*/
|
*/
|
||||||
@JsonProperty("updated_at")
|
@JsonProperty("updated_at")
|
||||||
private LocalDateTime updatedAt;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,10 @@
|
|||||||
package com.example.caseData.dto.userCollectClinicalVideo;
|
package com.example.caseData.dto.userCollectClinicalVideo;
|
||||||
|
|
||||||
|
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserCollectClinicalVideoDto {
|
public class UserCollectClinicalVideoDto {
|
||||||
@ -10,19 +12,19 @@ public class UserCollectClinicalVideoDto {
|
|||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("collect_id")
|
@JsonProperty("collect_id")
|
||||||
private Long collectId;
|
private String collectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("user_id")
|
@JsonProperty("user_id")
|
||||||
private Long userId;
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 临床视频id
|
* 对应的id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("video_id")
|
@JsonProperty("id")
|
||||||
private Long videoId;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
@ -35,4 +37,64 @@ public class UserCollectClinicalVideoDto {
|
|||||||
*/
|
*/
|
||||||
@JsonProperty("updated_at")
|
@JsonProperty("updated_at")
|
||||||
private LocalDateTime updatedAt;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
src/main/java/com/example/caseData/model/CaseReadModel.java
Normal file
56
src/main/java/com/example/caseData/model/CaseReadModel.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ package com.example.caseData.request.CaseClinicalArticleRequest;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import jakarta.validation.constraints.Min;
|
import jakarta.validation.constraints.Min;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ public class getClinicalArticleCommentPage {
|
|||||||
private String rootId;
|
private String rootId;
|
||||||
|
|
||||||
// 是否需要子评论(0:否 1:是)
|
// 是否需要子评论(0:否 1:是)
|
||||||
|
@NotNull(message = "错误")
|
||||||
@JsonProperty("is_have_sub_comment")
|
@JsonProperty("is_have_sub_comment")
|
||||||
private Integer isHaveSubComment;
|
private Integer isHaveSubComment;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.example.caseData.request;
|
package com.example.caseData.request.UserRequest;
|
||||||
|
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import lombok.Data;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,12 +10,46 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getCaseClinicalArticleSearchPage" resultType="com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto">
|
<select id="getCaseClinicalArticleSearchPage" resultType="com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto">
|
||||||
SELECT DISTINCT
|
<!-- SELECT DISTINCT-->
|
||||||
|
<!-- a.article_id,-->
|
||||||
|
<!-- a.article_title,-->
|
||||||
|
<!-- a.read_num,-->
|
||||||
|
<!-- a.collect_num,-->
|
||||||
|
<!-- a.push_date-->
|
||||||
|
<!-- FROM case_clinical_article a-->
|
||||||
|
<!-- LEFT JOIN case_clinical_article_author caa ON a.article_id = caa.article_id-->
|
||||||
|
<!-- LEFT JOIN case_clinical_doctor d ON caa.doctor_id = d.doctor_id-->
|
||||||
|
<!-- LEFT JOIN case_clinical_article_label l ON a.article_id = l.article_id-->
|
||||||
|
<!-- WHERE a.article_status = 1-->
|
||||||
|
<!-- <if test="keyword != null and keyword != ''">-->
|
||||||
|
<!-- AND (-->
|
||||||
|
<!-- a.article_title LIKE CONCAT('%', #{keyword}, '%')-->
|
||||||
|
<!-- OR d.doctor_name LIKE CONCAT('%', #{keyword}, '%')-->
|
||||||
|
<!-- OR l.label_name LIKE CONCAT('%', #{keyword}, '%')-->
|
||||||
|
<!-- )-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="hospitalId != null and hospitalId != ''">-->
|
||||||
|
<!-- AND d.hospital_id = ${hospitalId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="doctorId != null and doctorId != ''">-->
|
||||||
|
<!-- AND d.doctor_id = ${doctorId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="order != null and !order.isEmpty()">-->
|
||||||
|
<!-- ORDER BY-->
|
||||||
|
<!-- <foreach item="entry" index="key" collection="order" separator=",">-->
|
||||||
|
<!-- ${key} ${entry}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- </if>-->
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
a.article_id,
|
a.article_id,
|
||||||
a.article_title,
|
a.article_title,
|
||||||
a.read_num,
|
a.read_num,
|
||||||
a.collect_num,
|
a.collect_num,
|
||||||
a.push_date
|
a.push_date
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT a.article_id
|
||||||
FROM case_clinical_article a
|
FROM case_clinical_article a
|
||||||
LEFT JOIN case_clinical_article_author caa ON a.article_id = caa.article_id
|
LEFT JOIN case_clinical_article_author caa ON a.article_id = caa.article_id
|
||||||
LEFT JOIN case_clinical_doctor d ON caa.doctor_id = d.doctor_id
|
LEFT JOIN case_clinical_doctor d ON caa.doctor_id = d.doctor_id
|
||||||
@ -34,6 +68,8 @@
|
|||||||
<if test="doctorId != null and doctorId != ''">
|
<if test="doctorId != null and doctorId != ''">
|
||||||
AND d.doctor_id = ${doctorId}
|
AND d.doctor_id = ${doctorId}
|
||||||
</if>
|
</if>
|
||||||
|
) AS result
|
||||||
|
JOIN case_clinical_article a ON a.article_id = result.article_id
|
||||||
<if test="order != null and !order.isEmpty()">
|
<if test="order != null and !order.isEmpty()">
|
||||||
ORDER BY
|
ORDER BY
|
||||||
<foreach item="entry" index="key" collection="order" separator=",">
|
<foreach item="entry" index="key" collection="order" separator=",">
|
||||||
|
|||||||
@ -1,5 +1,57 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.example.caseData.dao.UserCollectClinicalArticleDao">
|
<mapper namespace="com.example.caseData.dao.UserCollectClinicalArticleDao">
|
||||||
|
<resultMap id="UserCollectClinicalArticleMap" type="com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto">
|
||||||
|
<id property="collectId" column="collect_id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="id" column="article_id"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
|
||||||
|
<association property="data"
|
||||||
|
javaType="com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto$DataDto">
|
||||||
|
<id property="id" column="article_id"/>
|
||||||
|
<result property="title" column="article_title"/>
|
||||||
|
<result property="readNum" column="read_num"/>
|
||||||
|
<result property="collectNum" column="collect_num"/>
|
||||||
|
<result property="pushDate" column="push_date"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getUserCollectClinicalArticleSearchPage" resultMap="UserCollectClinicalArticleMap">
|
||||||
|
SELECT
|
||||||
|
uc.collect_id,
|
||||||
|
uc.user_id,
|
||||||
|
a.article_id,
|
||||||
|
a.article_title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_collect_clinical_article uc
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT a.article_id
|
||||||
|
FROM case_clinical_article a
|
||||||
|
LEFT JOIN case_clinical_article_author caa ON a.article_id = caa.article_id
|
||||||
|
LEFT JOIN case_clinical_doctor d ON caa.doctor_id = d.doctor_id
|
||||||
|
LEFT JOIN case_clinical_article_label l ON a.article_id = l.article_id
|
||||||
|
WHERE a.article_status = 1
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (
|
||||||
|
a.article_title LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR d.doctor_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR l.label_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="hospitalId != null and hospitalId != ''">
|
||||||
|
AND d.hospital_id = ${hospitalId}
|
||||||
|
</if>
|
||||||
|
<if test="doctorId != null and doctorId != ''">
|
||||||
|
AND d.doctor_id = ${doctorId}
|
||||||
|
</if>
|
||||||
|
) AS filtered ON uc.article_id = filtered.article_id
|
||||||
|
JOIN case_clinical_article a ON uc.article_id = a.article_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.example.caseData.dao.UserCollectExchangeDao">
|
||||||
|
<resultMap id="UserCollectExchangeMap" type="com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto">
|
||||||
|
<id property="collectId" column="collect_id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="id" column="exchange_id"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
|
||||||
|
<association property="data"
|
||||||
|
javaType="com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto$DataDto">
|
||||||
|
<id property="id" column="exchange_id"/>
|
||||||
|
<result property="title" column="exchange_title"/>
|
||||||
|
<result property="readNum" column="read_num"/>
|
||||||
|
<result property="collectNum" column="collect_num"/>
|
||||||
|
<result property="pushDate" column="push_date"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getUserCollectExchangeSearchPage" resultMap="UserCollectExchangeMap">
|
||||||
|
SELECT
|
||||||
|
uc.collect_id,
|
||||||
|
uc.user_id,
|
||||||
|
a.exchange_id,
|
||||||
|
a.exchange_title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_collect_exchange uc
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT a.exchange_id
|
||||||
|
FROM case_exchange a
|
||||||
|
LEFT JOIN case_exchange_label b ON a.exchange_id = b.exchange_id
|
||||||
|
LEFT JOIN user c ON c.user_id = a.user_id
|
||||||
|
WHERE a.exchange_status = 1
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (
|
||||||
|
a.exchange_title LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR c.user_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR b.label_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
) AS filtered ON uc.exchange_id = filtered.exchange_id
|
||||||
|
JOIN case_exchange a ON uc.exchange_id = a.exchange_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -1,5 +1,57 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.example.caseData.dao.UserCollectClinicalVideoDao">
|
<mapper namespace="com.example.caseData.dao.UserCollectClinicalVideoDao">
|
||||||
|
<resultMap id="UserCollectClinicalVideoMap" type="com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto">
|
||||||
|
<id property="collectId" column="collect_id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="id" column="video_id"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
|
||||||
|
<association property="data"
|
||||||
|
javaType="com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto$DataDto">
|
||||||
|
<id property="id" column="video_id"/>
|
||||||
|
<result property="title" column="video_title"/>
|
||||||
|
<result property="readNum" column="read_num"/>
|
||||||
|
<result property="collectNum" column="collect_num"/>
|
||||||
|
<result property="pushDate" column="push_date"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getUserCollectClinicalVideoSearchPage" resultMap="UserCollectClinicalVideoMap">
|
||||||
|
SELECT
|
||||||
|
uc.collect_id,
|
||||||
|
uc.user_id,
|
||||||
|
a.video_id,
|
||||||
|
a.video_title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_collect_clinical_video uc
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT a.video_id
|
||||||
|
FROM case_clinical_video a
|
||||||
|
LEFT JOIN case_clinical_video_author caa ON a.video_id = caa.video_id
|
||||||
|
LEFT JOIN case_clinical_doctor d ON caa.doctor_id = d.doctor_id
|
||||||
|
LEFT JOIN case_clinical_video_label l ON a.video_id = l.video_id
|
||||||
|
WHERE a.video_status = 1
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (
|
||||||
|
a.video_title LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR d.doctor_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR l.label_name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="hospitalId != null and hospitalId != ''">
|
||||||
|
AND d.hospital_id = ${hospitalId}
|
||||||
|
</if>
|
||||||
|
<if test="doctorId != null and doctorId != ''">
|
||||||
|
AND d.doctor_id = ${doctorId}
|
||||||
|
</if>
|
||||||
|
) AS filtered ON uc.video_id = filtered.video_id
|
||||||
|
JOIN case_clinical_video a ON uc.video_id = a.video_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user