@@ -472,7 +472,58 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
idSet.add("1");
|
||||
}
|
||||
|
||||
IPage<ReportVo> list = reportDao.page(page, vo, idSet);
|
||||
IPage<ReportVo> list = reportDao.page(page, vo,idSet);
|
||||
|
||||
//查询下载量
|
||||
list.getRecords().forEach(c -> {
|
||||
Integer downloadCount = reportLogBookService.getDownloadCount(c.getId());
|
||||
c.setDownload(downloadCount);
|
||||
});
|
||||
//查询点击量
|
||||
list.getRecords().forEach(c -> {
|
||||
Integer clickCount = reportLogBookService.getClickCount(c.getId());
|
||||
c.setClicks(clickCount);
|
||||
});
|
||||
//查询点赞量
|
||||
list.getRecords().forEach(c -> {
|
||||
Integer thumbUpCount = reportLogBookService.getThumbUpCount(c.getId());
|
||||
c.setThumbUp(thumbUpCount);
|
||||
});
|
||||
//查询报告评级
|
||||
list.getRecords().forEach(c -> {
|
||||
Double ratingAvg = reportUserRatingService.getRatingAvg(c.getId());
|
||||
c.setRating(ratingAvg);
|
||||
});
|
||||
//按查询条件排序
|
||||
//按时间排序
|
||||
if (vo.getOrderByTime() != null) {
|
||||
if (vo.getOrderByTime().equals(0)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getCreateDate).reversed());
|
||||
}
|
||||
if (vo.getOrderByTime().equals(1)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getCreateDate));
|
||||
}
|
||||
}
|
||||
|
||||
//按点击量排序
|
||||
if (vo.getOrderByClicks() != null) {
|
||||
if (vo.getOrderByClicks().equals(0)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getClicks).reversed());
|
||||
}
|
||||
if (vo.getOrderByClicks().equals(1)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getClicks));
|
||||
}
|
||||
}
|
||||
|
||||
//按下载量排序
|
||||
if (vo.getOrderByDownload() != null) {
|
||||
if (vo.getOrderByDownload().equals(0)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getDownload).reversed());
|
||||
}
|
||||
if (vo.getOrderByDownload().equals(1)) {
|
||||
list.getRecords().sort(Comparator.comparing(ReportVo::getDownload));
|
||||
}
|
||||
}
|
||||
|
||||
//设置权限
|
||||
UserEO userEo = userEODao.selectById(UserUtils.getUserId());
|
||||
|
||||
@@ -117,13 +117,8 @@ public class ReportVo {
|
||||
private Integer download;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
* 报告评级
|
||||
*/
|
||||
private String createUserId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String uploader;
|
||||
private Double rating;
|
||||
|
||||
}
|
||||
|
||||
@@ -94,33 +94,27 @@
|
||||
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
|
||||
|
||||
SELECT
|
||||
eo.id AS id,
|
||||
eo.`NAME` AS NAME,
|
||||
eo.keycontent AS keyContent,
|
||||
eo.maincontent AS mainContent,
|
||||
eo.DEPARTMENT AS department,
|
||||
eo.`YEAR` AS `year`,
|
||||
eo.fileid AS fileId,
|
||||
eo.confidentialLevel AS confidentialLevel,
|
||||
eo.privacyLevel AS privacyLevel,
|
||||
eo.createUserId AS createUserId,
|
||||
tu.USNAME AS uploader,
|
||||
eo.createDate AS createDate,
|
||||
pa.power AS power,
|
||||
thumbUpCount.thumbUp AS thumbUp,
|
||||
clicksCount.clicks AS clicks,
|
||||
downloadCount.download AS download,
|
||||
AVG( trur.user_rating ) AS reportRating
|
||||
eo.id,
|
||||
eo.NAME,
|
||||
eo.keycontent,
|
||||
eo.maincontent,
|
||||
eo.DEPARTMENT,
|
||||
eo.YEAR,
|
||||
eo.fileid,
|
||||
eo.confidentialLevel,
|
||||
eo.privacyLevel,
|
||||
eo.createUserId,
|
||||
tu.USNAME,
|
||||
eo.createDate,
|
||||
pa.report_id,
|
||||
pa.user_id,
|
||||
pa.power
|
||||
FROM
|
||||
TT_REPORT_MANAGE eo
|
||||
INNER JOIN ts_report_label AS trl ON eo.id = trl.report_id
|
||||
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
|
||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
||||
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS thumbUp FROM report_log_book WHERE type = 3 GROUP BY report_id) AS thumbUpCount ON eo.id = thumbUpCount.report_id
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS clicks FROM report_log_book WHERE type = 4 GROUP BY report_id) AS clicksCount ON eo.id = clicksCount.report_id
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS download FROM report_log_book WHERE type = 2 GROUP BY report_id) AS downloadCount ON eo.id = downloadCount.report_id
|
||||
LEFT JOIN ts_report_user_rating AS trur ON eo.id = trur.report_id
|
||||
WHERE
|
||||
eo.DEL_FLAG = 0
|
||||
|
||||
@@ -153,18 +147,9 @@
|
||||
</if>
|
||||
GROUP BY
|
||||
eo.id
|
||||
<if test="pageVO.orderByTime == 1">
|
||||
ORDER BY
|
||||
eo.createDate DESC
|
||||
</if>
|
||||
<if test="pageVO.orderByClicks == 1">
|
||||
ORDER BY
|
||||
clicksCount.clicks DESC
|
||||
</if>
|
||||
<if test="pageVO.orderByDownload == 1">
|
||||
ORDER BY
|
||||
downloadCount.download DESC
|
||||
</if>
|
||||
ORDER BY
|
||||
eo.updateDate DESC
|
||||
|
||||
</select>
|
||||
|
||||
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
|
||||
|
||||
Reference in New Issue
Block a user