diff --git a/february-patient-common/src/main/java/com/february/patient/domain/CollectLog.java b/february-patient-common/src/main/java/com/february/patient/domain/CollectLog.java new file mode 100644 index 0000000..f4a909d --- /dev/null +++ b/february-patient-common/src/main/java/com/february/patient/domain/CollectLog.java @@ -0,0 +1,74 @@ +package com.february.patient.domain; + +/** + * @program: february-patient-circle + * @description: 收藏记录表 + * @author: Mr.Wang + * @create: 2023-11-06 10:58 + **/ + +import java.util.Date; + +/** + * 收藏记录 + */ +public class CollectLog { + /** + * 主键 + */ + private Integer collectLogId; + /** + * 收藏时间 + */ + private Date collectTime; + /** + * 收藏状态 + */ + private Integer collectState; + /** + * 操作人 + */ + private Integer userId; + + public Integer getCollectLogId() { + return collectLogId; + } + + public void setCollectLogId(Integer collectLogId) { + this.collectLogId = collectLogId; + } + + public Date getCollectTime() { + return collectTime; + } + + public void setCollectTime(Date collectTime) { + this.collectTime = collectTime; + } + + public Integer getCollectState() { + return collectState; + } + + public void setCollectState(Integer collectState) { + this.collectState = collectState; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + @Override + public String toString() { + return "CollectLog{" + + "collectLogId=" + collectLogId + + ", collectTime=" + collectTime + + ", collectState=" + collectState + + ", userId=" + userId + + '}'; + } +} diff --git a/february-patient-common/src/main/java/com/february/patient/domain/EvaluateLog.java b/february-patient-common/src/main/java/com/february/patient/domain/EvaluateLog.java new file mode 100644 index 0000000..3220edf --- /dev/null +++ b/february-patient-common/src/main/java/com/february/patient/domain/EvaluateLog.java @@ -0,0 +1,74 @@ +package com.february.patient.domain; + +/** + * @program: february-patient-circle + * @description: + * @author: Mr.Wang + * @create: 2023-11-06 10:31 + **/ + +import java.util.Date; + +/** + * 点赞点踩记录表 + */ +public class EvaluateLog { + /** + * 主键id + */ + private Integer evaluateLogId; + /** + * 操作时间 + */ + private Date evaluateLogTime; + /** + * 状态 1:点赞 2:点踩 + */ + private Integer evaluateLogState; + /** + * 操作人 + */ + private Integer userId; + + public Integer getEvaluateLogId() { + return evaluateLogId; + } + + public void setEvaluateLogId(Integer evaluateLogId) { + this.evaluateLogId = evaluateLogId; + } + + public Date getEvaluateLogTime() { + return evaluateLogTime; + } + + public void setEvaluateLogTime(Date evaluateLogTime) { + this.evaluateLogTime = evaluateLogTime; + } + + public Integer getEvaluateLogState() { + return evaluateLogState; + } + + public void setEvaluateLogState(Integer evaluateLogState) { + this.evaluateLogState = evaluateLogState; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + @Override + public String toString() { + return "EvaluateLog{" + + "evaluateLogId=" + evaluateLogId + + ", evaluateLogTime=" + evaluateLogTime + + ", evaluateLogState=" + evaluateLogState + + ", userId=" + userId + + '}'; + } +} diff --git a/february-patient-common/src/main/java/com/february/patient/domain/ReviewLog.java b/february-patient-common/src/main/java/com/february/patient/domain/ReviewLog.java new file mode 100644 index 0000000..a6f7387 --- /dev/null +++ b/february-patient-common/src/main/java/com/february/patient/domain/ReviewLog.java @@ -0,0 +1,74 @@ +package com.february.patient.domain; + +import java.util.Date; + +/** + * @program: february-patient-circle + * @description: + * @author: Mr.Wang + * @create: 2023-11-06 10:13 + **/ + +/** + * 评论记录表 + */ +public class ReviewLog { + /** + * 主键 + */ + private Integer reviewLogId; + /** + * 评论记录时间 + */ + private Date reviewTime; + /** + * 评论状态 1:评论成功 2:评论失败 + */ + private Integer reviewLogState; + /** + * 评论人 + */ + private Integer userId; + + public Integer getReviewLogId() { + return reviewLogId; + } + + public void setReviewLogId(Integer reviewLogId) { + this.reviewLogId = reviewLogId; + } + + public Date getReviewTime() { + return reviewTime; + } + + public void setReviewTime(Date reviewTime) { + this.reviewTime = reviewTime; + } + + public Integer getReviewLogState() { + return reviewLogState; + } + + public void setReviewLogState(Integer reviewLogState) { + this.reviewLogState = reviewLogState; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + @Override + public String toString() { + return "ReviewLog{" + + "reviewLogId=" + reviewLogId + + ", reviewTime=" + reviewTime + + ", reviewLogState=" + reviewLogState + + ", userId=" + userId + + '}'; + } +} diff --git a/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java b/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java index 6c269cc..f1110fc 100644 --- a/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java +++ b/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java @@ -54,7 +54,6 @@ public class PatientController { public void addExperience(@RequestBody TreatmentExperience treatmentExperience){ patientService.addExperience(treatmentExperience); } - // /** // * 点赞操作 // */ @@ -62,7 +61,6 @@ public class PatientController { // public void upvote(@RequestParam Integer patientCircleDetailId){ // patientService.upvote(patientCircleDetailId); // } - /** * 收藏操作 * @param patientCircleDetailId diff --git a/february-patient-server/src/main/java/com/february/patient/mapper/PatientMapper.java b/february-patient-server/src/main/java/com/february/patient/mapper/PatientMapper.java index 5a73f12..ce7be8c 100644 --- a/february-patient-server/src/main/java/com/february/patient/mapper/PatientMapper.java +++ b/february-patient-server/src/main/java/com/february/patient/mapper/PatientMapper.java @@ -1,5 +1,6 @@ package com.february.patient.mapper; +import com.february.patient.domain.CollectLog; import com.february.patient.domain.PatientCircleDetail; import com.february.patient.domain.TreatmentExperience; import org.apache.ibatis.annotations.Mapper; @@ -23,6 +24,8 @@ public interface PatientMapper { void addExperience(TreatmentExperience treatmentExperience); void toCollect(@Param("patientCircleDetailId") Integer patientCircleDetailId); + + void addCollectLog(CollectLog collectLog); // // void upvote(@Param("patientCircleDetailId") Integer patientCircleDetailId); } diff --git a/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java b/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java index 01c2381..50e4d3f 100644 --- a/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java +++ b/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java @@ -1,6 +1,8 @@ package com.february.patient.mapper; +import com.february.patient.domain.EvaluateLog; import com.february.patient.domain.Review; +import com.february.patient.domain.ReviewLog; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,9 +16,15 @@ import java.util.List; public interface ReviewMapper { List findReviewListByPatientCircleDetailId(@Param("patientCircleDetailId") Integer patientCircleDetailId); - void addReview(Review review); + void upvote(@Param("reviewId") Integer reviewId); void dislike(@Param("reviewId") Integer reviewId); + + Integer addReview(Review review); + + void addReviewLog(ReviewLog reviewLog); + + void addEvaluateLog(EvaluateLog evaluateLog); } diff --git a/february-patient-server/src/main/java/com/february/patient/service/impl/PatientServiceImpl.java b/february-patient-server/src/main/java/com/february/patient/service/impl/PatientServiceImpl.java index 993a39b..0cc4702 100644 --- a/february-patient-server/src/main/java/com/february/patient/service/impl/PatientServiceImpl.java +++ b/february-patient-server/src/main/java/com/february/patient/service/impl/PatientServiceImpl.java @@ -1,5 +1,6 @@ package com.february.patient.service.impl; +import com.february.patient.domain.CollectLog; import com.february.patient.domain.PatientCircleDetail; import com.february.patient.domain.TreatmentExperience; import com.february.patient.mapper.PatientMapper; @@ -7,6 +8,7 @@ import com.february.patient.service.PatientService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; /** @@ -38,6 +40,11 @@ public class PatientServiceImpl implements PatientService { @Override public void toCollect(Integer patientCircleDetailId) { patientMapper.toCollect(patientCircleDetailId); + CollectLog collectLog = new CollectLog(); + collectLog.setCollectState(1); + collectLog.setCollectTime(new Date()); + collectLog.setUserId(1); + patientMapper.addCollectLog(collectLog); } // @Override diff --git a/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java b/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java index 914af45..921be61 100644 --- a/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java +++ b/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java @@ -1,6 +1,8 @@ package com.february.patient.service.impl; +import com.february.patient.domain.EvaluateLog; import com.february.patient.domain.Review; +import com.february.patient.domain.ReviewLog; import com.february.patient.mapper.ReviewMapper; import com.february.patient.service.ReviewService; import org.springframework.beans.factory.annotation.Autowired; @@ -29,16 +31,37 @@ public class ReviewServiceImpl implements ReviewService { review.setReviewDate(new Date()); review.setGoodNum(0); review.setBadNum(0); - reviewMapper.addReview(review); + Integer i=reviewMapper.addReview(review); + ReviewLog reviewLog = new ReviewLog(); + if(i>0){ + reviewLog.setReviewLogState(1); + reviewLog.setReviewTime(new Date()); + reviewLog.setUserId(1); + reviewMapper.addReviewLog(reviewLog); + } + reviewLog.setReviewLogState(2); + reviewLog.setReviewTime(new Date()); + reviewLog.setUserId(1); + reviewMapper.addReviewLog(reviewLog); } @Override public void upvote(Integer reviewId) { reviewMapper.upvote(reviewId); + EvaluateLog evaluateLog = new EvaluateLog(); + evaluateLog.setEvaluateLogState(1); + evaluateLog.setEvaluateLogTime(new Date()); + evaluateLog.setUserId(1); + reviewMapper.addEvaluateLog(evaluateLog); } @Override public void dislike(Integer reviewId) { reviewMapper.dislike(reviewId); + EvaluateLog evaluateLog = new EvaluateLog(); + evaluateLog.setEvaluateLogState(2); + evaluateLog.setEvaluateLogTime(new Date()); + evaluateLog.setUserId(1); + reviewMapper.addEvaluateLog(evaluateLog); } } diff --git a/february-patient-server/src/main/resources/mapper/patient/PatientMapper.xml b/february-patient-server/src/main/resources/mapper/patient/PatientMapper.xml index e362677..4dc3965 100644 --- a/february-patient-server/src/main/resources/mapper/patient/PatientMapper.xml +++ b/february-patient-server/src/main/resources/mapper/patient/PatientMapper.xml @@ -25,13 +25,24 @@ start_time, end_time, treatment_experience_detail, - patient_circle_detail_id + patient_circle_detail_id )values ( #{hospital}, #{startTime}, #{endTime}, #{treatmentExperienceDetail}, - #{patientCircleDetailId} + #{patientCircleDetailId} + ) + + + insert into t_collect_log( + collect_time, + collect_state, + user_id + )values ( + #{collectTime}, + #{collectState}, + #{userId} ) diff --git a/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml b/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml index f90355e..031da9c 100644 --- a/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml +++ b/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml @@ -13,7 +13,7 @@ - + - -- INSERT INTO `patientcircle`.`t_review` (`review_id`, `review_img`, `review_name`, `review_content`, `review_date`, `good_num`, `bad_num`, `patient_circle_detail_id`) -- VALUES (1, '医生用户照片', '小楠楠', '一般会慢慢恢复', '2023-11-08', 99, 5, 1); insert into t_review ( @@ -34,6 +34,28 @@ #{patientCircleDetailId} ) + + insert into t_review_log( + review_time, + review_log_state, + user_id + )values ( + #{reviewTime}, + #{reviewLogState}, + #{userId} + ) + + + insert into t_evaluate_log( + evaluate_log_time, + evaluate_log_state, + user_id + )values ( + #{evaluateLogTime}, + #{evaluateLogState}, + #{userId} + ) + update t_review set good_num=good_num+1,bad_num=bad_num-1 where review_id=#{reviewId}