Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
f52f5c49
Commit
f52f5c49
authored
Apr 10, 2020
by
Simon Cheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加代码生成器及测试
parent
57490fa7
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
782 additions
and
7 deletions
+782
-7
yd-api/src/main/java/com/yd/api/customer/CustomerController.java
+16
-0
yd-api/src/main/java/com/yd/api/customer/service/CustomerService.java
+5
-2
yd-api/src/main/java/com/yd/api/customer/service/CustomerServiceImpl.java
+25
-1
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneRequestVO.java
+23
-0
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneResponseVO.java
+35
-0
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneVO.java
+186
-0
yd-api/src/main/java/com/yd/dataccess/entity/customer/CustomerFortune.java
+187
-0
yd-api/src/main/java/com/yd/dataccess/mapper/customer/CustomerFortuneMapper.java
+21
-0
yd-api/src/main/java/com/yd/dataccess/service/customer/CustomerDA.java
+4
-1
yd-api/src/main/java/com/yd/dataccess/service/customer/CustomerDAImpl.java
+18
-0
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicDataSourceAspect.java
+2
-2
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicRoutingDataSource.java
+5
-1
yd-api/src/main/resources/mapper/customer/CustomerFortuneMapper.xml
+255
-0
No files found.
yd-api/src/main/java/com/yd/api/customer/CustomerController.java
View file @
f52f5c49
...
@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yd.api.customer.service.CustomerService
;
import
com.yd.api.customer.service.CustomerService
;
import
com.yd.api.customer.vo.CustomerFortuneRequestVO
;
import
com.yd.api.customer.vo.CustomerFortuneResponseVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerVO
;
import
com.yd.api.customer.vo.CustomerVO
;
...
@@ -45,4 +47,17 @@ public class CustomerController {
...
@@ -45,4 +47,17 @@ public class CustomerController {
result
.
setData
(
erpOrderQueryResponseVO
);
result
.
setData
(
erpOrderQueryResponseVO
);
return
result
;
return
result
;
}
}
/**
* 分页查询案例
* @param customerQueryRequestVO
* @return
*/
@RequestMapping
(
"/selectByCustomerId"
)
public
Object
selectByCustomerId
(
@RequestBody
CustomerFortuneRequestVO
customerQueryRequestVO
){
JsonResult
result
=
new
JsonResult
();
CustomerFortuneResponseVO
erpOrderQueryResponseVO
=
customerService
.
selectByCustomerId
(
customerQueryRequestVO
);
result
.
addResult
(
erpOrderQueryResponseVO
);
result
.
setData
(
erpOrderQueryResponseVO
);
return
result
;
}
}
}
\ No newline at end of file
yd-api/src/main/java/com/yd/api/customer/service/CustomerService.java
View file @
f52f5c49
...
@@ -2,14 +2,17 @@ package com.yd.api.customer.service;
...
@@ -2,14 +2,17 @@ package com.yd.api.customer.service;
import
java.util.List
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.api.customer.vo.CustomerFortuneRequestVO
;
import
com.yd.api.customer.vo.CustomerFortuneResponseVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerVO
;
import
com.yd.api.customer.vo.CustomerVO
;
import
com.yd.dataccess.entity.customer.Customer
;
public
interface
CustomerService
{
public
interface
CustomerService
{
List
<
CustomerVO
>
listAllCustomer
();
List
<
CustomerVO
>
listAllCustomer
();
CustomerQueryResponseVO
findByPage
(
CustomerQueryRequestVO
customerQueryRequestVO
);
CustomerQueryResponseVO
findByPage
(
CustomerQueryRequestVO
customerQueryRequestVO
);
CustomerFortuneResponseVO
selectByCustomerId
(
CustomerFortuneRequestVO
customer
);
}
}
yd-api/src/main/java/com/yd/api/customer/service/CustomerServiceImpl.java
View file @
f52f5c49
...
@@ -8,12 +8,16 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -8,12 +8,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.api.customer.vo.CustomerFortuneRequestVO
;
import
com.yd.api.customer.vo.CustomerFortuneResponseVO
;
import
com.yd.api.customer.vo.CustomerFortuneVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryRequestVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerQueryResponseVO
;
import
com.yd.api.customer.vo.CustomerVO
;
import
com.yd.api.customer.vo.CustomerVO
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
import
com.yd.dataccess.mapper.customer.CustomerFortuneMapper
;
import
com.yd.dataccess.service.customer.CustomerDA
;
import
com.yd.dataccess.service.customer.CustomerDA
;
import
com.yd.util.page.PaginationInfo
;
@Service
(
"customerServiceImpl"
)
@Service
(
"customerServiceImpl"
)
public
class
CustomerServiceImpl
implements
CustomerService
{
public
class
CustomerServiceImpl
implements
CustomerService
{
...
@@ -21,6 +25,9 @@ public class CustomerServiceImpl implements CustomerService{
...
@@ -21,6 +25,9 @@ public class CustomerServiceImpl implements CustomerService{
@Autowired
@Autowired
private
CustomerDA
customerServiceDA
;
private
CustomerDA
customerServiceDA
;
@Autowired
private
CustomerFortuneMapper
customerFortuneMapper
;
@Override
@Override
public
List
<
CustomerVO
>
listAllCustomer
()
{
public
List
<
CustomerVO
>
listAllCustomer
()
{
List
<
CustomerVO
>
listTo
=
new
ArrayList
<
CustomerVO
>();
List
<
CustomerVO
>
listTo
=
new
ArrayList
<
CustomerVO
>();
...
@@ -51,5 +58,22 @@ public class CustomerServiceImpl implements CustomerService{
...
@@ -51,5 +58,22 @@ public class CustomerServiceImpl implements CustomerService{
return
customerQueryResponseVO
;
return
customerQueryResponseVO
;
}
}
@Override
public
CustomerFortuneResponseVO
selectByCustomerId
(
CustomerFortuneRequestVO
request
)
{
CustomerFortuneResponseVO
customerQueryResponseVO
=
new
CustomerFortuneResponseVO
();
Long
customerId
=
request
.
getCustomerId
();
PageInfo
<
CustomerFortune
>
page
=
request
.
getPage
();
PageInfo
<
CustomerFortune
>
list
=
customerServiceDA
.
selectByCustomerId
(
customerId
,
page
.
getPageNum
(),
page
.
getSize
());
customerQueryResponseVO
.
setCustomerId
(
customerId
);
customerQueryResponseVO
.
setCustomerPage
(
list
);
return
customerQueryResponseVO
;
}
}
}
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneRequestVO.java
0 → 100644
View file @
f52f5c49
package
com
.
yd
.
api
.
customer
.
vo
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
public
class
CustomerFortuneRequestVO
{
private
Long
customerId
;
//客户ID
private
PageInfo
<
CustomerFortune
>
page
;
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
PageInfo
<
CustomerFortune
>
getPage
()
{
return
page
;
}
public
void
setPage
(
PageInfo
<
CustomerFortune
>
page
)
{
this
.
page
=
page
;
}
}
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneResponseVO.java
0 → 100644
View file @
f52f5c49
package
com
.
yd
.
api
.
customer
.
vo
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.api.result.CommonResult
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
public
class
CustomerFortuneResponseVO
{
private
Long
customerId
;
//客户ID
private
PageInfo
<
CustomerFortune
>
customerPage
;
private
CommonResult
commonResult
;
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
PageInfo
<
CustomerFortune
>
getCustomerPage
()
{
return
customerPage
;
}
public
void
setCustomerPage
(
PageInfo
<
CustomerFortune
>
customerPage
)
{
this
.
customerPage
=
customerPage
;
}
public
CommonResult
getCommonResult
()
{
return
commonResult
;
}
public
void
setCommonResult
(
CommonResult
commonResult
)
{
this
.
commonResult
=
commonResult
;
}
}
yd-api/src/main/java/com/yd/api/customer/vo/CustomerFortuneVO.java
0 → 100644
View file @
f52f5c49
package
com
.
yd
.
api
.
customer
.
vo
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
CustomerFortuneVO
{
private
Long
id
;
private
Long
shareId
;
private
Long
customerId
;
private
Long
orderId
;
private
Date
orderDate
;
private
BigDecimal
orderPrice
;
private
BigDecimal
referralRate
;
private
BigDecimal
referralAmount
;
private
BigDecimal
referralAmountAfterValueadded
;
private
Integer
isTax
;
private
BigDecimal
taxAmount
;
private
BigDecimal
netAmount
;
private
Long
campaignId
;
private
Date
withdrawableDate
;
private
Long
withdrawedId
;
private
Long
fortunePayedId
;
private
Date
createdAt
;
private
Long
createdBy
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getShareId
()
{
return
shareId
;
}
public
void
setShareId
(
Long
shareId
)
{
this
.
shareId
=
shareId
;
}
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
Long
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
Long
orderId
)
{
this
.
orderId
=
orderId
;
}
public
Date
getOrderDate
()
{
return
orderDate
;
}
public
void
setOrderDate
(
Date
orderDate
)
{
this
.
orderDate
=
orderDate
;
}
public
BigDecimal
getOrderPrice
()
{
return
orderPrice
;
}
public
void
setOrderPrice
(
BigDecimal
orderPrice
)
{
this
.
orderPrice
=
orderPrice
;
}
public
BigDecimal
getReferralRate
()
{
return
referralRate
;
}
public
void
setReferralRate
(
BigDecimal
referralRate
)
{
this
.
referralRate
=
referralRate
;
}
public
BigDecimal
getReferralAmount
()
{
return
referralAmount
;
}
public
void
setReferralAmount
(
BigDecimal
referralAmount
)
{
this
.
referralAmount
=
referralAmount
;
}
public
BigDecimal
getReferralAmountAfterValueadded
()
{
return
referralAmountAfterValueadded
;
}
public
void
setReferralAmountAfterValueadded
(
BigDecimal
referralAmountAfterValueadded
)
{
this
.
referralAmountAfterValueadded
=
referralAmountAfterValueadded
;
}
public
Integer
getIsTax
()
{
return
isTax
;
}
public
void
setIsTax
(
Integer
isTax
)
{
this
.
isTax
=
isTax
;
}
public
BigDecimal
getTaxAmount
()
{
return
taxAmount
;
}
public
void
setTaxAmount
(
BigDecimal
taxAmount
)
{
this
.
taxAmount
=
taxAmount
;
}
public
BigDecimal
getNetAmount
()
{
return
netAmount
;
}
public
void
setNetAmount
(
BigDecimal
netAmount
)
{
this
.
netAmount
=
netAmount
;
}
public
Long
getCampaignId
()
{
return
campaignId
;
}
public
void
setCampaignId
(
Long
campaignId
)
{
this
.
campaignId
=
campaignId
;
}
public
Date
getWithdrawableDate
()
{
return
withdrawableDate
;
}
public
void
setWithdrawableDate
(
Date
withdrawableDate
)
{
this
.
withdrawableDate
=
withdrawableDate
;
}
public
Long
getWithdrawedId
()
{
return
withdrawedId
;
}
public
void
setWithdrawedId
(
Long
withdrawedId
)
{
this
.
withdrawedId
=
withdrawedId
;
}
public
Long
getFortunePayedId
()
{
return
fortunePayedId
;
}
public
void
setFortunePayedId
(
Long
fortunePayedId
)
{
this
.
fortunePayedId
=
fortunePayedId
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Long
getCreatedBy
()
{
return
createdBy
;
}
public
void
setCreatedBy
(
Long
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
}
yd-api/src/main/java/com/yd/dataccess/entity/customer/CustomerFortune.java
0 → 100644
View file @
f52f5c49
package
com
.
yd
.
dataccess
.
entity
.
customer
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
CustomerFortune
{
private
Long
id
;
private
Long
shareId
;
private
Long
customerId
;
private
Long
orderId
;
private
Date
orderDate
;
private
BigDecimal
orderPrice
;
private
BigDecimal
referralRate
;
private
BigDecimal
referralAmount
;
private
BigDecimal
referralAmountAfterValueadded
;
private
Integer
isTax
;
private
BigDecimal
taxAmount
;
private
BigDecimal
netAmount
;
private
Long
campaignId
;
private
Date
withdrawableDate
;
private
Long
withdrawedId
;
private
Long
fortunePayedId
;
private
Date
createdAt
;
private
Long
createdBy
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getShareId
()
{
return
shareId
;
}
public
void
setShareId
(
Long
shareId
)
{
this
.
shareId
=
shareId
;
}
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
Long
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
Long
orderId
)
{
this
.
orderId
=
orderId
;
}
public
Date
getOrderDate
()
{
return
orderDate
;
}
public
void
setOrderDate
(
Date
orderDate
)
{
this
.
orderDate
=
orderDate
;
}
public
BigDecimal
getOrderPrice
()
{
return
orderPrice
;
}
public
void
setOrderPrice
(
BigDecimal
orderPrice
)
{
this
.
orderPrice
=
orderPrice
;
}
public
BigDecimal
getReferralRate
()
{
return
referralRate
;
}
public
void
setReferralRate
(
BigDecimal
referralRate
)
{
this
.
referralRate
=
referralRate
;
}
public
BigDecimal
getReferralAmount
()
{
return
referralAmount
;
}
public
void
setReferralAmount
(
BigDecimal
referralAmount
)
{
this
.
referralAmount
=
referralAmount
;
}
public
BigDecimal
getReferralAmountAfterValueadded
()
{
return
referralAmountAfterValueadded
;
}
public
void
setReferralAmountAfterValueadded
(
BigDecimal
referralAmountAfterValueadded
)
{
this
.
referralAmountAfterValueadded
=
referralAmountAfterValueadded
;
}
public
Integer
getIsTax
()
{
return
isTax
;
}
public
void
setIsTax
(
Integer
isTax
)
{
this
.
isTax
=
isTax
;
}
public
BigDecimal
getTaxAmount
()
{
return
taxAmount
;
}
public
void
setTaxAmount
(
BigDecimal
taxAmount
)
{
this
.
taxAmount
=
taxAmount
;
}
public
BigDecimal
getNetAmount
()
{
return
netAmount
;
}
public
void
setNetAmount
(
BigDecimal
netAmount
)
{
this
.
netAmount
=
netAmount
;
}
public
Long
getCampaignId
()
{
return
campaignId
;
}
public
void
setCampaignId
(
Long
campaignId
)
{
this
.
campaignId
=
campaignId
;
}
public
Date
getWithdrawableDate
()
{
return
withdrawableDate
;
}
public
void
setWithdrawableDate
(
Date
withdrawableDate
)
{
this
.
withdrawableDate
=
withdrawableDate
;
}
public
Long
getWithdrawedId
()
{
return
withdrawedId
;
}
public
void
setWithdrawedId
(
Long
withdrawedId
)
{
this
.
withdrawedId
=
withdrawedId
;
}
public
Long
getFortunePayedId
()
{
return
fortunePayedId
;
}
public
void
setFortunePayedId
(
Long
fortunePayedId
)
{
this
.
fortunePayedId
=
fortunePayedId
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Long
getCreatedBy
()
{
return
createdBy
;
}
public
void
setCreatedBy
(
Long
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dataccess/mapper/customer/CustomerFortuneMapper.java
0 → 100644
View file @
f52f5c49
package
com
.
yd
.
dataccess
.
mapper
.
customer
;
import
com.github.pagehelper.Page
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
public
interface
CustomerFortuneMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
CustomerFortune
record
);
int
insertSelective
(
CustomerFortune
record
);
CustomerFortune
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
CustomerFortune
record
);
int
updateByPrimaryKey
(
CustomerFortune
record
);
Page
<
CustomerFortune
>
selectByCustomerId
(
Long
customerId
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dataccess/service/customer/CustomerDA.java
View file @
f52f5c49
...
@@ -2,9 +2,9 @@ package com.yd.dataccess.service.customer;
...
@@ -2,9 +2,9 @@ package com.yd.dataccess.service.customer;
import
java.util.List
;
import
java.util.List
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
/**
/**
* @author Simon
* @author Simon
...
@@ -13,5 +13,8 @@ import com.yd.dataccess.entity.customer.Customer;
...
@@ -13,5 +13,8 @@ import com.yd.dataccess.entity.customer.Customer;
public
interface
CustomerDA
{
public
interface
CustomerDA
{
List
<
Customer
>
listAllCustomers
();
List
<
Customer
>
listAllCustomers
();
PageInfo
<
Customer
>
findByPage
(
int
pageNo
,
int
pageSize
);
PageInfo
<
Customer
>
findByPage
(
int
pageNo
,
int
pageSize
);
PageInfo
<
CustomerFortune
>
selectByCustomerId
(
Long
customerId
,
int
pageNo
,
int
pageSize
);
}
}
yd-api/src/main/java/com/yd/dataccess/service/customer/CustomerDAImpl.java
View file @
f52f5c49
...
@@ -7,6 +7,8 @@ import com.github.pagehelper.Page;
...
@@ -7,6 +7,8 @@ import com.github.pagehelper.Page;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.Customer
;
import
com.yd.dataccess.entity.customer.CustomerFortune
;
import
com.yd.dataccess.mapper.customer.CustomerFortuneMapper
;
import
com.yd.dataccess.mapper.customer.CustomerMapper
;
import
com.yd.dataccess.mapper.customer.CustomerMapper
;
import
com.yd.util.intercept.annotation.TargetDataSource
;
import
com.yd.util.intercept.annotation.TargetDataSource
;
import
com.yd.util.intercept.commons.DataSourceKey
;
import
com.yd.util.intercept.commons.DataSourceKey
;
...
@@ -28,6 +30,9 @@ public class CustomerDAImpl implements CustomerDA {
...
@@ -28,6 +30,9 @@ public class CustomerDAImpl implements CustomerDA {
@Resource
@Resource
private
CustomerMapper
customerMapper
;
private
CustomerMapper
customerMapper
;
@Resource
private
CustomerFortuneMapper
customerFortuneMapper
;
@Override
@Override
@TargetDataSource
(
dataSourceKey
=
DataSourceKey
.
DB_MASTER
)
@TargetDataSource
(
dataSourceKey
=
DataSourceKey
.
DB_MASTER
)
public
List
<
Customer
>
listAllCustomers
()
{
public
List
<
Customer
>
listAllCustomers
()
{
...
@@ -53,6 +58,19 @@ public class CustomerDAImpl implements CustomerDA {
...
@@ -53,6 +58,19 @@ public class CustomerDAImpl implements CustomerDA {
return
pageInfo
;
return
pageInfo
;
}
}
@Override
public
PageInfo
<
CustomerFortune
>
selectByCustomerId
(
Long
customerId
,
int
pageNo
,
int
pageSize
)
{
String
orderBy
=
"created_at desc"
;
PageHelper
.
startPage
(
pageNo
,
pageSize
,
orderBy
);
Page
<
CustomerFortune
>
destList
=
customerFortuneMapper
.
selectByCustomerId
(
customerId
);
PageInfo
<
CustomerFortune
>
pageInfo
=
new
PageInfo
<>(
destList
);
return
pageInfo
;
}
}
}
...
...
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicDataSourceAspect.java
View file @
f52f5c49
...
@@ -33,10 +33,10 @@ public class DynamicDataSourceAspect {
...
@@ -33,10 +33,10 @@ public class DynamicDataSourceAspect {
public
void
doBefore
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
public
void
doBefore
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
DataSourceKey
dataSourceKey
=
targetDataSource
.
dataSourceKey
();
DataSourceKey
dataSourceKey
=
targetDataSource
.
dataSourceKey
();
if
(
dataSourceKey
==
DataSourceKey
.
DB_MASTER
)
{
if
(
dataSourceKey
==
DataSourceKey
.
DB_MASTER
)
{
LOG
.
info
(
String
.
format
(
"
设置数据源为
%s"
,
DataSourceKey
.
DB_MASTER
));
LOG
.
info
(
String
.
format
(
"
默认数据源
%s"
,
DataSourceKey
.
DB_MASTER
));
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_MASTER
);
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_MASTER
);
}
else
if
(
dataSourceKey
==
DataSourceKey
.
DB_EGOLDEN
)
{
}
else
if
(
dataSourceKey
==
DataSourceKey
.
DB_EGOLDEN
)
{
LOG
.
info
(
String
.
format
(
"
使用默认
数据源 %s"
,
DataSourceKey
.
DB_EGOLDEN
));
LOG
.
info
(
String
.
format
(
"
设置
数据源 %s"
,
DataSourceKey
.
DB_EGOLDEN
));
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_EGOLDEN
);
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_EGOLDEN
);
}
}
}
}
...
...
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicRoutingDataSource.java
View file @
f52f5c49
...
@@ -7,7 +7,11 @@ public class DynamicRoutingDataSource extends AbstractRoutingDataSource {
...
@@ -7,7 +7,11 @@ public class DynamicRoutingDataSource extends AbstractRoutingDataSource {
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
DynamicRoutingDataSource
.
class
);
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
DynamicRoutingDataSource
.
class
);
@Override
@Override
protected
Object
determineCurrentLookupKey
()
{
protected
Object
determineCurrentLookupKey
()
{
LOG
.
info
(
"当前数据源:{}"
+
DynamicDataSourceContextHolder
.
get
());
if
(
DynamicDataSourceContextHolder
.
get
()==
null
)
{
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_MASTER
);
}
return
DynamicDataSourceContextHolder
.
get
();
return
DynamicDataSourceContextHolder
.
get
();
}
}
}
}
yd-api/src/main/resources/mapper/customer/CustomerFortuneMapper.xml
0 → 100644
View file @
f52f5c49
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yd.dataccess.mapper.customer.CustomerFortuneMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yd.dataccess.entity.customer.CustomerFortune"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"share_id"
jdbcType=
"BIGINT"
property=
"shareId"
/>
<result
column=
"customer_id"
jdbcType=
"BIGINT"
property=
"customerId"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"order_date"
jdbcType=
"TIMESTAMP"
property=
"orderDate"
/>
<result
column=
"order_price"
jdbcType=
"DECIMAL"
property=
"orderPrice"
/>
<result
column=
"referral_rate"
jdbcType=
"DECIMAL"
property=
"referralRate"
/>
<result
column=
"referral_amount"
jdbcType=
"DECIMAL"
property=
"referralAmount"
/>
<result
column=
"referral_amount_after_valueadded"
jdbcType=
"DECIMAL"
property=
"referralAmountAfterValueadded"
/>
<result
column=
"is_tax"
jdbcType=
"INTEGER"
property=
"isTax"
/>
<result
column=
"tax_amount"
jdbcType=
"DECIMAL"
property=
"taxAmount"
/>
<result
column=
"net_amount"
jdbcType=
"DECIMAL"
property=
"netAmount"
/>
<result
column=
"campaign_id"
jdbcType=
"BIGINT"
property=
"campaignId"
/>
<result
column=
"withdrawable_date"
jdbcType=
"TIMESTAMP"
property=
"withdrawableDate"
/>
<result
column=
"withdrawed_id"
jdbcType=
"BIGINT"
property=
"withdrawedId"
/>
<result
column=
"fortune_payed_id"
jdbcType=
"BIGINT"
property=
"fortunePayedId"
/>
<result
column=
"created_at"
jdbcType=
"TIMESTAMP"
property=
"createdAt"
/>
<result
column=
"created_by"
jdbcType=
"BIGINT"
property=
"createdBy"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, share_id, customer_id, order_id, order_date, order_price, referral_rate, referral_amount,
referral_amount_after_valueadded, is_tax, tax_amount, net_amount, campaign_id, withdrawable_date,
withdrawed_id, fortune_payed_id, created_at, created_by
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByCustomerId"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_acl_customer_fortune
where customer_id = #{CustomerId,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.yd.dataccess.entity.customer.CustomerFortune"
>
insert into ag_acl_customer_fortune (id, share_id, customer_id,
order_id, order_date, order_price,
referral_rate, referral_amount, referral_amount_after_valueadded,
is_tax, tax_amount, net_amount,
campaign_id, withdrawable_date, withdrawed_id,
fortune_payed_id, created_at, created_by
)
values (#{id,jdbcType=BIGINT}, #{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT},
#{orderId,jdbcType=BIGINT}, #{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL},
#{referralRate,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL}, #{referralAmountAfterValueadded,jdbcType=DECIMAL},
#{isTax,jdbcType=INTEGER}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL},
#{campaignId,jdbcType=BIGINT}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawedId,jdbcType=BIGINT},
#{fortunePayedId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.yd.dataccess.entity.customer.CustomerFortune"
>
insert into ag_acl_customer_fortune
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"shareId != null"
>
share_id,
</if>
<if
test=
"customerId != null"
>
customer_id,
</if>
<if
test=
"orderId != null"
>
order_id,
</if>
<if
test=
"orderDate != null"
>
order_date,
</if>
<if
test=
"orderPrice != null"
>
order_price,
</if>
<if
test=
"referralRate != null"
>
referral_rate,
</if>
<if
test=
"referralAmount != null"
>
referral_amount,
</if>
<if
test=
"referralAmountAfterValueadded != null"
>
referral_amount_after_valueadded,
</if>
<if
test=
"isTax != null"
>
is_tax,
</if>
<if
test=
"taxAmount != null"
>
tax_amount,
</if>
<if
test=
"netAmount != null"
>
net_amount,
</if>
<if
test=
"campaignId != null"
>
campaign_id,
</if>
<if
test=
"withdrawableDate != null"
>
withdrawable_date,
</if>
<if
test=
"withdrawedId != null"
>
withdrawed_id,
</if>
<if
test=
"fortunePayedId != null"
>
fortune_payed_id,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"createdBy != null"
>
created_by,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"shareId != null"
>
#{shareId,jdbcType=BIGINT},
</if>
<if
test=
"customerId != null"
>
#{customerId,jdbcType=BIGINT},
</if>
<if
test=
"orderId != null"
>
#{orderId,jdbcType=BIGINT},
</if>
<if
test=
"orderDate != null"
>
#{orderDate,jdbcType=TIMESTAMP},
</if>
<if
test=
"orderPrice != null"
>
#{orderPrice,jdbcType=DECIMAL},
</if>
<if
test=
"referralRate != null"
>
#{referralRate,jdbcType=DECIMAL},
</if>
<if
test=
"referralAmount != null"
>
#{referralAmount,jdbcType=DECIMAL},
</if>
<if
test=
"referralAmountAfterValueadded != null"
>
#{referralAmountAfterValueadded,jdbcType=DECIMAL},
</if>
<if
test=
"isTax != null"
>
#{isTax,jdbcType=INTEGER},
</if>
<if
test=
"taxAmount != null"
>
#{taxAmount,jdbcType=DECIMAL},
</if>
<if
test=
"netAmount != null"
>
#{netAmount,jdbcType=DECIMAL},
</if>
<if
test=
"campaignId != null"
>
#{campaignId,jdbcType=BIGINT},
</if>
<if
test=
"withdrawableDate != null"
>
#{withdrawableDate,jdbcType=TIMESTAMP},
</if>
<if
test=
"withdrawedId != null"
>
#{withdrawedId,jdbcType=BIGINT},
</if>
<if
test=
"fortunePayedId != null"
>
#{fortunePayedId,jdbcType=BIGINT},
</if>
<if
test=
"createdAt != null"
>
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"createdBy != null"
>
#{createdBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yd.dataccess.entity.customer.CustomerFortune"
>
update ag_acl_customer_fortune
<set>
<if
test=
"shareId != null"
>
share_id = #{shareId,jdbcType=BIGINT},
</if>
<if
test=
"customerId != null"
>
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if
test=
"orderId != null"
>
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if
test=
"orderDate != null"
>
order_date = #{orderDate,jdbcType=TIMESTAMP},
</if>
<if
test=
"orderPrice != null"
>
order_price = #{orderPrice,jdbcType=DECIMAL},
</if>
<if
test=
"referralRate != null"
>
referral_rate = #{referralRate,jdbcType=DECIMAL},
</if>
<if
test=
"referralAmount != null"
>
referral_amount = #{referralAmount,jdbcType=DECIMAL},
</if>
<if
test=
"referralAmountAfterValueadded != null"
>
referral_amount_after_valueadded = #{referralAmountAfterValueadded,jdbcType=DECIMAL},
</if>
<if
test=
"isTax != null"
>
is_tax = #{isTax,jdbcType=INTEGER},
</if>
<if
test=
"taxAmount != null"
>
tax_amount = #{taxAmount,jdbcType=DECIMAL},
</if>
<if
test=
"netAmount != null"
>
net_amount = #{netAmount,jdbcType=DECIMAL},
</if>
<if
test=
"campaignId != null"
>
campaign_id = #{campaignId,jdbcType=BIGINT},
</if>
<if
test=
"withdrawableDate != null"
>
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
</if>
<if
test=
"withdrawedId != null"
>
withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
</if>
<if
test=
"fortunePayedId != null"
>
fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT},
</if>
<if
test=
"createdAt != null"
>
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"createdBy != null"
>
created_by = #{createdBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yd.dataccess.entity.customer.CustomerFortune"
>
update ag_acl_customer_fortune
set share_id = #{shareId,jdbcType=BIGINT},
customer_id = #{customerId,jdbcType=BIGINT},
order_id = #{orderId,jdbcType=BIGINT},
order_date = #{orderDate,jdbcType=TIMESTAMP},
order_price = #{orderPrice,jdbcType=DECIMAL},
referral_rate = #{referralRate,jdbcType=DECIMAL},
referral_amount = #{referralAmount,jdbcType=DECIMAL},
referral_amount_after_valueadded = #{referralAmountAfterValueadded,jdbcType=DECIMAL},
is_tax = #{isTax,jdbcType=INTEGER},
tax_amount = #{taxAmount,jdbcType=DECIMAL},
net_amount = #{netAmount,jdbcType=DECIMAL},
campaign_id = #{campaignId,jdbcType=BIGINT},
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
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