|
|
@ -81,12 +81,17 @@ |
|
|
|
<select id="selectListPointsRanking" resultType="com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO"> |
|
|
|
SELECT |
|
|
|
tab.USER_ID userId, |
|
|
|
tab.NICKNAME nickName, |
|
|
|
( |
|
|
|
SELECT NICKNAME |
|
|
|
FROM epdc_points_logs |
|
|
|
WHERE tab.USER_ID = USER_ID |
|
|
|
ORDER BY CREATED_TIME DESC |
|
|
|
limit 0,1 |
|
|
|
) nickName, |
|
|
|
(tab.totalPointsAdd - tab.totalPointsDeducted) points |
|
|
|
FROM( |
|
|
|
SELECT |
|
|
|
USER_ID, |
|
|
|
NICKNAME, |
|
|
|
SUM(case when OPERATION_TYPE = 0 then IFNULL(points,0) else 0 end) totalPointsDeducted, |
|
|
|
SUM(case when OPERATION_TYPE = 1 then IFNULL(points,0) else 0 end) totalPointsAdd |
|
|
|
FROM epdc_points_logs |
|
|
|