Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
5b9213f2
Commit
5b9213f2
authored
Jun 30, 2023
by
Zheng Jie
Browse files
代码优化
parent
a74cf51c
Changes
47
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java
View file @
5b9213f2
...
@@ -54,4 +54,10 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
...
@@ -54,4 +54,10 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
return
new
PageResult
<>(
list
,
totalElements
);
return
new
PageResult
<>(
list
,
totalElements
);
}
}
/**
* 返回空数据
*/
public
static
<
T
>
PageResult
<
T
>
noData
()
{
return
new
PageResult
<>(
null
,
0
);
}
}
}
eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java
View file @
5b9213f2
...
@@ -39,7 +39,7 @@ public class GenConfigController {
...
@@ -39,7 +39,7 @@ public class GenConfigController {
@ApiOperation
(
"查询"
)
@ApiOperation
(
"查询"
)
@GetMapping
(
value
=
"/{tableName}"
)
@GetMapping
(
value
=
"/{tableName}"
)
public
ResponseEntity
<
Object
>
queryGenConfig
(
@PathVariable
String
tableName
){
public
ResponseEntity
<
GenConfig
>
queryGenConfig
(
@PathVariable
String
tableName
){
return
new
ResponseEntity
<>(
genConfigService
.
find
(
tableName
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
genConfigService
.
find
(
tableName
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java
View file @
5b9213f2
...
@@ -19,9 +19,11 @@ import io.swagger.annotations.Api;
...
@@ -19,9 +19,11 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.utils.PageResult
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.PageUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -55,16 +57,16 @@ public class GeneratorController {
...
@@ -55,16 +57,16 @@ public class GeneratorController {
@ApiOperation
(
"查询数据库数据"
)
@ApiOperation
(
"查询数据库数据"
)
@GetMapping
(
value
=
"/tables"
)
@GetMapping
(
value
=
"/tables"
)
public
ResponseEntity
<
Object
>
queryTables
(
@RequestParam
(
defaultValue
=
""
)
String
name
,
public
ResponseEntity
<
PageResult
<
TableInfo
>
>
queryTables
(
@RequestParam
(
defaultValue
=
""
)
String
name
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
){
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
){
int
[]
startEnd
=
PageUtil
.
transToStartEnd
(
page
,
size
);
int
[]
startEnd
=
PageUtil
.
transToStartEnd
(
page
,
size
);
return
new
ResponseEntity
<>(
generatorService
.
getTables
(
name
,
startEnd
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
generatorService
.
getTables
(
name
,
startEnd
),
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"查询字段数据"
)
@ApiOperation
(
"查询字段数据"
)
@GetMapping
(
value
=
"/columns"
)
@GetMapping
(
value
=
"/columns"
)
public
ResponseEntity
<
Object
>
queryColumns
(
@RequestParam
String
tableName
){
public
ResponseEntity
<
PageResult
<
ColumnInfo
>
>
queryColumns
(
@RequestParam
String
tableName
){
List
<
ColumnInfo
>
columnInfos
=
generatorService
.
getColumns
(
tableName
);
List
<
ColumnInfo
>
columnInfos
=
generatorService
.
getColumns
(
tableName
);
return
new
ResponseEntity
<>(
PageUtil
.
toPage
(
columnInfos
,
columnInfos
.
size
()),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
PageUtil
.
toPage
(
columnInfos
,
columnInfos
.
size
()),
HttpStatus
.
OK
);
}
}
...
...
eladmin-generator/src/main/java/me/zhengjie/service/GeneratorService.java
View file @
5b9213f2
...
@@ -17,6 +17,8 @@ package me.zhengjie.service;
...
@@ -17,6 +17,8 @@ package me.zhengjie.service;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -35,7 +37,7 @@ public interface GeneratorService {
...
@@ -35,7 +37,7 @@ public interface GeneratorService {
* @param startEnd 分页参数
* @param startEnd 分页参数
* @return /
* @return /
*/
*/
Object
getTables
(
String
name
,
int
[]
startEnd
);
PageResult
<
TableInfo
>
getTables
(
String
name
,
int
[]
startEnd
);
/**
/**
* 得到数据表的元数据
* 得到数据表的元数据
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GeneratorServiceImpl.java
View file @
5b9213f2
...
@@ -25,10 +25,7 @@ import me.zhengjie.domain.vo.TableInfo;
...
@@ -25,10 +25,7 @@ import me.zhengjie.domain.vo.TableInfo;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.repository.ColumnInfoRepository
;
import
me.zhengjie.repository.ColumnInfoRepository
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.utils.GenUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -71,7 +68,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -71,7 +68,7 @@ public class GeneratorServiceImpl implements GeneratorService {
}
}
@Override
@Override
public
Object
getTables
(
String
name
,
int
[]
startEnd
)
{
public
PageResult
<
TableInfo
>
getTables
(
String
name
,
int
[]
startEnd
)
{
// 使用预编译防止sql注入
// 使用预编译防止sql注入
String
sql
=
"select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables "
+
String
sql
=
"select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables "
+
"where table_schema = (select database()) "
+
"where table_schema = (select database()) "
+
...
...
eladmin-logging/src/main/java/me/zhengjie/rest/SysLogController.java
View file @
5b9213f2
...
@@ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor;
...
@@ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.service.SysLogService
;
import
me.zhengjie.service.SysLogService
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogSmallDto
;
import
me.zhengjie.utils.PageResult
;
import
me.zhengjie.utils.SecurityUtils
;
import
me.zhengjie.utils.SecurityUtils
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -69,7 +71,7 @@ public class SysLogController {
...
@@ -69,7 +71,7 @@ public class SysLogController {
@GetMapping
(
value
=
"/user"
)
@GetMapping
(
value
=
"/user"
)
@ApiOperation
(
"用户日志查询"
)
@ApiOperation
(
"用户日志查询"
)
public
ResponseEntity
<
Object
>
queryUserLog
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
SysLogSmallDto
>
>
queryUserLog
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
){
criteria
.
setLogType
(
"INFO"
);
criteria
.
setLogType
(
"INFO"
);
criteria
.
setUsername
(
SecurityUtils
.
getCurrentUsername
());
criteria
.
setUsername
(
SecurityUtils
.
getCurrentUsername
());
return
new
ResponseEntity
<>(
sysLogService
.
queryAllByUser
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
sysLogService
.
queryAllByUser
(
criteria
,
pageable
),
HttpStatus
.
OK
);
...
...
eladmin-logging/src/main/java/me/zhengjie/service/SysLogService.java
View file @
5b9213f2
...
@@ -17,6 +17,8 @@ package me.zhengjie.service;
...
@@ -17,6 +17,8 @@ package me.zhengjie.service;
import
me.zhengjie.domain.SysLog
;
import
me.zhengjie.domain.SysLog
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogSmallDto
;
import
me.zhengjie.utils.PageResult
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
...
@@ -52,7 +54,7 @@ public interface SysLogService {
...
@@ -52,7 +54,7 @@ public interface SysLogService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return -
* @return -
*/
*/
Object
queryAllByUser
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
SysLogSmallDto
>
queryAllByUser
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 保存日志数据
* 保存日志数据
...
...
eladmin-logging/src/main/java/me/zhengjie/service/impl/SysLogServiceImpl.java
View file @
5b9213f2
...
@@ -24,6 +24,7 @@ import me.zhengjie.domain.SysLog;
...
@@ -24,6 +24,7 @@ import me.zhengjie.domain.SysLog;
import
me.zhengjie.repository.LogRepository
;
import
me.zhengjie.repository.LogRepository
;
import
me.zhengjie.service.SysLogService
;
import
me.zhengjie.service.SysLogService
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogQueryCriteria
;
import
me.zhengjie.service.dto.SysLogSmallDto
;
import
me.zhengjie.service.mapstruct.LogErrorMapper
;
import
me.zhengjie.service.mapstruct.LogErrorMapper
;
import
me.zhengjie.service.mapstruct.LogSmallMapper
;
import
me.zhengjie.service.mapstruct.LogSmallMapper
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.utils.*
;
...
@@ -60,7 +61,7 @@ public class SysLogServiceImpl implements SysLogService {
...
@@ -60,7 +61,7 @@ public class SysLogServiceImpl implements SysLogService {
if
(
status
.
equals
(
criteria
.
getLogType
()))
{
if
(
status
.
equals
(
criteria
.
getLogType
()))
{
return
PageUtil
.
toPage
(
page
.
map
(
logErrorMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
logErrorMapper:
:
toDto
));
}
}
return
page
;
return
PageUtil
.
toPage
(
page
)
;
}
}
@Override
@Override
...
@@ -69,7 +70,7 @@ public class SysLogServiceImpl implements SysLogService {
...
@@ -69,7 +70,7 @@ public class SysLogServiceImpl implements SysLogService {
}
}
@Override
@Override
public
Object
queryAllByUser
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
)
{
public
PageResult
<
SysLogSmallDto
>
queryAllByUser
(
SysLogQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
SysLog
>
page
=
logRepository
.
findAll
(((
root
,
criteriaQuery
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
cb
)),
pageable
);
Page
<
SysLog
>
page
=
logRepository
.
findAll
(((
root
,
criteriaQuery
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
cb
)),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
logSmallMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
logSmallMapper:
:
toDto
));
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java
View file @
5b9213f2
...
@@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
...
@@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.service.AppService
;
import
me.zhengjie.modules.mnt.service.AppService
;
import
me.zhengjie.modules.mnt.service.dto.AppDto
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -54,7 +56,7 @@ public class AppController {
...
@@ -54,7 +56,7 @@ public class AppController {
@ApiOperation
(
value
=
"查询应用"
)
@ApiOperation
(
value
=
"查询应用"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('app:list')"
)
@PreAuthorize
(
"@el.check('app:list')"
)
public
ResponseEntity
<
Object
>
queryApp
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
AppDto
>
>
queryApp
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
appService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
appService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java
View file @
5b9213f2
...
@@ -26,6 +26,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
...
@@ -26,6 +26,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.util.SqlUtils
;
import
me.zhengjie.modules.mnt.util.SqlUtils
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -62,7 +63,7 @@ public class DatabaseController {
...
@@ -62,7 +63,7 @@ public class DatabaseController {
@ApiOperation
(
value
=
"查询数据库"
)
@ApiOperation
(
value
=
"查询数据库"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('database:list')"
)
@PreAuthorize
(
"@el.check('database:list')"
)
public
ResponseEntity
<
Object
>
queryDatabase
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
DatabaseDto
>
>
queryDatabase
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
databaseService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
databaseService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java
View file @
5b9213f2
...
@@ -22,8 +22,10 @@ import me.zhengjie.annotation.Log;
...
@@ -22,8 +22,10 @@ import me.zhengjie.annotation.Log;
import
me.zhengjie.modules.mnt.domain.Deploy
;
import
me.zhengjie.modules.mnt.domain.Deploy
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.service.DeployService
;
import
me.zhengjie.modules.mnt.service.DeployService
;
import
me.zhengjie.modules.mnt.service.dto.DeployDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -64,7 +66,7 @@ public class DeployController {
...
@@ -64,7 +66,7 @@ public class DeployController {
@ApiOperation
(
value
=
"查询部署"
)
@ApiOperation
(
value
=
"查询部署"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('deploy:list')"
)
@PreAuthorize
(
"@el.check('deploy:list')"
)
public
ResponseEntity
<
Object
>
queryDeployData
(
DeployQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
DeployDto
>
>
queryDeployData
(
DeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
deployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
deployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java
View file @
5b9213f2
...
@@ -20,7 +20,9 @@ import io.swagger.annotations.ApiOperation;
...
@@ -20,7 +20,9 @@ import io.swagger.annotations.ApiOperation;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.modules.mnt.service.DeployHistoryService
;
import
me.zhengjie.modules.mnt.service.DeployHistoryService
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -52,7 +54,7 @@ public class DeployHistoryController {
...
@@ -52,7 +54,7 @@ public class DeployHistoryController {
@ApiOperation
(
value
=
"查询部署历史"
)
@ApiOperation
(
value
=
"查询部署历史"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('deployHistory:list')"
)
@PreAuthorize
(
"@el.check('deployHistory:list')"
)
public
ResponseEntity
<
Object
>
queryDeployHistory
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
DeployHistoryDto
>
>
queryDeployHistory
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
deployhistoryService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
deployhistoryService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java
View file @
5b9213f2
...
@@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
...
@@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.service.ServerDeployService
;
import
me.zhengjie.modules.mnt.service.ServerDeployService
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployDto
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -54,7 +56,7 @@ public class ServerDeployController {
...
@@ -54,7 +56,7 @@ public class ServerDeployController {
@ApiOperation
(
value
=
"查询服务器"
)
@ApiOperation
(
value
=
"查询服务器"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('serverDeploy:list')"
)
@PreAuthorize
(
"@el.check('serverDeploy:list')"
)
public
ResponseEntity
<
Object
>
queryServerDeploy
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
ServerDeployDto
>
>
queryServerDeploy
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
serverDeployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
serverDeployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.service.dto.AppDto
;
import
me.zhengjie.modules.mnt.service.dto.AppDto
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -37,7 +38,7 @@ public interface AppService {
...
@@ -37,7 +38,7 @@ public interface AppService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
AppDto
>
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部数据
* 查询全部数据
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import
me.zhengjie.modules.mnt.domain.Database
;
import
me.zhengjie.modules.mnt.domain.Database
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseDto
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseDto
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -37,7 +38,7 @@ public interface DatabaseService {
...
@@ -37,7 +38,7 @@ public interface DatabaseService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
DatabaseDto
>
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部
* 查询全部
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -36,7 +37,7 @@ public interface DeployHistoryService {
...
@@ -36,7 +37,7 @@ public interface DeployHistoryService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
DeployHistoryDto
>
queryAll
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部
* 查询全部
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java
View file @
5b9213f2
...
@@ -19,6 +19,7 @@ import me.zhengjie.modules.mnt.domain.Deploy;
...
@@ -19,6 +19,7 @@ import me.zhengjie.modules.mnt.domain.Deploy;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.service.dto.DeployDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployDto
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -38,7 +39,7 @@ public interface DeployService {
...
@@ -38,7 +39,7 @@ public interface DeployService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
DeployQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
DeployDto
>
queryAll
(
DeployQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部数据
* 查询全部数据
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployDto
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployDto
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -37,7 +38,7 @@ public interface ServerDeployService {
...
@@ -37,7 +38,7 @@ public interface ServerDeployService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
ServerDeployDto
>
queryAll
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部数据
* 查询全部数据
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java
View file @
5b9213f2
...
@@ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.AppService;
...
@@ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.AppService;
import
me.zhengjie.modules.mnt.service.dto.AppDto
;
import
me.zhengjie.modules.mnt.service.dto.AppDto
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.modules.mnt.service.mapstruct.AppMapper
;
import
me.zhengjie.modules.mnt.service.mapstruct.AppMapper
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -47,7 +44,7 @@ public class AppServiceImpl implements AppService {
...
@@ -47,7 +44,7 @@ public class AppServiceImpl implements AppService {
private
final
AppMapper
appMapper
;
private
final
AppMapper
appMapper
;
@Override
@Override
public
Object
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
public
PageResult
<
AppDto
>
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
App
>
page
=
appRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
Page
<
App
>
page
=
appRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
appMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
appMapper:
:
toDto
));
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java
View file @
5b9213f2
...
@@ -25,10 +25,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
...
@@ -25,10 +25,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.service.mapstruct.DatabaseMapper
;
import
me.zhengjie.modules.mnt.service.mapstruct.DatabaseMapper
;
import
me.zhengjie.modules.mnt.util.SqlUtils
;
import
me.zhengjie.modules.mnt.util.SqlUtils
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -50,7 +47,7 @@ public class DatabaseServiceImpl implements DatabaseService {
...
@@ -50,7 +47,7 @@ public class DatabaseServiceImpl implements DatabaseService {
private
final
DatabaseMapper
databaseMapper
;
private
final
DatabaseMapper
databaseMapper
;
@Override
@Override
public
Object
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
public
PageResult
<
DatabaseDto
>
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
Database
>
page
=
databaseRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
Page
<
Database
>
page
=
databaseRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
databaseMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
databaseMapper:
:
toDto
));
}
}
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
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