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
"eladmin-common/vscode:/vscode.git/clone" did not exist on "49fb71ea4e4d0b61eda1e00d07feda9404b5607f"
Commit
5b9213f2
authored
Jun 30, 2023
by
Zheng Jie
Browse files
代码优化
parent
a74cf51c
Changes
47
Hide whitespace changes
Inline
Side-by-side
eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java
View file @
5b9213f2
...
@@ -20,8 +20,10 @@ import me.zhengjie.annotation.Log;
...
@@ -20,8 +20,10 @@ import me.zhengjie.annotation.Log;
import
me.zhengjie.domain.LocalStorage
;
import
me.zhengjie.domain.LocalStorage
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.service.LocalStorageService
;
import
me.zhengjie.service.LocalStorageService
;
import
me.zhengjie.service.dto.LocalStorageDto
;
import
me.zhengjie.service.dto.LocalStorageQueryCriteria
;
import
me.zhengjie.service.dto.LocalStorageQueryCriteria
;
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
;
...
@@ -48,7 +50,7 @@ public class LocalStorageController {
...
@@ -48,7 +50,7 @@ public class LocalStorageController {
@GetMapping
@GetMapping
@ApiOperation
(
"查询文件"
)
@ApiOperation
(
"查询文件"
)
@PreAuthorize
(
"@el.check('storage:list')"
)
@PreAuthorize
(
"@el.check('storage:list')"
)
public
ResponseEntity
<
Object
>
queryFile
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
LocalStorageDto
>
>
queryFile
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
localStorageService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
localStorageService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
@@ -69,7 +71,7 @@ public class LocalStorageController {
...
@@ -69,7 +71,7 @@ public class LocalStorageController {
@ApiOperation
(
"上传图片"
)
@ApiOperation
(
"上传图片"
)
@PostMapping
(
"/pictures"
)
@PostMapping
(
"/pictures"
)
public
ResponseEntity
<
Object
>
uploadPicture
(
@RequestParam
MultipartFile
file
){
public
ResponseEntity
<
LocalStorage
>
uploadPicture
(
@RequestParam
MultipartFile
file
){
// 判断文件是否为图片
// 判断文件是否为图片
String
suffix
=
FileUtil
.
getExtensionName
(
file
.
getOriginalFilename
());
String
suffix
=
FileUtil
.
getExtensionName
(
file
.
getOriginalFilename
());
if
(!
FileUtil
.
IMAGE
.
equals
(
FileUtil
.
getFileType
(
suffix
))){
if
(!
FileUtil
.
IMAGE
.
equals
(
FileUtil
.
getFileType
(
suffix
))){
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
5b9213f2
...
@@ -24,6 +24,7 @@ import me.zhengjie.domain.QiniuConfig;
...
@@ -24,6 +24,7 @@ import me.zhengjie.domain.QiniuConfig;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.QiNiuService
;
import
me.zhengjie.service.QiNiuService
;
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
;
...
@@ -50,7 +51,7 @@ public class QiniuController {
...
@@ -50,7 +51,7 @@ public class QiniuController {
private
final
QiNiuService
qiNiuService
;
private
final
QiNiuService
qiNiuService
;
@GetMapping
(
value
=
"/config"
)
@GetMapping
(
value
=
"/config"
)
public
ResponseEntity
<
Object
>
queryQiNiuConfig
(){
public
ResponseEntity
<
QiniuConfig
>
queryQiNiuConfig
(){
return
new
ResponseEntity
<>(
qiNiuService
.
find
(),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
qiNiuService
.
find
(),
HttpStatus
.
OK
);
}
}
...
@@ -71,7 +72,7 @@ public class QiniuController {
...
@@ -71,7 +72,7 @@ public class QiniuController {
@ApiOperation
(
"查询文件"
)
@ApiOperation
(
"查询文件"
)
@GetMapping
@GetMapping
public
ResponseEntity
<
Object
>
queryQiNiu
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
PageResult
<
QiniuContent
>
>
queryQiNiu
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
qiNiuService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
qiNiuService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/service/EmailService.java
View file @
5b9213f2
...
@@ -43,7 +43,6 @@ public interface EmailService {
...
@@ -43,7 +43,6 @@ public interface EmailService {
* 发送邮件
* 发送邮件
* @param emailVo 邮件发送的内容
* @param emailVo 邮件发送的内容
* @param emailConfig 邮件配置
* @param emailConfig 邮件配置
* @throws Exception /
*/
*/
void
send
(
EmailVo
emailVo
,
EmailConfig
emailConfig
);
void
send
(
EmailVo
emailVo
,
EmailConfig
emailConfig
);
}
}
eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.service;
import
me.zhengjie.domain.LocalStorage
;
import
me.zhengjie.domain.LocalStorage
;
import
me.zhengjie.service.dto.LocalStorageDto
;
import
me.zhengjie.service.dto.LocalStorageDto
;
import
me.zhengjie.service.dto.LocalStorageQueryCriteria
;
import
me.zhengjie.service.dto.LocalStorageQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -36,7 +37,7 @@ public interface LocalStorageService {
...
@@ -36,7 +37,7 @@ public interface LocalStorageService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
LocalStorageDto
>
queryAll
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部数据
* 查询全部数据
...
...
eladmin-tools/src/main/java/me/zhengjie/service/QiNiuService.java
View file @
5b9213f2
...
@@ -18,6 +18,7 @@ package me.zhengjie.service;
...
@@ -18,6 +18,7 @@ package me.zhengjie.service;
import
me.zhengjie.domain.QiniuConfig
;
import
me.zhengjie.domain.QiniuConfig
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.utils.PageResult
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -50,7 +51,7 @@ public interface QiNiuService {
...
@@ -50,7 +51,7 @@ public interface QiNiuService {
* @param pageable 分页参数
* @param pageable 分页参数
* @return /
* @return /
*/
*/
Object
queryAll
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
);
PageResult
<
QiniuContent
>
queryAll
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
);
/**
/**
* 查询全部
* 查询全部
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java
View file @
5b9213f2
...
@@ -52,7 +52,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
...
@@ -52,7 +52,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
private
final
FileProperties
properties
;
private
final
FileProperties
properties
;
@Override
@Override
public
Object
queryAll
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
public
PageResult
<
LocalStorageDto
>
queryAll
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
LocalStorage
>
page
=
localStorageRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
Page
<
LocalStorage
>
page
=
localStorageRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
localStorageMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
localStorageMapper:
:
toDto
));
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java
View file @
5b9213f2
...
@@ -29,14 +29,10 @@ import me.zhengjie.domain.QiniuConfig;
...
@@ -29,14 +29,10 @@ import me.zhengjie.domain.QiniuConfig;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.repository.QiniuContentRepository
;
import
me.zhengjie.repository.QiniuContentRepository
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.utils.
QiNiuUtil
;
import
me.zhengjie.utils.
*
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.repository.QiNiuConfigRepository
;
import
me.zhengjie.repository.QiNiuConfigRepository
;
import
me.zhengjie.service.QiNiuService
;
import
me.zhengjie.service.QiNiuService
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.CachePut
;
...
@@ -84,7 +80,7 @@ public class QiNiuServiceImpl implements QiNiuService {
...
@@ -84,7 +80,7 @@ public class QiNiuServiceImpl implements QiNiuService {
}
}
@Override
@Override
public
Object
queryAll
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
public
PageResult
<
QiniuContent
>
queryAll
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
return
PageUtil
.
toPage
(
qiniuContentRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
));
return
PageUtil
.
toPage
(
qiniuContentRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
));
}
}
...
...
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