Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
shop-Mall
Commits
87a9f54c
Commit
87a9f54c
authored
Mar 30, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 最近六个月收益sql
parent
c1dcc266
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
23 deletions
+10
-23
TradeRecordMapper.xml
...gy-mapper/src/main/resources/mapper/TradeRecordMapper.xml
+9
-21
WalletServiceImpl.java
...java/cn/wisenergy/service/app/impl/WalletServiceImpl.java
+1
-2
No files found.
wisenergy-mapper/src/main/resources/mapper/TradeRecordMapper.xml
View file @
87a9f54c
...
...
@@ -90,34 +90,22 @@
</where>
</select>
<select
id=
"getByUserIdAndTime"
resultType=
"cn.wisenergy.model.app.TradeRecord"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
trade_type !=1
<if
test=
"userId"
>
and user_id=#{userId}
</if>
<if
test=
"yearMonth != null"
>
AND(
YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(create_time) = MONTH(#{yearMonth}))
</if>
</where>
</select>
<select
id=
"getSixMonthIncome"
resultType=
"cn.wisenergy.model.vo.AccumulatedIncomeVo"
>
SELECT user_id as userId,sum(money) as income ,
date_format(create_time,'%Y-%m') as yearMonth
select a.user_id as userId,a.money as income,date_format(a.create_time,'%Y-%m') as yearMonth
FROM trade_record as a right join (SELECT user_id ,trade_type,
date_format(create_time,'%Y-%m'),max(create_time) as time
FROM
<include
refid=
"table"
/>
WHERE date_format(create_time,'%Y-%m')
<
= date_format(now(),'%Y-%m')
and date_format(create_time,'%Y-%m') >= date_format(now() - interval 5 month,'%Y-%m')
and (status=1 or status=0)
and user_id=#{userId}
group by user_id ,create_time;
and trade_type in(2,4,5,7,8)
group by user_id ,trade_type,date_format(create_time,'%Y-%m')) as b on
a.user_id= b.user_id
and a.trade_type=b.trade_type
and a.create_time =b.time
ORDER BY b.time desc
</select>
<select
id=
"getWithdrawalRecord"
resultType=
"cn.wisenergy.model.vo.WithdrawalRecordVo"
>
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/WalletServiceImpl.java
View file @
87a9f54c
...
...
@@ -11,7 +11,6 @@ import cn.wisenergy.model.app.TradeRecord;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.vo.*
;
import
cn.wisenergy.service.app.WalletService
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -110,7 +109,7 @@ public class WalletServiceImpl implements WalletService {
return
R
.
error
(
"入参为空!"
);
}
//获取
不
包括本月在内的六个月的收益
//获取包括本月在内的六个月的收益
List
<
AccumulatedIncomeVo
>
list
=
tradeRecordMapper
.
getSixMonthIncome
(
userId
);
return
R
.
ok
(
list
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment