发表评论
parent
bd8f74b6e5
commit
0e6a6c089f
|
@ -14,11 +14,21 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author: Mr.Wang
|
||||
* @create: 2023-11-02 21:53
|
||||
**/
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department")
|
||||
public class DepartmentController {
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
|
||||
/**
|
||||
* 查询科室信息
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findById")
|
||||
public Department findById(@RequestParam Integer departmentId){
|
||||
return departmentService.findById(departmentId);
|
||||
|
|
|
@ -13,15 +13,31 @@ import java.util.List;
|
|||
* @author: Mr.Wang
|
||||
* @create: 2023-11-02 18:58
|
||||
**/
|
||||
|
||||
/**
|
||||
* 病友圈
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patient")
|
||||
public class PatientController {
|
||||
@Autowired
|
||||
private PatientService patientService;
|
||||
|
||||
/**
|
||||
* 查看病友圈详情
|
||||
* @param patientCircleDetailId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/circleDetail")
|
||||
public PatientCircleDetail circleDetail(@RequestParam Integer patientCircleDetailId){
|
||||
return patientService.circleDetail(patientCircleDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字及病症名称查询
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findByName")
|
||||
public List<PatientCircleDetail> findByName(@RequestParam String title){
|
||||
return patientService.findByName(title);
|
||||
|
|
|
@ -3,10 +3,7 @@ package com.february.patient.controller;
|
|||
import com.february.patient.domain.Review;
|
||||
import com.february.patient.service.ReviewService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,13 +13,27 @@ import java.util.List;
|
|||
* @author: Mr.Wang
|
||||
* @create: 2023-11-02 20:43
|
||||
**/
|
||||
|
||||
/**
|
||||
* 评论
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/review")
|
||||
public class ReviewController {
|
||||
@Autowired
|
||||
private ReviewService reviewService;
|
||||
|
||||
/**
|
||||
* 所有评论信息
|
||||
* @param patientCircleDetailId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findReviewListByPatientCircleDetailId")
|
||||
public List<Review> findReviewListByPatientCircleDetailId(@RequestParam Integer patientCircleDetailId){
|
||||
return reviewService.findReviewListByPatientCircleDetailId(patientCircleDetailId);
|
||||
}
|
||||
@PostMapping("/addReview")
|
||||
public void addReview(@RequestBody Review review){
|
||||
reviewService.addReview(review);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,6 @@ import java.util.List;
|
|||
**/
|
||||
public interface ReviewMapper {
|
||||
List<Review> findReviewListByPatientCircleDetailId(@Param("patientCircleDetailId") Integer patientCircleDetailId);
|
||||
|
||||
void addReview(Review review);
|
||||
}
|
||||
|
|
|
@ -12,4 +12,6 @@ import java.util.List;
|
|||
**/
|
||||
public interface ReviewService {
|
||||
List<Review> findReviewListByPatientCircleDetailId(Integer patientCircleDetailId);
|
||||
|
||||
void addReview(Review review);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.february.patient.service.ReviewService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -22,4 +23,12 @@ public class ReviewServiceImpl implements ReviewService {
|
|||
public List<Review> findReviewListByPatientCircleDetailId(Integer patientCircleDetailId) {
|
||||
return reviewMapper.findReviewListByPatientCircleDetailId(patientCircleDetailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReview(Review review) {
|
||||
review.setReviewDate(new Date());
|
||||
review.setGoodNum(0);
|
||||
review.setBadNum(0);
|
||||
reviewMapper.addReview(review);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,27 @@
|
|||
<result property="reviewDate" column="review_date" />
|
||||
<result property="patientCircleDetailId" column="patient_circle_detail_id" />
|
||||
</resultMap>
|
||||
<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 (
|
||||
<if test="reviewImg!=null and reviewImg!=''">review_img,</if>
|
||||
<if test="reviewName!=null and reviewName!=''">review_name,</if>
|
||||
<if test="reviewContent!=null and reviewContent!=''">review_content,</if>
|
||||
review_date,
|
||||
<if test="goodNum!=null">good_num,</if>
|
||||
<if test="badNum!=null">bad_num,</if>
|
||||
<if test="patientCircleDetailId!=null">patient_circle_detail_id</if>
|
||||
)values (
|
||||
<if test="reviewImg!=null and reviewImg!=''">#{reviewImg},</if>
|
||||
<if test="reviewName!=null and reviewName!=''">#{reviewName},</if>
|
||||
<if test="reviewContent!=null and reviewContent!=''">#{reviewContent},</if>
|
||||
#{reviewDate},
|
||||
<if test="goodNum!=null">#{goodNum},</if>
|
||||
<if test="badNum!=null">#{badNum},</if>
|
||||
<if test="patientCircleDetailId!=null">#{patientCircleDetailId}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<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