Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
5e3bd425
Commit
5e3bd425
authored
Feb 23, 2025
by
wanghuazhou
Committed by
wux
Feb 27, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 货币汇率支持国家多选查询
parent
acc4af3f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
20 deletions
+42
-20
20250222-currency-rate.sql
sql/v2.4/20250222-currency-rate.sql
+10
-1
CurrencyRateDO.java
...odule/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
+0
-5
CurrencyRateMapper.java
...module/ecw/dal/mysql/currencyRate/CurrencyRateMapper.java
+28
-0
CurrencyRateServiceImpl.java
...ule/ecw/service/currencyRate/CurrencyRateServiceImpl.java
+1
-13
CurrencyRateQueryParamVO.java
.../module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
+3
-1
No files found.
sql/v2.4/20250222-currency-rate.sql
View file @
5e3bd425
...
@@ -31,4 +31,13 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate_log` (
...
@@ -31,4 +31,13 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate_log` (
`update_time`
DATETIME
NOT
NULL
COMMENT
'更新时间'
,
`update_time`
DATETIME
NOT
NULL
COMMENT
'更新时间'
,
`deleted`
BIT
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
`deleted`
BIT
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
COMMENT
'币种汇率变更表'
;
)
COMMENT
'币种汇率变更表'
;
\ No newline at end of file
INSERT
INTO
`system_dict_type`
(
`name`
,
`type`
,
`status`
,
`remark`
,
`creator`
,
`create_time`
,
`updater`
,
`update_time`
,
`deleted`
)
VALUES
(
'货币汇率状态'
,
'currency_rate_status'
,
0
,
NULL
,
'1'
,
'2022-05-23 23:29:07'
,
'1'
,
'2022-05-23 23:34:59'
,
b
'0'
);
INSERT
INTO
`system_dict_data`
(
`sort`
,
`label`
,
`value`
,
`dict_type`
,
`status`
,
`color_type`
,
`css_class`
,
`remark`
,
`creator`
,
`create_time`
,
`updater`
,
`update_time`
,
`deleted`
,
`label_en`
)
VALUES
(
0
,
'已过期'
,
'1'
,
'currency_rate_status'
,
0
,
'warning'
,
''
,
NULL
,
'1'
,
'2022-11-18 00:18:34'
,
'1'
,
'2023-01-15 18:09:43'
,
b
'0'
,
'Expired'
),
(
1
,
'生效中'
,
'0'
,
'currency_rate_status'
,
0
,
'warning'
,
''
,
NULL
,
'1'
,
'2022-11-18 00:18:34'
,
'1'
,
'2023-01-15 18:09:43'
,
b
'0'
,
'Active'
);
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
View file @
5e3bd425
...
@@ -53,11 +53,6 @@ public class CurrencyRateDO extends BaseDO {
...
@@ -53,11 +53,6 @@ public class CurrencyRateDO extends BaseDO {
*/
*/
private
BigDecimal
targetAmount
;
private
BigDecimal
targetAmount
;
/**
* 汇率值
*/
private
BigDecimal
rate
;
/**
/**
* 国家
* 国家
*/
*/
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/mysql/currencyRate/CurrencyRateMapper.java
View file @
5e3bd425
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
dal
.
mysql
.
currencyRate
;
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
dal
.
mysql
.
currencyRate
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.currencyRate.CurrencyRateDO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.currencyRate.CurrencyRateDO
;
import
cn.iocoder.yudao.module.ecw.vo.currencyRate.CurrencyRateQueryParamVO
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.time.LocalDate
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.function.Consumer
;
@Mapper
@Mapper
public
interface
CurrencyRateMapper
extends
AbstractMapper
<
CurrencyRateDO
>
{
public
interface
CurrencyRateMapper
extends
AbstractMapper
<
CurrencyRateDO
>
{
default
PageResult
<
CurrencyRateDO
>
selectPage
(
CurrencyRateQueryParamVO
param
)
{
LocalDate
now
=
LocalDate
.
now
();
Set
<
Long
>
countries
=
Optional
.
ofNullable
(
param
.
getCountries
()).
orElse
(
Collections
.
emptySet
());
Consumer
<
LambdaQueryWrapper
<
CurrencyRateDO
>>
countriesQuery
=
it
->
countries
.
stream
().
limit
(
5
).
forEach
(
id
->
it
.
or
().
apply
(
"json_contains(`countries`, {0})"
,
String
.
valueOf
(
id
)));
LambdaQueryWrapper
<
CurrencyRateDO
>
wrapper
=
Wrappers
.
lambdaQuery
(
CurrencyRateDO
.
class
)
.
eq
(
param
.
getSourceId
()
!=
null
,
CurrencyRateDO:
:
getSourceId
,
param
.
getSourceId
())
.
eq
(
param
.
getTargetId
()
!=
null
,
CurrencyRateDO:
:
getTargetId
,
param
.
getTargetId
())
.
and
(!
countries
.
isEmpty
(),
countriesQuery
)
.
gt
(
param
.
getExpired
()
==
Boolean
.
FALSE
,
CurrencyRateDO:
:
getExpiration
,
now
)
.
lt
(
param
.
getExpired
()
==
Boolean
.
TRUE
,
CurrencyRateDO:
:
getExpiration
,
now
)
.
gt
(
param
.
getExpirationAfter
()
!=
null
,
CurrencyRateDO:
:
getExpiration
,
param
.
getExpirationAfter
())
.
lt
(
param
.
getExpirationBefore
()
!=
null
,
CurrencyRateDO:
:
getExpiration
,
param
.
getExpirationBefore
())
.
orderByDesc
(
Arrays
.
asList
(
CurrencyRateDO:
:
getUpdateTime
,
CurrencyRateDO:
:
getExpiration
));
return
selectPage
(
param
,
wrapper
);
}
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/currencyRate/CurrencyRateServiceImpl.java
View file @
5e3bd425
...
@@ -17,8 +17,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...
@@ -17,8 +17,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.util.Arrays
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -86,17 +84,7 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
...
@@ -86,17 +84,7 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
@Override
@Override
public
PageResult
<
CurrencyRateDO
>
query
(
CurrencyRateQueryParamVO
param
)
{
public
PageResult
<
CurrencyRateDO
>
query
(
CurrencyRateQueryParamVO
param
)
{
LocalDate
now
=
LocalDate
.
now
();
return
mapper
.
selectPage
(
param
);
LambdaQueryWrapper
<
CurrencyRateDO
>
wrapper
=
Wrappers
.
lambdaQuery
(
CurrencyRateDO
.
class
)
.
eq
(
param
.
getSourceId
()
!=
null
,
CurrencyRateDO:
:
getSourceId
,
param
.
getSourceId
())
.
eq
(
param
.
getTargetId
()
!=
null
,
CurrencyRateDO:
:
getTargetId
,
param
.
getTargetId
())
// TODO countries intersect
.
gt
(
param
.
getExpired
()
==
Boolean
.
FALSE
,
CurrencyRateDO:
:
getExpiration
,
now
)
.
lt
(
param
.
getExpired
()
==
Boolean
.
TRUE
,
CurrencyRateDO:
:
getExpiration
,
now
)
.
gt
(
param
.
getExpirationAfter
()
!=
null
,
CurrencyRateDO:
:
getExpiration
,
param
.
getExpirationAfter
())
.
lt
(
param
.
getExpirationBefore
()
!=
null
,
CurrencyRateDO:
:
getExpiration
,
param
.
getExpirationBefore
())
.
orderByDesc
(
Arrays
.
asList
(
CurrencyRateDO:
:
getUpdateTime
,
CurrencyRateDO:
:
getExpiration
));
return
mapper
.
selectPage
(
param
,
wrapper
);
}
}
@Override
@Override
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
View file @
5e3bd425
...
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
...
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -20,7 +21,8 @@ public class CurrencyRateQueryParamVO extends PageParam {
...
@@ -20,7 +21,8 @@ public class CurrencyRateQueryParamVO extends PageParam {
@ApiModelProperty
(
value
=
"支付币种"
)
@ApiModelProperty
(
value
=
"支付币种"
)
private
Long
targetId
;
private
Long
targetId
;
@ApiModelProperty
(
value
=
"国家"
)
@ApiModelProperty
(
value
=
"国家(最多五个)"
)
@Length
(
max
=
5
)
private
Set
<
Long
>
countries
;
private
Set
<
Long
>
countries
;
@ApiModelProperty
(
value
=
"状态"
)
@ApiModelProperty
(
value
=
"状态"
)
...
...
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