评论的点赞点踩操作
parent
3f768d1f2f
commit
00a34fc36a
|
@ -77,4 +77,12 @@ public class Review {
|
|||
* 是否采纳
|
||||
*/
|
||||
private Integer isAdopted;
|
||||
/**
|
||||
* 点赞状态
|
||||
*/
|
||||
private Integer approveState;
|
||||
/**
|
||||
* 点踩状态
|
||||
*/
|
||||
private Integer disapproveState;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.february.patient.circle.domain;
|
|||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
@ -21,6 +22,14 @@ public class User {
|
|||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 邮箱账号
|
||||
*/
|
||||
private String userEmail;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
// /**
|
||||
// * 用户邮箱
|
||||
// */
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.february.patient.circle.domain.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description:
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:25
|
||||
**/
|
||||
@Data
|
||||
public class UserLoginRequest {
|
||||
/**
|
||||
* 邮箱账号
|
||||
*/
|
||||
private String userEmail;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.february.patient.circle.domain.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description: 科室及症状
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-22 15:56
|
||||
**/
|
||||
@Data
|
||||
public class DiseaseDetailName {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer diseaseId;
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String diseaseName;
|
||||
/**
|
||||
* 病症名称
|
||||
*/
|
||||
private String diseaseDetailName;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.february.patient.circle.domain.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description:
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:27
|
||||
**/
|
||||
@Data
|
||||
public class UserLoginResponse {
|
||||
/**
|
||||
* token令牌
|
||||
*/
|
||||
private String token;
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private String expireTime;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.february.patient.circle.domain.response;
|
||||
|
||||
import com.february.patient.circle.domain.User;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description: 用户详细信息
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-22 16:17
|
||||
**/
|
||||
@Data
|
||||
public class UserResponse extends User {
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String roleName;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.february.patient.circle.controller;
|
||||
|
||||
import com.february.patient.circle.domain.User;
|
||||
import com.february.patient.circle.domain.request.UserLoginRequest;
|
||||
import com.february.patient.circle.domain.response.UserLoginResponse;
|
||||
import com.february.patient.circle.domain.response.UserResponse;
|
||||
import com.february.patient.circle.result.Result;
|
||||
import com.february.patient.circle.service.AuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description: 登录控制层
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:04
|
||||
**/
|
||||
@RestController
|
||||
public class AuthController {
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
|
||||
/**
|
||||
* 根据邮箱账号查询用户信息
|
||||
* @param userEmail
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/loginByUserEmail")
|
||||
public Result<User> loginByUserEmail(@RequestParam String userEmail){
|
||||
return authService.loginByUserEmail(userEmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录操作
|
||||
* @param userLoginRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public Result<UserLoginResponse> login(@RequestBody UserLoginRequest userLoginRequest){
|
||||
return authService.login(userLoginRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户详细信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public Result<User> Info(){
|
||||
return authService.Info();
|
||||
}
|
||||
}
|
|
@ -5,6 +5,9 @@ import com.february.patient.circle.domain.*;
|
|||
import com.february.patient.circle.domain.request.PatientCircleRequest;
|
||||
import com.february.patient.circle.domain.request.PatientRequest;
|
||||
import com.february.patient.circle.domain.request.ReviewPatientRequest;
|
||||
import com.february.patient.circle.domain.response.DiseaseDetailName;
|
||||
import com.february.patient.circle.domain.response.DiseaseName;
|
||||
import com.february.patient.circle.domain.response.UserResponse;
|
||||
import com.february.patient.circle.result.Result;
|
||||
import com.february.patient.circle.service.PatientService;
|
||||
import io.swagger.models.auth.In;
|
||||
|
@ -157,7 +160,108 @@ public class PatientController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/findDiseaseName")
|
||||
public Result<List<Disease>> findDiseaseName(){
|
||||
public Result<List<DiseaseName>> findDiseaseName(){
|
||||
return patientService.findDiseaseName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询病症及对应科室
|
||||
* @param diseaseId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findDisease")
|
||||
public Result<List<DiseaseDetailName>> findDiseaseDetailName(@RequestParam Integer diseaseId){
|
||||
return patientService.findDiseaseDetailName(diseaseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询治疗经历
|
||||
* @param diseaseProcessId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findDiseaseProcess")
|
||||
public Result<List<DiseaseProcess>> findDiseaseProcess(@RequestParam Integer diseaseProcessId){
|
||||
return patientService.findDiseaseProcess(diseaseProcessId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加经历
|
||||
* @param diseaseProcess
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addDiseaseProcess")
|
||||
public Result addDiseaseProcess(@RequestBody DiseaseProcess diseaseProcess){
|
||||
return patientService.addDiseaseProcess(diseaseProcess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findUser")
|
||||
public Result<UserResponse> findUser(@RequestParam Integer userId){
|
||||
return patientService.findUser(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看评论列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/reviewList")
|
||||
public Result<List<Review>> reviewList(){
|
||||
return patientService.reviewList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 被采纳的评论
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("findAdoptReview")
|
||||
public Result<List<Review>> findAdoptReview(){
|
||||
return patientService.findAdoptReview();
|
||||
}
|
||||
/**
|
||||
* 病友圈详情列表
|
||||
*/
|
||||
@GetMapping("/patientCircleList")
|
||||
public Result<List<PatientCircle>> patientCircleList(){
|
||||
return patientService.patientCircleList();
|
||||
}
|
||||
/**
|
||||
* 写评论
|
||||
*/
|
||||
@PostMapping("/addReview")
|
||||
public Result addReview(@RequestBody Review review){
|
||||
return patientService.addReview(review);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据评论id查询评论信息
|
||||
* @param reviewId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findByReviewId")
|
||||
public Result<Review> findByReviewId(@RequestParam Integer reviewId){
|
||||
return patientService.findByReviewId(reviewId);
|
||||
}
|
||||
/**
|
||||
* 评论点赞操作
|
||||
* @param reviewId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/upvote")
|
||||
public Result upvote(@RequestParam Integer reviewId){
|
||||
return patientService.upvote(reviewId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论点踩操作
|
||||
* @param reviewId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/taunt")
|
||||
public Result taunt(@RequestParam Integer reviewId){
|
||||
return patientService.taunt(reviewId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.february.patient.circle.mapper;
|
||||
|
||||
import com.february.patient.circle.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description:
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:04
|
||||
**/
|
||||
@Mapper
|
||||
public interface AuthMapper {
|
||||
User loginByUserEmail(@Param("userEmail") String userEmail);
|
||||
}
|
|
@ -5,6 +5,9 @@ import com.february.patient.circle.domain.*;
|
|||
import com.february.patient.circle.domain.request.PatientCircleRequest;
|
||||
import com.february.patient.circle.domain.request.PatientRequest;
|
||||
import com.february.patient.circle.domain.request.ReviewPatientRequest;
|
||||
import com.february.patient.circle.domain.response.DiseaseDetailName;
|
||||
import com.february.patient.circle.domain.response.DiseaseName;
|
||||
import com.february.patient.circle.domain.response.UserResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -18,7 +21,35 @@ import java.util.List;
|
|||
**/
|
||||
@Mapper
|
||||
public interface PatientMapper {
|
||||
List<Disease> findDiseaseName();
|
||||
List<DiseaseName> findDiseaseName();
|
||||
|
||||
List<DiseaseDetailName> findDiseaseDetailName(@Param("diseaseId") Integer diseaseId);
|
||||
|
||||
List<DiseaseProcess> findDiseaseProcess(@Param("diseaseProcessId") Integer diseaseProcessId);
|
||||
|
||||
UserResponse findUser(@Param("userId") Integer userId);
|
||||
|
||||
List<Review> reviewList();
|
||||
|
||||
List<Review> findAdoptReview();
|
||||
|
||||
Integer addDiseaseProcess(DiseaseProcess diseaseProcess);
|
||||
|
||||
List<PatientCircle> patientCircleList();
|
||||
|
||||
Integer addReview(Review review);
|
||||
|
||||
Review findByReviewId(@Param("reviewId") Integer reviewId);
|
||||
|
||||
Integer upvote(@Param("reviewId") Integer reviewId);
|
||||
|
||||
void disUpvote(@Param("reviewId") Integer reviewId);
|
||||
|
||||
Integer taunt(@Param("reviewId") Integer reviewId);
|
||||
|
||||
void disTaunt(@Param("reviewId") Integer reviewId);
|
||||
|
||||
|
||||
// List<PatientCircle> patientCircleList(@Param("diseaseId") Integer diseaseId);
|
||||
//
|
||||
//
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.february.patient.circle.service;
|
||||
|
||||
import com.february.patient.circle.domain.User;
|
||||
import com.february.patient.circle.domain.request.UserLoginRequest;
|
||||
import com.february.patient.circle.domain.response.UserLoginResponse;
|
||||
import com.february.patient.circle.result.Result;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description:
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:05
|
||||
**/
|
||||
@Component
|
||||
public interface AuthService {
|
||||
Result<User> loginByUserEmail(String userEmail);
|
||||
|
||||
Result<UserLoginResponse> login(UserLoginRequest userLoginRequest);
|
||||
|
||||
Result<User> Info();
|
||||
}
|
|
@ -5,6 +5,9 @@ import com.february.patient.circle.domain.*;
|
|||
import com.february.patient.circle.domain.request.PatientCircleRequest;
|
||||
import com.february.patient.circle.domain.request.PatientRequest;
|
||||
import com.february.patient.circle.domain.request.ReviewPatientRequest;
|
||||
import com.february.patient.circle.domain.response.DiseaseDetailName;
|
||||
import com.february.patient.circle.domain.response.DiseaseName;
|
||||
import com.february.patient.circle.domain.response.UserResponse;
|
||||
import com.february.patient.circle.result.Result;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +23,29 @@ import java.util.List;
|
|||
**/
|
||||
@Component
|
||||
public interface PatientService {
|
||||
Result<List<Disease>> findDiseaseName();
|
||||
Result<List<DiseaseName>> findDiseaseName();
|
||||
|
||||
Result<List<DiseaseDetailName>> findDiseaseDetailName(Integer diseaseId);
|
||||
|
||||
Result<List<DiseaseProcess>> findDiseaseProcess(Integer diseaseProcessId);
|
||||
|
||||
Result<UserResponse> findUser(Integer userId);
|
||||
|
||||
Result<List<Review>> reviewList();
|
||||
|
||||
Result<List<Review>> findAdoptReview();
|
||||
|
||||
Result addDiseaseProcess(DiseaseProcess diseaseProcess);
|
||||
|
||||
Result<List<PatientCircle>> patientCircleList();
|
||||
|
||||
Result addReview(Review review);
|
||||
|
||||
Result upvote(Integer reviewId);
|
||||
|
||||
Result<Review> findByReviewId(Integer reviewId);
|
||||
|
||||
Result taunt(Integer reviewId);
|
||||
// Result<List<PatientCircle>> patientCircleList(Integer diseaseId);
|
||||
//
|
||||
// Result<List<PatientRequest>> patientList(String patientNickname);
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
package com.february.patient.circle.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.common.core.utils.JwtUtils;
|
||||
import com.february.common.core.utils.StringUtils;
|
||||
import com.february.common.core.utils.uuid.UUID;
|
||||
import com.february.patient.circle.constants.JwtConstants;
|
||||
import com.february.patient.circle.constants.TokenConstants;
|
||||
import com.february.patient.circle.domain.User;
|
||||
import com.february.patient.circle.domain.request.UserLoginRequest;
|
||||
import com.february.patient.circle.domain.response.UserLoginResponse;
|
||||
import com.february.patient.circle.mapper.AuthMapper;
|
||||
import com.february.patient.circle.result.Result;
|
||||
import com.february.patient.circle.service.AuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @program: february
|
||||
* @description:
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-10-23 09:05
|
||||
**/
|
||||
@Service
|
||||
public class AuthServiceImpl implements AuthService {
|
||||
@Autowired
|
||||
private AuthMapper authMapper;
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Override
|
||||
public Result<User> loginByUserEmail(String userEmail) {
|
||||
User user=authMapper.loginByUserEmail(userEmail);
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<UserLoginResponse> login(UserLoginRequest userLoginRequest) {
|
||||
if(StringUtils.isAnyBlank(userLoginRequest.getUserEmail(),userLoginRequest.getPassword())){
|
||||
return Result.error("请输入邮箱账号和密码");
|
||||
}
|
||||
User user = authMapper.loginByUserEmail(userLoginRequest.getUserEmail());
|
||||
if(null==user){
|
||||
return Result.error("该用户不存在");
|
||||
}
|
||||
String userKey = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put(JwtConstants.USER_KEY,userKey);
|
||||
map.put(JwtConstants.DETAILS_USER_ID,user.getUserId());
|
||||
String token = JwtUtils.createToken(map);
|
||||
redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey, JSONObject.toJSONString(user),15, TimeUnit.MINUTES);
|
||||
UserLoginResponse userLoginResponse = new UserLoginResponse();
|
||||
userLoginResponse.setExpireTime("15MIN");
|
||||
userLoginResponse.setToken(token);
|
||||
return Result.success(userLoginResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<User> Info() {
|
||||
String token = request.getHeader(TokenConstants.TOKEN);
|
||||
String userKey = JwtUtils.getUserKey(token);
|
||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY+userKey);
|
||||
User user = JSONObject.parseObject(s, User.class);
|
||||
return Result.success(user);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,12 @@
|
|||
package com.february.patient.circle.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.common.core.utils.JwtUtils;
|
||||
import com.february.patient.circle.constants.TokenConstants;
|
||||
import com.february.patient.circle.domain.response.DiseaseDetailName;
|
||||
import com.february.patient.circle.domain.response.DiseaseName;
|
||||
import com.february.patient.circle.domain.response.UserResponse;
|
||||
import com.february.patient.circle.mapper.AuthMapper;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import com.february.patient.circle.constants.JwtConstants;
|
||||
import com.february.patient.circle.domain.*;
|
||||
|
@ -14,9 +21,11 @@ import com.february.patient.circle.util.OssUtil;
|
|||
import io.swagger.models.auth.In;
|
||||
import lombok.Cleanup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,15 +39,110 @@ public class PatientServiceImpl implements PatientService {
|
|||
@Autowired
|
||||
private PatientMapper patientMapper;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
@Autowired
|
||||
private FastUtil fastUtil;
|
||||
@Autowired
|
||||
private OssUtil ossUtil;
|
||||
|
||||
@Override
|
||||
public Result<List<Disease>> findDiseaseName() {
|
||||
List<Disease> list=patientMapper.findDiseaseName();
|
||||
public Result<List<DiseaseName>> findDiseaseName() {
|
||||
List<DiseaseName> list=patientMapper.findDiseaseName();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<DiseaseDetailName>> findDiseaseDetailName(Integer diseaseId) {
|
||||
List<DiseaseDetailName> list=patientMapper.findDiseaseDetailName(diseaseId);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<DiseaseProcess>> findDiseaseProcess(Integer diseaseProcessId) {
|
||||
List<DiseaseProcess> list=patientMapper.findDiseaseProcess(diseaseProcessId);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<UserResponse> findUser(Integer userId) {
|
||||
UserResponse user=patientMapper.findUser(userId);
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Review>> reviewList() {
|
||||
List<Review> list=patientMapper.reviewList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Review>> findAdoptReview() {
|
||||
List<Review> list=patientMapper.findAdoptReview();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addDiseaseProcess(DiseaseProcess diseaseProcess) {
|
||||
Integer i=patientMapper.addDiseaseProcess(diseaseProcess);
|
||||
if(i>0){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.success("添加失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<PatientCircle>> patientCircleList() {
|
||||
List<PatientCircle> list=patientMapper.patientCircleList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addReview(Review review) {
|
||||
String token = request.getHeader(TokenConstants.TOKEN);
|
||||
String userKey = JwtUtils.getUserKey(token);
|
||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||
User user = JSONObject.parseObject(s, User.class);
|
||||
Integer userId = user.getUserId();
|
||||
review.setUserId(userId);
|
||||
Integer i=patientMapper.addReview(review);
|
||||
if(i>0){
|
||||
return Result.success("发表评论成功");
|
||||
}
|
||||
return Result.error("评论发表失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result upvote(Integer reviewId) {
|
||||
Review review = patientMapper.findByReviewId(reviewId);
|
||||
if(review.getApproveState()==0){
|
||||
Integer i=patientMapper.upvote(reviewId);
|
||||
if(i>0){
|
||||
return Result.success("点赞成功");
|
||||
}
|
||||
}
|
||||
patientMapper.disUpvote(reviewId);
|
||||
return Result.success("取消点赞操作成功");
|
||||
}
|
||||
@Override
|
||||
public Result<Review> findByReviewId(Integer reviewId) {
|
||||
Review review=patientMapper.findByReviewId(reviewId);
|
||||
return Result.success(review);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result taunt(Integer reviewId) {
|
||||
Review review = patientMapper.findByReviewId(reviewId);
|
||||
if(review.getDisapproveState()==0){
|
||||
Integer i=patientMapper.taunt(reviewId);
|
||||
if(i>0){
|
||||
return Result.success("点踩成功");
|
||||
}
|
||||
}
|
||||
patientMapper.disTaunt(reviewId);
|
||||
return Result.success("取消点踩");
|
||||
}
|
||||
// @Override
|
||||
// public Result<List<PatientCircle>> patientCircleList(Integer diseaseId) {
|
||||
// String diseaseName = findDiseaseName(diseaseId);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?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.february.patient.circle.mapper.AuthMapper">
|
||||
|
||||
|
||||
<select id="loginByUserEmail" resultType="com.february.patient.circle.domain.User">
|
||||
select * from tb_user where user_email=#{userEmail}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,28 @@
|
|||
<?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.february.patient.circle.mapper.PatientMapper">
|
||||
<!-- <insert id="addPatientCircle">-->
|
||||
<insert id="addDiseaseProcess">
|
||||
INSERT INTO `patient-circle`.`tb_disease_process` ( `hospital_name`, `start_time`, `end_time`, `disease_process`)
|
||||
VALUES ( #{hospitalName}, #{startTime}, #{endTime}, #{diseaseProcess})
|
||||
</insert>
|
||||
<insert id="addReview">
|
||||
INSERT INTO `patient-circle`.`tb_review` ( `avatar`,`user_id`,`review_detail`, `review_time`, `approve_num`, `disapprove_num`, `is_adopted`,`approve_state`,`disapprove_state`)
|
||||
VALUES ( #{avatar},#{userId},#{reviewDetail}, now(), 0, 0, 0,0,0)
|
||||
</insert>
|
||||
<update id="upvote">
|
||||
UPDATE `patient-circle`.`tb_review` SET `approve_num` = approve_num+1,`approve_state`=1 WHERE `review_id` = #{reviewId}
|
||||
</update>
|
||||
<update id="disUpvote">
|
||||
UPDATE `patient-circle`.`tb_review` SET `approve_num` = approve_num-1,`approve_state`=0 WHERE `review_id` = #{reviewId}
|
||||
</update>
|
||||
<update id="taunt">
|
||||
UPDATE `patient-circle`.`tb_review` SET `disapprove_num` = disapprove_num+1,`disapprove_state`=1 WHERE `review_id` = #{reviewId}
|
||||
</update>
|
||||
<update id="disTaunt">
|
||||
UPDATE `patient-circle`.`tb_review` SET `disapprove_num` = disapprove_num-1,`disapprove_state`=0 WHERE `review_id` = #{reviewId}
|
||||
</update>
|
||||
|
||||
<!-- <insert id="addPatientCircle">-->
|
||||
<!-- INSERT INTO `patient`.`t_patient_circle_log` (`patient_circle_title`, `disease_id`, `drug_id`, `patient_circle_detail`, `hospital`, `patient_circle_start_time`, `patient_circle_end_time`, `patient_circle_process`, `patient_circle_picture`) VALUES ( #{patientCircleTitle}, #{diseaseId}, #{drugId}, #{patientCircleDetail}, #{hospital}, #{patientCircleStartTime}, #{patientCircleEndTime}, #{patientCircleProcess}, #{patientCirclePicture})-->
|
||||
<!-- </insert>-->
|
||||
<!-- <insert id="patientToSick">-->
|
||||
|
@ -38,8 +59,30 @@
|
|||
<!-- select disease_name from t_disease where disease_id=#{diseaseId}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="findDiseaseName" resultType="com.february.patient.circle.domain.Disease">
|
||||
select disease_id,disease_name from tb_disease where disease_parent_id
|
||||
<select id="findDiseaseName" resultType="com.february.patient.circle.domain.response.DiseaseName">
|
||||
select disease_id,disease_name from tb_disease where disease_parent_id =0
|
||||
</select>
|
||||
<select id="findDiseaseDetailName"
|
||||
resultType="com.february.patient.circle.domain.response.DiseaseDetailName">
|
||||
SELECT s.disease_id,s.disease_name,s1.disease_name as disease_detail_name FROM tb_disease s LEFT JOIN tb_disease s1 on s1.disease_parent_id=s.disease_id WHERE s.disease_id=#{diseaseId}
|
||||
</select>
|
||||
<select id="findDiseaseProcess" resultType="com.february.patient.circle.domain.DiseaseProcess">
|
||||
SELECT * from tb_disease_process WHERE disease_process_id=#{diseaseProcessId}
|
||||
</select>
|
||||
<select id="findUser" resultType="com.february.patient.circle.domain.response.UserResponse">
|
||||
SELECT u.*,r.role_name as role_name from tb_user u LEFT JOIN tb_role r on u.role_id=r.role_id WHERE u.user_id=#{userId}
|
||||
</select>
|
||||
<select id="reviewList" resultType="com.february.patient.circle.domain.Review">
|
||||
select * from tb_review
|
||||
</select>
|
||||
<select id="findAdoptReview" resultType="com.february.patient.circle.domain.Review">
|
||||
select * from tb_review where is_adopted=1
|
||||
</select>
|
||||
<select id="patientCircleList" resultType="com.february.patient.circle.domain.PatientCircle">
|
||||
select * from tb_patient_circle
|
||||
</select>
|
||||
<select id="findByReviewId" resultType="com.february.patient.circle.domain.Review">
|
||||
select * from tb_review where review_id=#{reviewId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
Loading…
Reference in New Issue