Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
a571f762
Commit
a571f762
authored
Dec 16, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新修改gateway代码
parent
2e756f4b
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
249 additions
and
375 deletions
+249
-375
OpenApiRequest.java
...y/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
+5
-5
GatewayController.java
...src/main/java/com/jz/dm/controller/GatewayController.java
+1
-0
CheckArgsFilter.java
...teway/src/main/java/com/jz/dm/filter/CheckArgsFilter.java
+14
-17
CheckPostSizeFilter.java
...y/src/main/java/com/jz/dm/filter/CheckPostSizeFilter.java
+6
-2
CheckTimestampFilter.java
.../src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
+17
-22
FilterChainFactory.java
...ay/src/main/java/com/jz/dm/filter/FilterChainFactory.java
+1
-1
FilterChainImpl.java
...teway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
+1
-0
InvokeRouteFilter.java
...way/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
+18
-17
SignatureFilter.java
...teway/src/main/java/com/jz/dm/filter/SignatureFilter.java
+143
-143
VerifySignFilter.java
...eway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
+11
-58
DefaultOpenApiDispatcher.java
...main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
+3
-4
OpenApiDispatcher.java
...ay/src/main/java/com/jz/dm/gateway/OpenApiDispatcher.java
+3
-2
OpenApiService.java
...teway/src/main/java/com/jz/dm/gateway/OpenApiService.java
+1
-1
ApiWhiteServiceImpl.java
...main/java/com/jz/dm/gateway/impl/ApiWhiteServiceImpl.java
+0
-72
GatewayServiceImpl.java
.../main/java/com/jz/dm/gateway/impl/GatewayServiceImpl.java
+1
-0
DispatchContext.java
...ateway/src/main/java/com/jz/dm/model/DispatchContext.java
+6
-6
GatewayRequest.java
...gateway/src/main/java/com/jz/dm/model/GatewayRequest.java
+1
-13
GatewayResultCode.java
...rc/main/java/com/jz/dm/model/enums/GatewayResultCode.java
+1
-7
RouteType.java
...ateway/src/main/java/com/jz/dm/model/enums/RouteType.java
+9
-1
AccountAddService.java
...ay/src/main/java/com/jz/dm/service/AccountAddService.java
+5
-2
ParamNameAnnotationBinder.java
.../java/com/jz/dm/web/binder/ParamNameAnnotationBinder.java
+1
-0
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+0
-2
application.yml
jz-dm-apigateway/src/main/resources/application.yml
+1
-0
No files found.
jz-dm-apigateway/src/main/java/com/jz/dm/common/util/OpenApiRequest.java
View file @
a571f762
...
@@ -16,7 +16,7 @@ import java.util.Map;
...
@@ -16,7 +16,7 @@ import java.util.Map;
*/
*/
public
class
OpenApiRequest
{
public
class
OpenApiRequest
{
private
String
app
Id
;
private
String
app
Key
;
private
String
openApiParams
;
private
String
openApiParams
;
...
@@ -40,12 +40,12 @@ public class OpenApiRequest {
...
@@ -40,12 +40,12 @@ public class OpenApiRequest {
}
}
}
}
public
String
getApp
Id
()
{
public
String
getApp
Key
()
{
return
app
Id
;
return
app
Key
;
}
}
public
void
setApp
Id
(
String
appId
)
{
public
void
setApp
Key
(
String
appKey
)
{
this
.
app
Id
=
appId
;
this
.
app
Key
=
appKey
;
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/controller/GatewayController.java
View file @
a571f762
...
@@ -48,6 +48,7 @@ public class GatewayController {
...
@@ -48,6 +48,7 @@ public class GatewayController {
RequestContext
requestContext
=
RequestContext
.
getCurrentContext
();
RequestContext
requestContext
=
RequestContext
.
getCurrentContext
();
requestContext
.
setRequest
(
httpServletRequest
);
requestContext
.
setRequest
(
httpServletRequest
);
requestContext
.
setResponse
(
httpServletResponse
);
requestContext
.
setResponse
(
httpServletResponse
);
System
.
out
.
println
(
"经过了controller~~~~~~~~~~~~~~~~~~~~"
);
GatewayResponse
gatewayResponse
=
gatewayService
.
invoke
(
gatewayRequest
);
GatewayResponse
gatewayResponse
=
gatewayService
.
invoke
(
gatewayRequest
);
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
convertResponse
(
result
,
gatewayResponse
);
convertResponse
(
result
,
gatewayResponse
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckArgsFilter.java
View file @
a571f762
...
@@ -20,16 +20,25 @@ import java.nio.charset.Charset;
...
@@ -20,16 +20,25 @@ import java.nio.charset.Charset;
@Component
@Component
public
class
CheckArgsFilter
extends
AbstractFilter
{
public
class
CheckArgsFilter
extends
AbstractFilter
{
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_2
;
}
@Override
public
String
getFilterName
()
{
return
"CheckArgsFilter"
;
}
@Override
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
FilterChain
chain
)
{
// 校验参数非空
// 校验参数非空
if
(
StringUtil
.
isEmpty
(
request
.
getAppKey
())
||
StringUtil
.
isEmpty
(
request
.
getMethod
())
if
(
StringUtil
.
isEmpty
(
request
.
getAppKey
())
||
StringUtil
.
isEmpty
(
request
.
getMethod
())
||
StringUtil
.
isEmpty
(
request
.
getCharset
())
||
StringUtil
.
isEmpty
(
request
.
getSignType
())
||
StringUtil
.
isEmpty
(
request
.
getCharset
())
||
StringUtil
.
isEmpty
(
request
.
getSignType
())
||
StringUtil
.
isEmpty
(
request
.
getSign
())
||
StringUtil
.
isEmpty
(
request
.
getTimestamp
())
||
StringUtil
.
isEmpty
(
request
.
getSign
())
||
StringUtil
.
isEmpty
(
request
.
getTimestamp
())
||
StringUtil
.
isEmpty
(
request
.
getVersion
())
||
StringUtil
.
isEmpty
(
request
.
getVersion
())
||
StringUtil
.
isEmpty
(
request
.
getParams
()))
{
||
StringUtil
.
isEmpty
(
request
.
getParams
()))
{
//无效参数
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
}
}
...
@@ -39,27 +48,15 @@ public class CheckArgsFilter extends AbstractFilter {
...
@@ -39,27 +48,15 @@ public class CheckArgsFilter extends AbstractFilter {
}
}
try
{
try
{
Format
.
valueOf
(
request
.
getFormat
());
Format
.
valueOf
(
request
.
getFormat
());
//格式,目前仅支持JSON
Charset
.
forName
(
request
.
getCharset
());
Charset
.
forName
(
request
.
getCharset
());
//请求使用的编码格式,如UTF-8,GBK,GB2312等
SignType
.
valueOf
(
request
.
getSignType
());
SignType
.
valueOf
(
request
.
getSignType
());
//生成签名字符串所使用的签名算法类型
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
//无效参数
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
}
}
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_2
;
}
@Override
public
String
getFilterName
()
{
return
"CheckArgsFilter"
;
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckPostSizeFilter.java
View file @
a571f762
...
@@ -12,12 +12,16 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -12,12 +12,16 @@ import javax.servlet.http.HttpServletRequest;
/**
/**
* 检查提交数据大小
* 检查提交数据大小
*
*
@author key
*/
*/
@Component
(
"CheckPostSizeFilter"
)
@Component
(
"CheckPostSizeFilter"
)
public
class
CheckPostSizeFilter
extends
AbstractFilter
{
public
class
CheckPostSizeFilter
extends
AbstractFilter
{
/**
* 过滤器名称
* @return
*/
@Override
@Override
public
String
getFilterName
()
{
public
String
getFilterName
()
{
return
"CheckPostSizeFilter"
;
return
"CheckPostSizeFilter"
;
...
@@ -25,7 +29,7 @@ public class CheckPostSizeFilter extends AbstractFilter {
...
@@ -25,7 +29,7 @@ public class CheckPostSizeFilter extends AbstractFilter {
/**
/**
*
@see org.springframework.core.Ordered#getOrder()
*
过滤器执行顺序
*/
*/
@Override
@Override
public
int
getOrder
()
{
public
int
getOrder
()
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/CheckTimestampFilter.java
View file @
a571f762
...
@@ -15,42 +15,37 @@ import org.springframework.stereotype.Component;
...
@@ -15,42 +15,37 @@ import org.springframework.stereotype.Component;
@Component
@Component
public
class
CheckTimestampFilter
extends
AbstractFilter
{
public
class
CheckTimestampFilter
extends
AbstractFilter
{
//@Value("${api.skipFilter}")
private
boolean
skipFilter
;
/**
/**
* 时间戳超时分钟,10分钟
* 时间戳超时分钟,10分钟
*/
*/
private
static
final
long
max
=
1000
*
60
*
10
;
//10分钟
//private static final long max = 1000 * 60 * 10; //10分钟
private
static
final
long
max
=
1000
*
60
*
60
*
24
;
//10分钟
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_3
;
}
@Override
public
String
getFilterName
()
{
return
"CheckTimestampFilter"
;
}
@Override
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
if
(!
skipFilter
)
{
String
timestamp
=
request
.
getTimestamp
();
String
timestamp
=
request
.
getTimestamp
();
long
time
=
0
;
long
time
=
0
;
try
{
try
{
time
=
Long
.
valueOf
(
timestamp
);
time
=
Long
.
valueOf
(
timestamp
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_ARGUMENT
);
//无效参数
}
}
if
(
System
.
currentTimeMillis
()
-
time
>
max
)
{
//无效时间戳
//if (System.currentTimeMillis() - time > max) {
throw
new
GatewayException
(
GatewayResultCode
.
ILLEGAL_TIMETEMP
);
// throw new GatewayException(GatewayResultCode.ILLEGAL_TIMETEMP);//无效时间戳
}
//}
}
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_5
;
}
@Override
public
String
getFilterName
()
{
return
"CheckTimestampFilter"
;
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainFactory.java
View file @
a571f762
...
@@ -7,7 +7,7 @@ import java.util.List;
...
@@ -7,7 +7,7 @@ import java.util.List;
/**
/**
* 过滤链工厂
* 过滤链工厂
*
*
@author key
*/
*/
@Component
@Component
public
class
FilterChainFactory
{
public
class
FilterChainFactory
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/FilterChainImpl.java
View file @
a571f762
...
@@ -15,6 +15,7 @@ import java.util.List;
...
@@ -15,6 +15,7 @@ import java.util.List;
/**
/**
* 过滤链
* 过滤链
*
*
* @author key
*/
*/
public
class
FilterChainImpl
implements
FilterChain
{
public
class
FilterChainImpl
implements
FilterChain
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/InvokeRouteFilter.java
View file @
a571f762
...
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
...
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
/**
/**
* 网关路由过滤器
* 网关路由过滤器
*
*
* @author key
*/
*/
@Component
@Component
public
class
InvokeRouteFilter
extends
AbstractFilter
{
public
class
InvokeRouteFilter
extends
AbstractFilter
{
...
@@ -27,6 +28,16 @@ public class InvokeRouteFilter extends AbstractFilter {
...
@@ -27,6 +28,16 @@ public class InvokeRouteFilter extends AbstractFilter {
@Autowired
@Autowired
DefaultOpenApiDispatcher
defaultOpenApiDispatcher
;
DefaultOpenApiDispatcher
defaultOpenApiDispatcher
;
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_6
;
}
@Override
public
String
getFilterName
()
{
return
"InvokeRouteFilter"
;
}
@Override
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
FilterChain
chain
)
{
...
@@ -44,11 +55,13 @@ public class InvokeRouteFilter extends AbstractFilter {
...
@@ -44,11 +55,13 @@ public class InvokeRouteFilter extends AbstractFilter {
}
}
DispatchContext
context
=
new
DispatchContext
();
DispatchContext
context
=
new
DispatchContext
();
context
.
setAppId
(
request
.
getAppKey
());
context
.
setAppKey
(
request
.
getAppKey
());
//apiKey
context
.
setApplication
(
openApi
.
getApplication
());
context
.
setApplication
(
openApi
.
getApplication
());
//应用
context
.
setOpenApiMethod
(
request
.
getMethod
());
//context.setApplication(openApi.getApplication());//应用
context
.
setOpenApiParams
(
request
.
getParams
());
context
.
setOpenApiMethod
(
request
.
getMethod
());
//方法 例如:tradd.add
context
.
setOpenApiVersion
(
request
.
getVersion
());
context
.
setOpenApiParams
(
request
.
getParams
());
//入参
context
.
setOpenApiVersion
(
request
.
getVersion
());
//版本号
//扩展参数
for
(
GatewayRequest
.
Attribute
attribute
:
request
.
getExtAttributes
().
values
())
{
for
(
GatewayRequest
.
Attribute
attribute
:
request
.
getExtAttributes
().
values
())
{
if
(
attribute
!=
null
&&
attribute
.
isPass
)
{
if
(
attribute
!=
null
&&
attribute
.
isPass
)
{
context
.
setExtAttribute
(
attribute
.
name
,
attribute
.
value
);
context
.
setExtAttribute
(
attribute
.
name
,
attribute
.
value
);
...
@@ -67,17 +80,5 @@ public class InvokeRouteFilter extends AbstractFilter {
...
@@ -67,17 +80,5 @@ public class InvokeRouteFilter extends AbstractFilter {
}
}
}
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_6
;
}
@Override
public
String
getFilterName
()
{
return
"InvokeRouteFilter"
;
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/SignatureFilter.java
View file @
a571f762
...
@@ -17,146 +17,146 @@ import org.springframework.util.CollectionUtils;
...
@@ -17,146 +17,146 @@ import org.springframework.util.CollectionUtils;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
/**
/
//
**
* 签名过滤器
//
* 签名过滤器
*/
//
*/
@Component
//
@Component
public
class
SignatureFilter
extends
AbstractFilter
{
//
public class SignatureFilter extends AbstractFilter {
//
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SignatureFilter
.
class
);
//
private static final Logger LOGGER = LoggerFactory.getLogger(SignatureFilter.class);
//
// @Autowired
//
// @Autowired
// private IApiWhiteService apiWhiteService;
//
// private IApiWhiteService apiWhiteService;
// @Value("${secret_private}")
//
// @Value("${secret_private}")
// private String secretPrivate;
//
// private String secretPrivate;
//
private
String
encryptData
;
//
private String encryptData;
//
@Override
//
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
//
protected void internalDoFilter(GatewayRequest request, GatewayResponse response,
FilterChain
chain
)
{
//
FilterChain chain) {
try
{
//
try {
chain
.
doFilter
(
request
,
response
);
//
chain.doFilter(request, response);
}
finally
{
//
} finally {
String
responseJson
=
null
;
//
String responseJson = null;
String
sign
=
StringUtil
.
EMPTY_STRING
;
//
String sign = StringUtil.EMPTY_STRING;
String
privatekey
=
null
;
//
String privatekey = null;
if
(
StringUtil
.
isEmpty
(
request
.
getAppKey
()))
{
//
if (StringUtil.isEmpty(request.getAppKey())) {
return
;
//
return;
}
//
}
//ApiWhite apiWhite = apiWhiteService.byMerchantId(request.getAppId());
//
//ApiWhite apiWhite = apiWhiteService.byMerchantId(request.getAppId());
//if (apiWhite == null) {
//
//if (apiWhite == null) {
// return;
//
// return;
//}
//
//}
//是否提供密码
//
//是否提供密码
//boolean providePublicKey = false;
//
//boolean providePublicKey = false;
//if ("0".equals(apiWhite.getProvideSecret())) {
//
//if ("0".equals(apiWhite.getProvideSecret())) {
// privatekey = apiWhite.getSecretKey();
//
// privatekey = apiWhite.getSecretKey();
//} else if ("1".equals(apiWhite.getProvideSecret())) {
//
//} else if ("1".equals(apiWhite.getProvideSecret())) {
// privatekey = secretPrivate;
//
// privatekey = secretPrivate;
// providePublicKey = true;
//
// providePublicKey = true;
//}
//
//}
try
{
//
try {
responseJson
=
JsonUtil
.
toJSONString
(
response
.
getResponse
(),
//
responseJson = JsonUtil.toJSONString(response.getResponse(),
PropertyNamingStrategy
.
SnakeCase
);
//
PropertyNamingStrategy.SnakeCase);
if
(
StringUtil
.
isNotEmpty
(
request
.
getSignType
()))
{
//
if (StringUtil.isNotEmpty(request.getSignType())) {
String
charset
=
request
.
getCharset
();
//
String charset = request.getCharset();
if
(
StringUtil
.
isEmpty
(
charset
))
{
//
if (StringUtil.isEmpty(charset)) {
charset
=
Constants
.
CHARSET_UTF8
;
//
charset = Constants.CHARSET_UTF8;
}
//
}
//
//if (providePublicKey) {
//
//if (providePublicKey) {
// sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
//
// sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
//} else {
//
//} else {
// sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
//
// sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
//}
//
//}
}
//
}
}
catch
(
JSONException
e
)
{
//
} catch (JSONException e) {
LogUtil
.
error
(
LOGGER
,
e
,
//
LogUtil.error(LOGGER, e,
"serializer response to json string error. response="
+
response
.
getResponse
());
//
"serializer response to json string error. response=" + response.getResponse());
response
.
clearAttributes
();
//
response.clearAttributes();
response
.
setCode
(
OpenApiResultCode
.
RESPONSE_DATA_FORMAT_ERROR
.
getCode
());
//
response.setCode(OpenApiResultCode.RESPONSE_DATA_FORMAT_ERROR.getCode());
response
.
setMsg
(
OpenApiResultCode
.
RESPONSE_DATA_FORMAT_ERROR
.
getMsg
());
//
response.setMsg(OpenApiResultCode.RESPONSE_DATA_FORMAT_ERROR.getMsg());
// sign = signatureException(request, response, privatekey, providePublicKey);
//
// sign = signatureException(request, response, privatekey, providePublicKey);
}
catch
(
SignatureException
ex
)
{
//
} catch (SignatureException ex) {
LogUtil
.
error
(
LOGGER
,
ex
,
//
LogUtil.error(LOGGER, ex,
"sign response error. response="
+
response
.
getResponse
());
//
"sign response error. response=" + response.getResponse());
response
.
clearAttributes
();
//
response.clearAttributes();
response
.
setCode
(
ex
.
getResultCode
().
getCode
());
//
response.setCode(ex.getResultCode().getCode());
response
.
setMsg
(
ex
.
getResultCode
().
getMsg
());
//
response.setMsg(ex.getResultCode().getMsg());
}
catch
(
Throwable
ex
)
{
//
} catch (Throwable ex) {
LogUtil
.
error
(
LOGGER
,
ex
,
//
LogUtil.error(LOGGER, ex,
"signatureFilter doFilter error. response="
+
response
.
getResponse
());
//
"signatureFilter doFilter error. response=" + response.getResponse());
response
.
clearAttributes
();
//
response.clearAttributes();
response
.
setCode
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getCode
());
//
response.setCode(GatewayResultCode.UNKNOWN_EXCEPTION.getCode());
response
.
setMsg
(
GatewayResultCode
.
UNKNOWN_EXCEPTION
.
getMsg
());
//
response.setMsg(GatewayResultCode.UNKNOWN_EXCEPTION.getMsg());
// sign = signatureException(request, response, privatekey, providePublicKey);
//
// sign = signatureException(request, response, privatekey, providePublicKey);
}
//
}
response
.
setSign
(
sign
);
//
response.setSign(sign);
//if (apiWhite.getIsEncrypt()) {
//
//if (apiWhite.getIsEncrypt()) {
// response.setEncryptData(encryptData);
//
// response.setEncryptData(encryptData);
//}
//
//}
}
//
}
}
//
}
//
private
Map
<
String
,
Object
>
convertResult
(
Map
<
String
,
Object
>
attributes
,
GatewayResponse
response
)
{
//
private Map<String, Object> convertResult(Map<String, Object> attributes, GatewayResponse response) {
Map
<
String
,
Object
>
mapResult
=
new
HashMap
<>();
//
Map<String, Object> mapResult = new HashMap<>();
mapResult
.
put
(
"code"
,
response
.
getCode
());
//
mapResult.put("code", response.getCode());
mapResult
.
put
(
"msg"
,
response
.
getMsg
());
//
mapResult.put("msg", response.getMsg());
Object
code
=
attributes
.
get
(
"code"
);
//
Object code = attributes.get("code");
Object
msg
=
attributes
.
get
(
"msg"
);
//
Object msg = attributes.get("msg");
attributes
.
remove
(
"code"
);
//
attributes.remove("code");
attributes
.
remove
(
"msg"
);
//
attributes.remove("msg");
if
(!
CollectionUtils
.
isEmpty
(
attributes
))
{
//
if (!CollectionUtils.isEmpty(attributes)) {
mapResult
.
put
(
"data"
,
JsonUtil
.
toJSONString
(
attributes
,
PropertyNamingStrategy
.
SnakeCase
));
//
mapResult.put("data", JsonUtil.toJSONString(attributes, PropertyNamingStrategy.SnakeCase));
//if (apiWhite.getIsEncrypt()) {
//
//if (apiWhite.getIsEncrypt()) {
// String string = (String) mapResult.get("data");
//
// String string = (String) mapResult.get("data");
// try {
//
// try {
// RSAPrivateKey privateKey = RSAUtils.getPrivateKey(secretPrivate);
//
// RSAPrivateKey privateKey = RSAUtils.getPrivateKey(secretPrivate);
// String encrypt = RSAUtils.privateEncrypt(string, privateKey);
//
// String encrypt = RSAUtils.privateEncrypt(string, privateKey);
// mapResult.put("data", encrypt);
//
// mapResult.put("data", encrypt);
// encryptData = encrypt;
//
// encryptData = encrypt;
// } catch (Exception e) {
//
// } catch (Exception e) {
// e.printStackTrace();
//
// e.printStackTrace();
// }
//
// }
//}
//
//}
}
//
}
attributes
.
put
(
"code"
,
code
);
//
attributes.put("code", code);
attributes
.
put
(
"msg"
,
msg
);
//
attributes.put("msg", msg);
return
mapResult
;
//
return mapResult;
}
//
}
//
private
String
signatureException
(
GatewayRequest
request
,
GatewayResponse
response
,
//
private String signatureException(GatewayRequest request, GatewayResponse response,
String
privateKey
,
boolean
providePublicKey
)
{
//
String privateKey, boolean providePublicKey) {
String
responseJson
=
null
;
//
String responseJson = null;
String
sign
=
StringUtil
.
EMPTY_STRING
;
//
String sign = StringUtil.EMPTY_STRING;
try
{
//
try {
responseJson
=
JsonUtil
.
toJSONString
(
response
.
getResponse
(),
//
responseJson = JsonUtil.toJSONString(response.getResponse(),
PropertyNamingStrategy
.
SnakeCase
);
//
PropertyNamingStrategy.SnakeCase);
}
catch
(
JSONException
e1
)
{
//
} catch (JSONException e1) {
LogUtil
.
error
(
LOGGER
,
e1
,
//
LogUtil.error(LOGGER, e1,
"serializer response to json string error. response="
+
response
.
getResponse
());
//
"serializer response to json string error. response=" + response.getResponse());
return
sign
;
//
return sign;
}
//
}
try
{
//
try {
sign
=
SignatureUtil
.
sign
(
responseJson
,
privateKey
,
request
.
getCharset
(),
SignType
.
valueOf
(
request
.
getSignType
()),
SignatureUtil
.
SIGN_REQUEST
,
providePublicKey
);
//
sign = SignatureUtil.sign(responseJson, privateKey, request.getCharset(), SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
}
catch
(
SignatureException
ex
)
{
//
} catch (SignatureException ex) {
LogUtil
.
error
(
LOGGER
,
ex
,
"sign response error. response="
+
response
.
getResponse
());
//
LogUtil.error(LOGGER, ex, "sign response error. response=" + response.getResponse());
}
//
}
return
sign
;
//
return sign;
}
//
}
//
/**
//
/**
* @see org.springframework.core.Ordered#getOrder()
//
* @see org.springframework.core.Ordered#getOrder()
*/
//
*/
@Override
//
@Override
public
int
getOrder
()
{
//
public int getOrder() {
return
Constants
.
FILTER_ORDER_0
;
//
return Constants.FILTER_ORDER_0;
}
//
}
//
@Override
//
@Override
public
String
getFilterName
()
{
//
public String getFilterName() {
return
"SignatureFilter"
;
//
return "SignatureFilter";
}
//
}
//
}
//
}
jz-dm-apigateway/src/main/java/com/jz/dm/filter/VerifySignFilter.java
View file @
a571f762
...
@@ -22,74 +22,27 @@ public class VerifySignFilter extends AbstractFilter {
...
@@ -22,74 +22,27 @@ public class VerifySignFilter extends AbstractFilter {
//@Autowired
//@Autowired
//private IApiWhiteService apiWhiteService;
//private IApiWhiteService apiWhiteService;
//@Value("${api.skipFilter}")
private
boolean
skipFilter
;
private
final
static
String
CHARSET
=
"UTF-8"
;
private
final
static
String
CHARSET
=
"UTF-8"
;
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_4
;
}
@Override
public
String
getFilterName
()
{
return
"VerifySignFilter"
;
}
@Override
@Override
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
protected
void
internalDoFilter
(
GatewayRequest
request
,
GatewayResponse
response
,
FilterChain
chain
)
{
FilterChain
chain
)
{
HddHashMap
params
=
new
HddHashMap
();
params
.
put
(
"app_id"
,
request
.
getAppKey
());
params
.
put
(
"method"
,
request
.
getMethod
());
params
.
put
(
"charset"
,
request
.
getCharset
());
params
.
put
(
"sign"
,
request
.
getSign
());
params
.
put
(
"sign_type"
,
request
.
getSignType
());
params
.
put
(
"timestamp"
,
request
.
getTimestamp
());
params
.
put
(
"version"
,
request
.
getVersion
());
params
.
put
(
"params"
,
request
.
getParams
());
//ApiWhite apiWhite = apiWhiteService.byMerchantId(request.getAppId());
//if (apiWhite != null) {
// String publicKey = apiWhite.getSecretKey();
//
// if (!skipFilter) {
// boolean verify = SignatureUtil.verify(params, publicKey, request.getCharset(), SignType.valueOf(request.getSignType()));
// if (!verify) {
// throw new SignatureException(OpenApiResultCode.SIGN_VERIFY_ERROR);
// }
//
// //参数解密
// if (apiWhite.getIsEncrypt()) {
// String decryptParams = decryptParams(request.getParams(), publicKey);
// request.setParams(decryptParams);
// }
// }
//}
// 后期再扩展
// 后期再扩展
OpenApi
openApi
=
new
OpenApi
();
OpenApi
openApi
=
new
OpenApi
();
openApi
.
setApplication
(
"HDD_API_GATEWAY"
);
openApi
.
setApplication
(
"JZ_API_GATEWAY"
);
//应用
openApi
.
setRouteType
(
RouteType
.
SRPING
);
openApi
.
setRouteType
(
RouteType
.
SPRINGBOOT
);
//漏油类型
//openApi.setRouteType(RouteType.SRPING);//漏油类型
RequestContext
.
getCurrentContext
().
set
(
"openApi"
,
openApi
);
RequestContext
.
getCurrentContext
().
set
(
"openApi"
,
openApi
);
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
}
private
String
decryptParams
(
String
params
,
String
publicKey
)
{
log
.
info
(
"解密前请求参数,{}"
,
params
);
try
{
RSAPublicKey
key
=
RSAUtils
.
getPublicKey
(
publicKey
);
String
decrypt
=
RSAUtils
.
publicDecrypt
(
params
,
key
);
log
.
info
(
"解密后请求参数,{}"
,
decrypt
);
return
decrypt
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* @see org.springframework.core.Ordered#getOrder()
*/
@Override
public
int
getOrder
()
{
return
Constants
.
FILTER_ORDER_4
;
}
@Override
public
String
getFilterName
()
{
return
"VerifySignFilter"
;
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/DefaultOpenApiDispatcher.java
View file @
a571f762
...
@@ -34,7 +34,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -34,7 +34,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
/**
/**
* 服务注入可参考: /openapi-demo/src/main/resources/META-INF/application-context.xml
* 服务注入可参考: /openapi-demo/src/main/resources/META-INF/application-context.xml
* @param openApiServiceList
* @param openApiServiceList
* <pre>
* <pre>
* <!-- 定义开放接口服务 -->
* <!-- 定义开放接口服务 -->
* <bean id="addUserOpenApiService" class="com.xxx.openapi.demo.openapi.AddUserOpenApiService" />
* <bean id="addUserOpenApiService" class="com.xxx.openapi.demo.openapi.AddUserOpenApiService" />
...
@@ -44,8 +44,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -44,8 +44,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
@Resource
@Resource
public
void
setOpenApiServices
(
List
<
OpenApiService
>
openApiServiceList
)
{
public
void
setOpenApiServices
(
List
<
OpenApiService
>
openApiServiceList
)
{
for
(
OpenApiService
openApiService
:
openApiServiceList
)
{
for
(
OpenApiService
openApiService
:
openApiServiceList
)
{
String
openApiServiceKey
=
getOpenApiServiceKey
(
openApiService
.
getOpenApiMethod
(),
String
openApiServiceKey
=
getOpenApiServiceKey
(
openApiService
.
getOpenApiMethod
(),
openApiService
.
getOpenApiVersion
());
openApiService
.
getOpenApiVersion
());
openApiServices
.
put
(
openApiServiceKey
,
openApiService
);
openApiServices
.
put
(
openApiServiceKey
,
openApiService
);
}
}
}
}
...
@@ -69,7 +68,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
...
@@ -69,7 +68,7 @@ public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
try
{
try
{
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
OpenApiRequest
request
=
new
OpenApiRequest
(
context
.
getOpenApiParams
());
request
.
setApp
Id
(
context
.
getAppId
());
request
.
setApp
Key
(
context
.
getAppKey
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
request
.
setExtAttributes
(
context
.
getExtAttributes
());
openApiService
.
doService
(
request
,
response
);
openApiService
.
doService
(
request
,
response
);
}
catch
(
Throwable
ex
)
{
}
catch
(
Throwable
ex
)
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/OpenApiDispatcher.java
View file @
a571f762
...
@@ -6,14 +6,15 @@ import com.jz.dm.model.DispatchContext;
...
@@ -6,14 +6,15 @@ import com.jz.dm.model.DispatchContext;
/**
/**
* openapi分发器
* openapi分发器
*
*
* @author key
*/
*/
public
interface
OpenApiDispatcher
{
public
interface
OpenApiDispatcher
{
/**
/**
* openapi dispatch
* openapi dispatch
*
*
* @param context dispatch context
* @param context dispatch context
*
*
* @return
* @return
*/
*/
public
String
doDispatch
(
DispatchContext
context
);
public
String
doDispatch
(
DispatchContext
context
);
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/OpenApiService.java
View file @
a571f762
...
@@ -6,7 +6,7 @@ import com.jz.dm.common.util.OpenApiResponse;
...
@@ -6,7 +6,7 @@ import com.jz.dm.common.util.OpenApiResponse;
/**
/**
* openapi服务
* openapi服务
*
*
@author key
*/
*/
public
interface
OpenApiService
{
public
interface
OpenApiService
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/impl/ApiWhiteServiceImpl.java
deleted
100644 → 0
View file @
2e756f4b
/**
* Copyright (c) 2011-2019 All Rights Reserved.
*/
package
com
.
jz
.
dm
.
gateway
.
impl
;
/**
* API白名单表 服务实现类
*
* @author zengxx
* @version $Id: ApiWhiteServiceImpl.java 2020-04-02 $
*/
//@Service("apiWhiteService")
//public class ApiWhiteServiceImpl implements IApiWhiteService {
//@Resource
//private ApiWhiteMapper apiWhiteMapper;
//@Resource
//private MeasureRecordMapper measureRecordMapper;
//
//@Override
//public ApiWhite byMerchantId(String merchantId) throws TtyException {
// return apiWhiteMapper.byMerchantId(merchantId);
//}
//
//@Override
//@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
//public long adjustAmt(String merchantId, long amt) {
// if (amt == 0) {
// return amt;
// }
// BigDecimal adjustAmt = new BigDecimal(amt).divide(new BigDecimal(100));
// ApiWhite apiWhite = apiWhiteMapper.byMerchantId(merchantId);
// long result = apiWhiteMapper.adjustAmt(merchantId, adjustAmt);
// if (result != 1) {
// return 0;
// } else {
// MeasureRecord measure = new MeasureRecord();
// //已用金额
// BigDecimal sumUseAmt = apiWhiteMapper.sumUseAmt(merchantId);
// if (sumUseAmt == null) {
// sumUseAmt = BigDecimal.ZERO;
// }
// if (amt > 0) {
// measure.setChangType("0");
// measure.setUseAmount(sumUseAmt.subtract(adjustAmt));
// } else {
// measure.setChangType("1");
// measure.setUseAmount(sumUseAmt.add(adjustAmt.abs()));
// }
// measure.setChangeAmount(adjustAmt.abs());
// measure.setAfterAmount(apiWhite.getUsableAmount().add(adjustAmt));
//
// measure.setMerchantId(apiWhite.getMerchantId());
// measure.setName(apiWhite.getName());
// measure.setBeforeAmount(apiWhite.getUsableAmount());
// measure.setChangDate(LocalDateTime.now());
// measure.setCreateUser("API");
// measure.setCreateDate(LocalDateTime.now());
// //插入流水信息
// if (measureRecordMapper.insert(measure) > 0) {
// return 1;
// }
// }
// return 0;
//}
//@Override
//@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
//public void invoke3bcCount(String merchantId) {
// apiWhiteMapper.invoke3bcCount(merchantId);
//}
//}
jz-dm-apigateway/src/main/java/com/jz/dm/gateway/impl/GatewayServiceImpl.java
View file @
a571f762
...
@@ -24,6 +24,7 @@ public class GatewayServiceImpl implements GatewayService {
...
@@ -24,6 +24,7 @@ public class GatewayServiceImpl implements GatewayService {
@Override
@Override
public
GatewayResponse
invoke
(
GatewayRequest
gatewayRequest
)
{
public
GatewayResponse
invoke
(
GatewayRequest
gatewayRequest
)
{
GatewayResponse
gatewayResponse
=
new
GatewayResponse
();
GatewayResponse
gatewayResponse
=
new
GatewayResponse
();
System
.
out
.
println
(
"经过了网关服务~~~~~~~~~~~~~~~~~~~~"
);
FilterChain
filterChain
=
filterChainFactory
.
getFilterChain
();
FilterChain
filterChain
=
filterChainFactory
.
getFilterChain
();
filterChain
.
doFilter
(
gatewayRequest
,
gatewayResponse
);
filterChain
.
doFilter
(
gatewayRequest
,
gatewayResponse
);
return
gatewayResponse
;
return
gatewayResponse
;
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/DispatchContext.java
View file @
a571f762
...
@@ -17,7 +17,7 @@ public class DispatchContext implements Serializable {
...
@@ -17,7 +17,7 @@ public class DispatchContext implements Serializable {
/**
/**
* 商户应用id
* 商户应用id
*/
*/
private
String
app
Id
;
private
String
app
Key
;
/**
/**
* 应用
* 应用
...
@@ -49,17 +49,17 @@ public class DispatchContext implements Serializable {
...
@@ -49,17 +49,17 @@ public class DispatchContext implements Serializable {
*
*
* @return property value of appId
* @return property value of appId
*/
*/
public
String
getApp
Id
()
{
public
String
getApp
Key
()
{
return
app
Id
;
return
app
Key
;
}
}
/**
/**
* Setter method for property <tt>appId</tt>.
* Setter method for property <tt>appId</tt>.
*
*
* @param app
Id
value to be assigned to property appId
* @param app
Key
value to be assigned to property appId
*/
*/
public
void
setApp
Id
(
String
appId
)
{
public
void
setApp
Key
(
String
appKey
)
{
this
.
app
Id
=
appId
;
this
.
app
Key
=
appKey
;
}
}
/**
/**
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/GatewayRequest.java
View file @
a571f762
...
@@ -56,18 +56,6 @@ public class GatewayRequest implements Serializable {
...
@@ -56,18 +56,6 @@ public class GatewayRequest implements Serializable {
*/
*/
private
String
version
;
private
String
version
;
///**
// * 回调通知地址
// */
//@ParamName("notify_url")
//private String notifyUrl;
///**
// * 返回地址
// */
//@ParamName("return_url")
//private String returnUrl;
/**
/**
* 请求参数,JSON格式
* 请求参数,JSON格式
*/
*/
...
@@ -312,7 +300,7 @@ public class GatewayRequest implements Serializable {
...
@@ -312,7 +300,7 @@ public class GatewayRequest implements Serializable {
*/
*/
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"GatewayRequest [app
Id
="
+
appKey
+
", method="
+
method
+
", format="
+
format
return
"GatewayRequest [app
Key
="
+
appKey
+
", method="
+
method
+
", format="
+
format
+
", charset="
+
charset
+
", signType="
+
signType
+
", sign="
+
sign
+
", charset="
+
charset
+
", signType="
+
signType
+
", sign="
+
sign
+
", timestamp="
+
timestamp
+
", version="
+
version
+
", timestamp="
+
timestamp
+
", version="
+
version
+
", params="
+
params
+
", extAttributes="
+
", params="
+
params
+
", extAttributes="
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/enums/GatewayResultCode.java
View file @
a571f762
...
@@ -54,13 +54,7 @@ public enum GatewayResultCode implements ResultCode {
...
@@ -54,13 +54,7 @@ public enum GatewayResultCode implements ResultCode {
POST_DATA_TOO_LARGE
(
"POST_DATA_TOO_LARGE"
,
"提交数据过大"
),
POST_DATA_TOO_LARGE
(
"POST_DATA_TOO_LARGE"
,
"提交数据过大"
),
/** 调用转发异常 */
/** 调用转发异常 */
DISPATCHER_EXCEPTION
(
"DISPATCHER_EXCEPTION"
,
"调用转发异常"
),
DISPATCHER_EXCEPTION
(
"DISPATCHER_EXCEPTION"
,
"调用转发异常"
);
/*账户不存在*/
ACCOUNT_EXIST
(
"ACCOUNT_EXIST"
,
"账户信息不存在"
);
;
/**
/**
* 初始化保存到map里方便根据code获取
* 初始化保存到map里方便根据code获取
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/model/enums/RouteType.java
View file @
a571f762
...
@@ -2,7 +2,15 @@ package com.jz.dm.model.enums;
...
@@ -2,7 +2,15 @@ package com.jz.dm.model.enums;
/**
/**
* 路由类型
* 路由类型
* @author key
*/
*/
public
enum
RouteType
{
public
enum
RouteType
{
SRPING
/**
* 漏油类型
*/
SRPING
,
/**
* 路由网关
*/
SPRINGBOOT
;
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/service/AccountAddService.java
View file @
a571f762
...
@@ -3,22 +3,25 @@ package com.jz.dm.service;
...
@@ -3,22 +3,25 @@ package com.jz.dm.service;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiRequest
;
import
com.jz.dm.common.util.OpenApiResponse
;
import
com.jz.dm.common.util.OpenApiResponse
;
import
com.jz.dm.gateway.OpenApiService
;
import
com.jz.dm.gateway.OpenApiService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
@Service
@Service
@Slf4j
public
class
AccountAddService
implements
OpenApiService
{
public
class
AccountAddService
implements
OpenApiService
{
@Override
@Override
public
String
getOpenApiMethod
()
{
public
String
getOpenApiMethod
()
{
return
"
account.add
"
;
return
"
query
"
;
}
}
@Override
@Override
public
String
getOpenApiVersion
()
{
public
String
getOpenApiVersion
()
{
return
"1.0.0"
;
return
"
V
1.0.0"
;
}
}
@Override
@Override
public
void
doService
(
OpenApiRequest
request
,
OpenApiResponse
response
)
{
public
void
doService
(
OpenApiRequest
request
,
OpenApiResponse
response
)
{
System
.
out
.
println
(
"请求过来了。。。。。"
);
System
.
out
.
println
(
"请求过来了。。。。。"
);
System
.
out
.
println
(
request
);
}
}
}
}
jz-dm-apigateway/src/main/java/com/jz/dm/web/binder/ParamNameAnnotationBinder.java
View file @
a571f762
...
@@ -9,6 +9,7 @@ import java.util.Map;
...
@@ -9,6 +9,7 @@ import java.util.Map;
/**
/**
* 参数名注解绑定
* 参数名注解绑定
*
*
* @author key
*/
*/
public
class
ParamNameAnnotationBinder
extends
ExtendedServletRequestDataBinder
{
public
class
ParamNameAnnotationBinder
extends
ExtendedServletRequestDataBinder
{
...
...
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
a571f762
...
@@ -47,5 +47,3 @@ spring:
...
@@ -47,5 +47,3 @@ spring:
# 日志用的filter:log4j
# 日志用的filter:log4j
# 防御sql注入的filter:wall
# 防御sql注入的filter:wall
filters
:
stat
filters
:
stat
# ====================MybatisPlus====================
jz-dm-apigateway/src/main/resources/application.yml
View file @
a571f762
...
@@ -19,6 +19,7 @@ spring:
...
@@ -19,6 +19,7 @@ spring:
active
:
test
#默认使用的配置文件
active
:
test
#默认使用的配置文件
# ====================MybatisPlus====================
mybatis-plus
:
mybatis-plus
:
# 如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
# 如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
# 如果是放在resource目录 classpath:/mapper/*Mapper.xml
# 如果是放在resource目录 classpath:/mapper/*Mapper.xml
...
...
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