完善代码
parent
5eb55235cf
commit
256b0e9b4a
|
@ -3,6 +3,7 @@ package com.february.patient.controller;
|
|||
import com.february.patient.domain.PatientCircleDetail;
|
||||
import com.february.patient.domain.TreatmentExperience;
|
||||
import com.february.patient.service.PatientService;
|
||||
import io.swagger.models.auth.In;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -53,4 +54,21 @@ public class PatientController {
|
|||
public void addExperience(@RequestBody TreatmentExperience treatmentExperience){
|
||||
patientService.addExperience(treatmentExperience);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 点赞操作
|
||||
// */
|
||||
// @PostMapping("/upvote")
|
||||
// public void upvote(@RequestParam Integer patientCircleDetailId){
|
||||
// patientService.upvote(patientCircleDetailId);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 收藏操作
|
||||
* @param patientCircleDetailId
|
||||
*/
|
||||
@PostMapping("/toCollect")
|
||||
public void toCollect(@RequestParam Integer patientCircleDetailId){
|
||||
patientService.toCollect(patientCircleDetailId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,31 @@ public class ReviewController {
|
|||
public List<Review> findReviewListByPatientCircleDetailId(@RequestParam Integer patientCircleDetailId){
|
||||
return reviewService.findReviewListByPatientCircleDetailId(patientCircleDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发表评论
|
||||
* @param review
|
||||
*/
|
||||
@PostMapping("/addReview")
|
||||
public void addReview(@RequestBody Review review){
|
||||
reviewService.addReview(review);
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论点赞
|
||||
* @param reviewId
|
||||
*/
|
||||
@PostMapping("/upvote")
|
||||
public void upvote(@RequestParam Integer reviewId){
|
||||
reviewService.upvote(reviewId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点踩操作
|
||||
* @param reviewId
|
||||
*/
|
||||
@PostMapping("/dislike")
|
||||
public void dislike(@RequestParam Integer reviewId){
|
||||
reviewService.dislike(reviewId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,8 @@ public interface PatientMapper {
|
|||
List<PatientCircleDetail> findByName(@Param("title") String title);
|
||||
|
||||
void addExperience(TreatmentExperience treatmentExperience);
|
||||
|
||||
void toCollect(@Param("patientCircleDetailId") Integer patientCircleDetailId);
|
||||
//
|
||||
// void upvote(@Param("patientCircleDetailId") Integer patientCircleDetailId);
|
||||
}
|
||||
|
|
|
@ -15,4 +15,8 @@ public interface ReviewMapper {
|
|||
List<Review> findReviewListByPatientCircleDetailId(@Param("patientCircleDetailId") Integer patientCircleDetailId);
|
||||
|
||||
void addReview(Review review);
|
||||
|
||||
void upvote(@Param("reviewId") Integer reviewId);
|
||||
|
||||
void dislike(@Param("reviewId") Integer reviewId);
|
||||
}
|
||||
|
|
|
@ -18,4 +18,8 @@ public interface PatientService {
|
|||
List<PatientCircleDetail> findByName(String title);
|
||||
|
||||
void addExperience(TreatmentExperience treatmentExperience);
|
||||
|
||||
void toCollect(Integer patientCircleDetailId);
|
||||
//
|
||||
// void upvote(Integer patientCircleDetailId);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,8 @@ public interface ReviewService {
|
|||
List<Review> findReviewListByPatientCircleDetailId(Integer patientCircleDetailId);
|
||||
|
||||
void addReview(Review review);
|
||||
|
||||
void upvote(Integer reviewId);
|
||||
|
||||
void dislike(Integer reviewId);
|
||||
}
|
||||
|
|
|
@ -35,4 +35,14 @@ public class PatientServiceImpl implements PatientService {
|
|||
patientMapper.addExperience(treatmentExperience);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toCollect(Integer patientCircleDetailId) {
|
||||
patientMapper.toCollect(patientCircleDetailId);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void upvote(Integer patientCircleDetailId) {
|
||||
// patientMapper.upvote(patientCircleDetailId);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -31,4 +31,14 @@ public class ReviewServiceImpl implements ReviewService {
|
|||
review.setBadNum(0);
|
||||
reviewMapper.addReview(review);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upvote(Integer reviewId) {
|
||||
reviewMapper.upvote(reviewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dislike(Integer reviewId) {
|
||||
reviewMapper.dislike(reviewId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
<if test="patientCircleDetailId != null and patientCircleDetailId != ''">#{patientCircleDetailId}</if>
|
||||
)
|
||||
</insert>
|
||||
<update id="toCollect">
|
||||
update t_patient_circle_detail set collect_num=collect_num+1 where patient_circle_detail_id=#{patientCircleDetailId}
|
||||
</update>
|
||||
<!-- <update id="upvote">-->
|
||||
<!-- update t_patient_circle_detail set-->
|
||||
<!-- </update>-->
|
||||
<select id="circleDetail" resultMap="patientCircleDetail">
|
||||
select title,publish_name,department_name,patient_detail,treatment_experience,patient_img,
|
||||
collect_num,review_num,is_reward,reward_num from t_patient_circle_detail where patient_circle_detail_id=#{patientCircleDetailId}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
<if test="patientCircleDetailId!=null">#{patientCircleDetailId}</if>
|
||||
)
|
||||
</insert>
|
||||
<update id="upvote">
|
||||
update t_review set good_num=good_num+1,bad_num=bad_num-1 where review_id=#{reviewId}
|
||||
</update>
|
||||
<update id="dislike">
|
||||
update t_review set bad_num=bad_num+1,good_num=good_num-1 where review_id=#{reviewId}
|
||||
</update>
|
||||
|
||||
<select id="findReviewListByPatientCircleDetailId" resultMap="Review">
|
||||
select review_id,review_img,review_name,review_content,review_date,good_num,bad_num,patient_circle_detail_id from t_review where patient_circle_detail_id=#{patientCircleDetailId}
|
||||
|
|
Loading…
Reference in New Issue