日志表的添加
parent
256b0e9b4a
commit
243b7f6571
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Review> 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,13 +25,24 @@
|
|||
start_time,
|
||||
end_time,
|
||||
<if test="treatmentExperienceDetail!=null and treatmentExperienceDetail!=''">treatment_experience_detail,</if>
|
||||
<if test="patientCircleDetailId != null and patientCircleDetailId != ''">patient_circle_detail_id</if>
|
||||
<if test="patientCircleDetailId != null">patient_circle_detail_id</if>
|
||||
)values (
|
||||
<if test="hospital!=null and hospital!=''">#{hospital},</if>
|
||||
#{startTime},
|
||||
#{endTime},
|
||||
<if test="treatmentExperienceDetail!=null and treatmentExperienceDetail!=''">#{treatmentExperienceDetail},</if>
|
||||
<if test="patientCircleDetailId != null and patientCircleDetailId != ''">#{patientCircleDetailId}</if>
|
||||
<if test="patientCircleDetailId != null">#{patientCircleDetailId}</if>
|
||||
)
|
||||
</insert>
|
||||
<insert id="addCollectLog">
|
||||
insert into t_collect_log(
|
||||
collect_time,
|
||||
<if test="collectState!=null">collect_state,</if>
|
||||
<if test="userId!=null">user_id</if>
|
||||
)values (
|
||||
#{collectTime},
|
||||
<if test="collectState!=null">#{collectState},</if>
|
||||
<if test="userId!=null">#{userId}</if>
|
||||
)
|
||||
</insert>
|
||||
<update id="toCollect">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<result property="reviewDate" column="review_date" />
|
||||
<result property="patientCircleDetailId" column="patient_circle_detail_id" />
|
||||
</resultMap>
|
||||
<insert id="addReview">
|
||||
-<insert id="addReview">
|
||||
-- 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 @@
|
|||
<if test="patientCircleDetailId!=null">#{patientCircleDetailId}</if>
|
||||
)
|
||||
</insert>
|
||||
<insert id="addReviewLog">
|
||||
insert into t_review_log(
|
||||
review_time,
|
||||
<if test="reviewLogState!=null">review_log_state,</if>
|
||||
<if test="userId!=null">user_id</if>
|
||||
)values (
|
||||
#{reviewTime},
|
||||
<if test="reviewLogState!=null">#{reviewLogState},</if>
|
||||
<if test="userId!=null">#{userId}</if>
|
||||
)
|
||||
</insert>
|
||||
<insert id="addEvaluateLog">
|
||||
insert into t_evaluate_log(
|
||||
evaluate_log_time,
|
||||
<if test="evaluateLogState!=null">evaluate_log_state,</if>
|
||||
<if test="userId!=null">user_id</if>
|
||||
)values (
|
||||
#{evaluateLogTime},
|
||||
<if test="evaluateLogState!=null">#{evaluateLogState},</if>
|
||||
<if test="userId!=null">#{userId}</if>
|
||||
)
|
||||
</insert>
|
||||
<update id="upvote">
|
||||
update t_review set good_num=good_num+1,bad_num=bad_num-1 where review_id=#{reviewId}
|
||||
</update>
|
||||
|
|
Loading…
Reference in New Issue