Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
564f9cf8
提交
564f9cf8
authored
4月 19, 2022
作者:
17607474349
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upd:
1、职位信息分页、导出修复
上级
ab7fec26
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
17 行删除
+22
-17
LocationTagServiceImpl.java
...ing/app/service/location/impl/LocationTagServiceImpl.java
+1
-1
PostExcel.java
...h/src/main/java/com/yiring/auth/excel/post/PostExcel.java
+10
-8
PostServiceImpl.java
...va/com/yiring/auth/service/post/impl/PostServiceImpl.java
+11
-8
没有找到文件。
app/src/main/java/com/yiring/app/service/location/impl/LocationTagServiceImpl.java
浏览文件 @
564f9cf8
...
@@ -181,7 +181,7 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -181,7 +181,7 @@ public class LocationTagServiceImpl implements LocationTagService {
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
param
.
getCode
()))
{
if
(
StrUtil
.
isNotEmpty
(
param
.
getCode
()))
{
cb
.
equal
(
root
.
get
(
LocationTag
.
Fields
.
code
),
param
.
getCode
()
);
cb
.
like
(
root
.
get
(
LocationTag
.
Fields
.
code
),
"%"
+
param
.
getCode
()
+
"%"
);
}
}
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getType
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getType
()))
{
...
...
basic-auth/src/main/java/com/yiring/auth/excel/post/PostExcel.java
浏览文件 @
564f9cf8
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
auth
.
excel
.
post
;
package
com
.
yiring
.
auth
.
excel
.
post
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.post.Post
;
...
@@ -25,9 +24,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -25,9 +24,9 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
PostExcel
{
public
class
PostExcel
{
@ExcelColumn
(
title
=
"编号"
)
/*
@ExcelColumn(title = "编号")
@JsonSerialize(using = ToStringSerializer.class)
@JsonSerialize(using = ToStringSerializer.class)
Long
id
;
Long id;
*/
@ExcelColumn
(
title
=
"职位名称"
)
@ExcelColumn
(
title
=
"职位名称"
)
String
name
;
String
name
;
...
@@ -36,8 +35,10 @@ public class PostExcel {
...
@@ -36,8 +35,10 @@ public class PostExcel {
String
describe
;
String
describe
;
@ExcelColumn
(
title
=
"是否启用"
)
@ExcelColumn
(
title
=
"是否启用"
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
String
enable
;
Boolean
enable
;
@ExcelColumn
(
title
=
"创建时间"
)
String
createTime
;
public
static
List
<
PostExcel
>
transforms
(
List
<
Post
>
posts
)
{
public
static
List
<
PostExcel
>
transforms
(
List
<
Post
>
posts
)
{
return
posts
return
posts
...
@@ -45,10 +46,11 @@ public class PostExcel {
...
@@ -45,10 +46,11 @@ public class PostExcel {
.
map
(
post
->
.
map
(
post
->
PostExcel
PostExcel
.
builder
()
.
builder
()
.
id
(
post
.
getId
())
//
.id(post.getId())
.
name
(
post
.
getName
())
.
name
(
post
.
getName
())
.
describe
(
post
.
getDescribe
())
.
describe
(
post
.
getDescribe
())
.
enable
(
post
.
getEnable
())
.
enable
(
post
.
getEnable
()
?
"启用"
:
"禁用"
)
.
createTime
(
LocalDateTimeUtil
.
format
(
post
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
build
()
.
build
()
)
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
...
...
basic-auth/src/main/java/com/yiring/auth/service/post/impl/PostServiceImpl.java
浏览文件 @
564f9cf8
...
@@ -24,14 +24,12 @@ import java.util.List;
...
@@ -24,14 +24,12 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -68,8 +66,9 @@ public class PostServiceImpl implements PostService {
...
@@ -68,8 +66,9 @@ public class PostServiceImpl implements PostService {
if
(!
StrUtil
.
equals
(
post
.
getName
(),
postParam
.
getName
()))
{
if
(!
StrUtil
.
equals
(
post
.
getName
(),
postParam
.
getName
()))
{
if
(
hasPostInfo
(
postParam
.
getName
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位已存在"
);
if
(
hasPostInfo
(
postParam
.
getName
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位已存在"
);
}
}
post
.
setName
(
postParam
.
getName
());
post
=
postParam
.
transform
();
post
.
setDescribe
(
postParam
.
getDescribe
());
post
.
setEnable
(
postParam
.
getEnable
());
post
.
setUpdateTime
(
LocalDateTime
.
now
());
post
.
setUpdateTime
(
LocalDateTime
.
now
());
post
.
setId
(
idParam
.
getId
());
post
.
setId
(
idParam
.
getId
());
postRepository
.
save
(
post
);
postRepository
.
save
(
post
);
...
@@ -87,6 +86,8 @@ public class PostServiceImpl implements PostService {
...
@@ -87,6 +86,8 @@ public class PostServiceImpl implements PostService {
public
Result
<
PageVo
<
PostVo
>>
findPostPage
(
PostFindParam
param
)
{
public
Result
<
PageVo
<
PostVo
>>
findPostPage
(
PostFindParam
param
)
{
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
Post
.
Fields
.
createTime
));
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getPageSize
())
&&
ObjectUtil
.
isNotEmpty
(
param
.
getPageNo
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getPageSize
())
&&
ObjectUtil
.
isNotEmpty
(
param
.
getPageNo
()))
{
//分页
//分页
Pageable
pageable
=
PageRequest
.
of
(
param
.
getPageNo
()
-
1
,
param
.
getPageSize
());
Pageable
pageable
=
PageRequest
.
of
(
param
.
getPageNo
()
-
1
,
param
.
getPageSize
());
...
@@ -95,7 +96,7 @@ public class PostServiceImpl implements PostService {
...
@@ -95,7 +96,7 @@ public class PostServiceImpl implements PostService {
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
return
Result
.
ok
(
pageVo
);
return
Result
.
ok
(
pageVo
);
}
else
{
}
else
{
List
<
Post
>
posts
=
postRepository
.
findAll
(
specification
);
List
<
Post
>
posts
=
postRepository
.
findAll
(
specification
,
sort
);
List
<
PostVo
>
postVos
=
PostVo
.
transforms
(
posts
);
List
<
PostVo
>
postVos
=
PostVo
.
transforms
(
posts
);
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
return
Result
.
ok
(
pageVo
);
return
Result
.
ok
(
pageVo
);
...
@@ -155,13 +156,15 @@ public class PostServiceImpl implements PostService {
...
@@ -155,13 +156,15 @@ public class PostServiceImpl implements PostService {
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
param
.
getName
()))
{
if
(
StrUtil
.
isNotEmpty
(
param
.
getName
()))
{
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
name
),
param
.
getName
()
));
predicates
.
add
(
cb
.
like
(
root
.
get
(
Post
.
Fields
.
name
),
"%"
+
param
.
getName
()
+
"%"
));
}
}
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getEnable
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
param
.
getEnable
()))
{
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
param
.
getEnable
()));
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
param
.
getEnable
()));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
Post
.
Fields
.
createTime
));
return
cq
.
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
return
cq
.
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
};
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论