新增我的阅读记录
This commit is contained in:
parent
25d03491be
commit
6380b06140
@ -0,0 +1,193 @@
|
|||||||
|
package com.example.caseData.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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.*;
|
||||||
|
import com.example.caseData.dto.userCaseRead.UserCaseReadDto;
|
||||||
|
import com.example.caseData.dto.userCollectClinicalVideo.UserCollectClinicalVideoDto;
|
||||||
|
import com.example.caseData.dto.userCollectExchange.UserCollectExchangeDto;
|
||||||
|
import com.example.caseData.model.*;
|
||||||
|
import com.example.caseData.request.userCaseReadRequest.getUserCaseReadSearchPage;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
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.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class UserCaseReadController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private UserDao userDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BasicHospitalDao basicHospitalDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectClinicalArticleDao userCollectClinicalArticleDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectClinicalVideoDao userCollectClinicalVideoDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalVideoAuthorDao caseClinicalVideoAuthorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectExchangeDao userCollectExchangeDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCaseReadDao userCaseReadDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览记录-搜索-分页
|
||||||
|
*/
|
||||||
|
@PostMapping("/user/case/read/search")
|
||||||
|
public Response<Map<String, Object>> getUserCaseReadSearchPage(
|
||||||
|
@Validated()
|
||||||
|
@RequestBody getUserCaseReadSearchPage request
|
||||||
|
) {
|
||||||
|
String userId = (String) httpServletRequest.getAttribute("userId");
|
||||||
|
|
||||||
|
request.validateForPage();
|
||||||
|
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
|
if (request.getType() == 1){
|
||||||
|
// 文章
|
||||||
|
Page<UserCaseReadDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||||
|
|
||||||
|
// 获取文章数据
|
||||||
|
IPage<UserCaseReadDto> resultPage = userCaseReadDao.getUserCaseReadArticleSearchPage(
|
||||||
|
page,
|
||||||
|
request.getKeyword(),
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
|
||||||
|
for (UserCaseReadDto dto : resultPage.getRecords()) {
|
||||||
|
UserCaseReadDto.DataDto data = dto.getData();
|
||||||
|
List<UserCaseReadDto.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) {
|
||||||
|
UserCaseReadDto.DataAuthorDto dataAuthor = new UserCaseReadDto.DataAuthorDto();
|
||||||
|
|
||||||
|
// 查询医生
|
||||||
|
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||||
|
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||||
|
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,192 @@
|
|||||||
|
package com.example.caseData.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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.*;
|
||||||
|
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.userCollectRequest.getUserCollectSearchPage;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
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.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class UserCollectController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private UserDao userDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BasicHospitalDao basicHospitalDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectClinicalArticleDao userCollectClinicalArticleDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectClinicalVideoDao userCollectClinicalVideoDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalVideoAuthorDao caseClinicalVideoAuthorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCollectExchangeDao userCollectExchangeDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏记录-搜索-分页
|
||||||
|
*/
|
||||||
|
@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());
|
||||||
|
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
dataAuthor.setDoctorName(caseClinicalDoctor.getDoctorName());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,29 +1,16 @@
|
|||||||
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.metadata.IPage;
|
|
||||||
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.*;
|
import com.example.caseData.dao.*;
|
||||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
|
||||||
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.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.model.*;
|
||||||
import com.example.caseData.request.UserRequest.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.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api")
|
@RequestMapping("/api")
|
||||||
public class UserController extends BaseController {
|
public class UserController extends BaseController {
|
||||||
@ -54,6 +41,9 @@ public class UserController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserCollectExchangeDao userCollectExchangeDao;
|
private UserCollectExchangeDao userCollectExchangeDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserCaseReadDao userCaseReadDao;
|
||||||
|
|
||||||
// // 查询所有用户
|
// // 查询所有用户
|
||||||
// @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) {
|
||||||
@ -119,158 +109,6 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 浏览记录-搜索-分页
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
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> {
|
|
||||||
}
|
|
||||||
44
src/main/java/com/example/caseData/dao/UserCaseReadDao.java
Normal file
44
src/main/java/com/example/caseData/dao/UserCaseReadDao.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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.userCaseRead.UserCaseReadDto;
|
||||||
|
import com.example.caseData.dto.userCollectClinicalArticle.UserCollectClinicalArticleDto;
|
||||||
|
import com.example.caseData.model.UserCaseReadModel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface UserCaseReadDao extends BaseMapper<UserCaseReadModel> {
|
||||||
|
/**
|
||||||
|
* 用户阅读记录-搜索-文章
|
||||||
|
* @param page 分页数据
|
||||||
|
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||||
|
*/
|
||||||
|
IPage<UserCaseReadDto> getUserCaseReadArticleSearchPage(
|
||||||
|
Page<?> page,
|
||||||
|
@Param("keyword") String keyword,
|
||||||
|
@Param("userId") String userId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户阅读记录-搜索-视频
|
||||||
|
* @param page 分页数据
|
||||||
|
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||||
|
*/
|
||||||
|
IPage<UserCaseReadDto> getUserCaseReadVideoSearchPage(
|
||||||
|
Page<?> page,
|
||||||
|
@Param("keyword") String keyword,
|
||||||
|
@Param("userId") String userId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户阅读记录-搜索-病例交流
|
||||||
|
* @param page 分页数据
|
||||||
|
* @param keyword 搜索关键词-标题/医生名称/标签名称
|
||||||
|
*/
|
||||||
|
IPage<UserCaseReadDto> getUserCaseReadExchangeSearchPage(
|
||||||
|
Page<?> page,
|
||||||
|
@Param("keyword") String keyword,
|
||||||
|
@Param("userId") String userId
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.example.caseData.dto.userCaseRead;
|
||||||
|
|
||||||
|
|
||||||
|
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 UserCaseReadDto {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@JsonProperty("read_id")
|
||||||
|
private String readId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户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 UserCaseReadDto.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<UserCaseReadDto.DataAuthorDto> author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作者
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class DataAuthorDto {
|
||||||
|
/**
|
||||||
|
* 医生名称
|
||||||
|
*/
|
||||||
|
@JsonProperty("doctor_name")
|
||||||
|
private String doctorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医院名称
|
||||||
|
*/
|
||||||
|
@JsonProperty("hospital_name")
|
||||||
|
private String hospitalName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,8 +10,8 @@ import java.time.LocalDateTime;
|
|||||||
* 病例-阅读记录实体类
|
* 病例-阅读记录实体类
|
||||||
*/
|
*/
|
||||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||||
@TableName("`case_read`") // 指定数据库表名
|
@TableName("`user_case_read`") // 指定数据库表名
|
||||||
public class CaseReadModel {
|
public class UserCaseReadModel {
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.example.caseData.request.userCaseReadRequest;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class getUserCaseReadSearchPage {
|
||||||
|
// ✅ 分页参数
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +1,9 @@
|
|||||||
package com.example.caseData.request.UserRequest;
|
package com.example.caseData.request.userCollectRequest;
|
||||||
|
|
||||||
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.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class getUserCollectSearchPage {
|
public class getUserCollectSearchPage {
|
||||||
@ -2,25 +2,30 @@
|
|||||||
<!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.CaseExchangeDao">
|
<mapper namespace="com.example.caseData.dao.CaseExchangeDao">
|
||||||
<select id="getCaseExchangeSearchPage" resultType="com.example.caseData.dto.caseExchange.CaseExchangeDto">
|
<select id="getCaseExchangeSearchPage" resultType="com.example.caseData.dto.caseExchange.CaseExchangeDto">
|
||||||
SELECT DISTINCT
|
SELECT
|
||||||
a.*,
|
a.*,
|
||||||
c.user_name,
|
c.user_name,
|
||||||
c.avatar,
|
c.avatar,
|
||||||
c.hospital_id
|
c.hospital_id
|
||||||
FROM case_exchange a
|
FROM (
|
||||||
LEFT JOIN case_exchange_label b ON a.exchange_id = b.exchange_id
|
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>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND c.user_id = ${userId}
|
||||||
|
</if>
|
||||||
|
) AS result
|
||||||
|
JOIN case_exchange a ON result.exchange_id = a.exchange_id
|
||||||
LEFT JOIN user c ON c.user_id = a.user_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>
|
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
AND c.user_id = ${userId}
|
|
||||||
</if>
|
|
||||||
<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=",">
|
||||||
|
|||||||
118
src/main/resources/mapper/UserCaseReadMapper.xml
Normal file
118
src/main/resources/mapper/UserCaseReadMapper.xml
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?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.UserCaseReadDao">
|
||||||
|
<resultMap id="UserCaseReadMap" type="com.example.caseData.dto.userCaseRead.UserCaseReadDto">
|
||||||
|
<id property="readId" column="read_id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
|
||||||
|
<association property="data"
|
||||||
|
javaType="com.example.caseData.dto.userCaseRead.UserCaseReadDto$DataDto">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="title" column="title"/>
|
||||||
|
<result property="readNum" column="read_num"/>
|
||||||
|
<result property="collectNum" column="collect_num"/>
|
||||||
|
<result property="pushDate" column="push_date"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getUserCaseReadArticleSearchPage" resultMap="UserCaseReadMap">
|
||||||
|
SELECT
|
||||||
|
uc.read_id,
|
||||||
|
uc.user_id,
|
||||||
|
uc.id,
|
||||||
|
a.article_id,
|
||||||
|
a.article_title as title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_case_read 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>
|
||||||
|
) AS filtered ON uc.id = filtered.article_id
|
||||||
|
JOIN case_clinical_article a ON uc.id = a.article_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
AND uc.type = 1
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getUserCaseReadVideoSearchPage" resultMap="UserCaseReadMap">
|
||||||
|
SELECT
|
||||||
|
uc.read_id,
|
||||||
|
uc.user_id,
|
||||||
|
uc.id,
|
||||||
|
a.video_id,
|
||||||
|
a.video_title as title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_case_read 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>
|
||||||
|
) AS filtered ON uc.id = filtered.video_id
|
||||||
|
JOIN case_clinical_article a ON uc.id = a.video_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
AND uc.type = 2
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getUserCaseReadExchangeSearchPage" resultMap="UserCaseReadMap">
|
||||||
|
SELECT
|
||||||
|
uc.read_id,
|
||||||
|
uc.user_id,
|
||||||
|
uc.id,
|
||||||
|
a.exchange_id,
|
||||||
|
a.exchange_title as title,
|
||||||
|
a.read_num,
|
||||||
|
a.collect_num,
|
||||||
|
a.push_date,
|
||||||
|
uc.created_at
|
||||||
|
FROM user_case_read 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.id = filtered.exchange_id
|
||||||
|
JOIN case_exchange a ON uc.id = a.exchange_id
|
||||||
|
WHERE uc.user_id = #{userId}
|
||||||
|
AND uc.type = 3
|
||||||
|
ORDER BY uc.created_at desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user