Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
integration
Commits
a8d42a77
Commit
a8d42a77
authored
Feb 27, 2026
by
wujipeng
Browse files
依赖优化
parent
e9febf2f
Changes
5
Show whitespace changes
Inline
Side-by-side
pom.xml
View file @
a8d42a77
...
@@ -5,8 +5,13 @@
...
@@ -5,8 +5,13 @@
<groupId>
com.ruzhoukj
</groupId>
<groupId>
com.ruzhoukj
</groupId>
<artifactId>
integration
</artifactId>
<artifactId>
integration
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<version>
0.0.1-SNAPSHOT
</version>
<name>
integration
</name>
<description>
integration
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.7.6
</version>
</parent>
<properties>
<properties>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
@@ -26,15 +31,15 @@
...
@@ -26,15 +31,15 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.
platform
</groupId>
<groupId>
com.
ruzhoukj
</groupId>
<artifactId>
common-
core
</artifactId>
<artifactId>
common-
swagger
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.
ruzhoukj
</groupId>
<groupId>
com.
baomidou
</groupId>
<artifactId>
common-swagg
er
</artifactId>
<artifactId>
mybatis-plus-boot-start
er
</artifactId>
<version>
1.0
.0
</version>
<version>
3.4
.0
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
src/main/java/com/ruzhoukj/integration/IntegrationApplication.java
View file @
a8d42a77
package
com.ruzhoukj.integration
;
package
com.ruzhoukj.integration
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
@SpringBootApplication
@SpringBootApplication
@MapperScan
(
"com.ruzhoukj.integration.mapper"
)
public
class
IntegrationApplication
{
public
class
IntegrationApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/ruzhoukj/integration/controller/MetaDataController.java
View file @
a8d42a77
package
com.ruzhoukj.integration.controller
;
package
com.ruzhoukj.integration.controller
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.ruzhoukj.integration.pojo.vo.MetaDataVO
;
import
com.ruzhoukj.integration.pojo.vo.MetaDataVO
;
import
com.ruzhoukj.integration.result.Result
;
import
com.ruzhoukj.integration.service.MetaDataService
;
import
com.ruzhoukj.integration.service.MetaDataService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -21,7 +20,7 @@ import java.util.List;
...
@@ -21,7 +20,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/meta/data"
)
@RequestMapping
(
"/meta/data"
)
public
class
MetaDataController
extends
BaseController
{
public
class
MetaDataController
{
@Resource
@Resource
private
MetaDataService
metaDataService
;
private
MetaDataService
metaDataService
;
...
@@ -29,7 +28,7 @@ public class MetaDataController extends BaseController {
...
@@ -29,7 +28,7 @@ public class MetaDataController extends BaseController {
@ApiOperation
(
"获取上游数据"
)
@ApiOperation
(
"获取上游数据"
)
@GetMapping
(
"/up/{id}"
)
@GetMapping
(
"/up/{id}"
)
public
Result
<
List
<
MetaDataVO
>>
getUpDataById
(
@PathVariable
String
id
)
{
public
Result
<
List
<
MetaDataVO
>>
getUpDataById
(
@PathVariable
String
id
)
{
return
Result
.
data
(
metaDataService
.
getUpDataById
(
id
));
return
Result
.
success
(
metaDataService
.
getUpDataById
(
id
));
}
}
...
...
src/main/java/com/ruzhoukj/integration/result/Result.java
0 → 100644
View file @
a8d42a77
package
com.ruzhoukj.integration.result
;
import
lombok.Data
;
import
org.springframework.http.HttpStatus
;
import
java.io.Serializable
;
/**
* 统一响应结果封装类
*/
@Data
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 响应码
*/
private
Integer
code
;
/**
* 响应消息
*/
private
String
message
;
/**
* 响应数据
*/
private
T
data
;
/**
* 响应时间戳
*/
private
Long
timestamp
;
/**
* 请求路径
*/
private
String
path
;
/**
* 构造方法
*/
private
Result
()
{
this
.
timestamp
=
System
.
currentTimeMillis
();
}
/**
* 成功响应
*/
public
static
<
T
>
Result
<
T
>
success
()
{
return
success
(
null
);
}
public
static
<
T
>
Result
<
T
>
success
(
T
data
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
HttpStatus
.
OK
.
value
());
result
.
setMessage
(
"操作成功"
);
result
.
setData
(
data
);
return
result
;
}
public
static
<
T
>
Result
<
T
>
success
(
T
data
,
String
message
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
HttpStatus
.
OK
.
value
());
result
.
setMessage
(
message
);
result
.
setData
(
data
);
return
result
;
}
/**
* 失败响应
*/
public
static
<
T
>
Result
<
T
>
error
()
{
return
error
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
"操作失败"
);
}
public
static
<
T
>
Result
<
T
>
error
(
String
message
)
{
return
error
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
message
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
code
,
String
message
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
code
);
result
.
setMessage
(
message
);
return
result
;
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
code
,
String
message
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
code
);
result
.
setMessage
(
message
);
result
.
setData
(
data
);
return
result
;
}
/**
* 通用状态码响应
*/
public
static
<
T
>
Result
<
T
>
of
(
HttpStatus
status
,
String
message
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
status
.
value
());
result
.
setMessage
(
message
);
result
.
setData
(
data
);
return
result
;
}
public
static
<
T
>
Result
<
T
>
of
(
HttpStatus
status
,
String
message
)
{
return
of
(
status
,
message
,
null
);
}
/**
* 便捷方法
*/
public
static
<
T
>
Result
<
T
>
ok
()
{
return
success
();
}
public
static
<
T
>
Result
<
T
>
ok
(
T
data
)
{
return
success
(
data
);
}
public
static
<
T
>
Result
<
T
>
ok
(
T
data
,
String
message
)
{
return
success
(
data
,
message
);
}
/**
* 链式调用设置路径
*/
public
Result
<
T
>
path
(
String
path
)
{
this
.
setPath
(
path
);
return
this
;
}
/**
* 判断是否成功
*/
public
Boolean
isSuccess
()
{
return
HttpStatus
.
OK
.
value
()
==
this
.
code
;
}
}
\ No newline at end of file
src/main/java/com/ruzhoukj/integration/result/ResultCode.java
0 → 100644
View file @
a8d42a77
package
com.ruzhoukj.integration.result
;
/**
* 响应状态码枚举
*/
public
enum
ResultCode
{
SUCCESS
(
200
,
"操作成功"
),
FAILED
(
500
,
"操作失败"
),
VALIDATE_FAILED
(
400
,
"参数检验失败"
),
UNAUTHORIZED
(
401
,
"暂未登录或token已经过期"
),
FORBIDDEN
(
403
,
"没有相关权限"
),
NOT_FOUND
(
404
,
"资源不存在"
),
BAD_REQUEST
(
400
,
"错误的请求"
),
METHOD_NOT_ALLOWED
(
405
,
"请求方法不支持"
),
UNSUPPORTED_MEDIA_TYPE
(
415
,
"不支持的媒体类型"
),
INTERNAL_SERVER_ERROR
(
500
,
"服务器内部错误"
),
SERVICE_UNAVAILABLE
(
503
,
"服务不可用"
);
private
Integer
code
;
private
String
message
;
ResultCode
(
Integer
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
Integer
getCode
()
{
return
code
;
}
public
String
getMessage
()
{
return
message
;
}
}
\ 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