feat:获取单个报表评分接口
This commit is contained in:
+9
-1
@@ -3,7 +3,6 @@ package com.adc.da.report.controller;
|
||||
import com.adc.da.report.dto.ReportRatingDTO;
|
||||
import com.adc.da.report.service.IReportUserRatingService;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,4 +31,13 @@ public class ReportRatingController {
|
||||
public ResponseMessage rating(@Valid ReportRatingDTO reportRatingDTO) {
|
||||
return reportUserRatingService.rating(reportRatingDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报告评分
|
||||
*/
|
||||
@ApiOperation(value = "给报告评分")
|
||||
@GetMapping("/rating")
|
||||
public ResponseMessage getRating(String reportId) {
|
||||
return reportUserRatingService.getRating(reportId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,12 @@ public interface IReportUserRatingService extends IService<ReportUserRatingEntit
|
||||
* @return
|
||||
*/
|
||||
Double getRatingAvg(String reportId);
|
||||
|
||||
/**
|
||||
* 获取报告评分
|
||||
*
|
||||
* @param reportId
|
||||
* @return
|
||||
*/
|
||||
ResponseMessage getRating(String reportId);
|
||||
}
|
||||
|
||||
+6
@@ -67,6 +67,12 @@ public class IReportUserRatingServiceImpl extends ServiceImpl<ReportUserRatingDa
|
||||
BigDecimal userRating = (BigDecimal) result.get(0).get("user_rating");
|
||||
return userRating.doubleValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage getRating(String reportId) {
|
||||
ReportUserRatingEntity entity = query().eq("report_id", reportId).eq("user_id", UserUtils.getUserId()).one();
|
||||
return Result.success(entity.getUserRating());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user