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
e4ca7afc
"jetbrains:/idea/checkout/git" did not exist on "32befd1a62a489286344620331055bb38f92022d"
Commit
e4ca7afc
authored
Nov 25, 2019
by
dqjdda
Browse files
阿里巴巴代码规范
parent
6d941c09
Changes
160
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
View file @
e4ca7afc
package
me.zhengjie.modules.system.service
;
import
me.zhengjie.modules.system.domain.User
;
import
me.zhengjie.modules.system.service.dto.UserD
TO
;
import
me.zhengjie.modules.system.service.dto.UserD
to
;
import
me.zhengjie.modules.system.service.dto.UserQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -15,25 +15,79 @@ import java.util.List;
*/
public
interface
UserService
{
UserDTO
findById
(
long
id
);
/**
* 根据ID查询
* @param id ID
* @return /
*/
UserDto
findById
(
long
id
);
UserDTO
create
(
User
resources
);
/**
* 新增用户
* @param resources /
* @return /
*/
UserDto
create
(
User
resources
);
/**
* 编辑用户
* @param resources /
*/
void
update
(
User
resources
);
/**
* 删除用户
* @param id /
*/
void
delete
(
Long
id
);
UserDTO
findByName
(
String
userName
);
/**
* 根据用户名查询
* @param userName /
* @return /
*/
UserDto
findByName
(
String
userName
);
/**
* 修改密码
* @param username 用户名
* @param encryptPassword 密码
*/
void
updatePass
(
String
username
,
String
encryptPassword
);
/**
* 修改头像
* @param file 文件
*/
void
updateAvatar
(
MultipartFile
file
);
/**
* 修改邮箱
* @param username 用户名
* @param email 邮箱
*/
void
updateEmail
(
String
username
,
String
email
);
/**
* 查询全部
* @param criteria 条件
* @param pageable 分页参数
* @return /
*/
Object
queryAll
(
UserQueryCriteria
criteria
,
Pageable
pageable
);
List
<
UserDTO
>
queryAll
(
UserQueryCriteria
criteria
);
/**
* 查询全部不分页
* @param criteria 条件
* @return /
*/
List
<
UserDto
>
queryAll
(
UserQueryCriteria
criteria
);
void
download
(
List
<
UserDTO
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
;
/**
* 导出数据
* @param queryAll 待导出的数据
* @param response /
* @throws IOException /
*/
void
download
(
List
<
UserDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptD
to
.java
View file @
e4ca7afc
package
me.zhengjie.modules.system.service.dto
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -12,24 +13,20 @@ import java.util.List;
* @author Zheng Jie
* @date 2019-03-25
*/
@Getter
@Setter
public
class
DeptDTO
implements
Serializable
{
@Data
public
class
DeptDto
implements
Serializable
{
// ID
private
Long
id
;
// 名称
private
String
name
;
@NotNull
private
Boolean
enabled
;
// 上级部门
private
Long
pid
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
private
List
<
DeptD
TO
>
children
;
private
List
<
DeptD
to
>
children
;
private
Timestamp
createTime
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptSmallD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptSmallD
to
.java
View file @
e4ca7afc
...
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
* @date 2019-6-10 16:32:18
*/
@Data
public
class
DeptSmallD
TO
implements
Serializable
{
public
class
DeptSmallD
to
implements
Serializable
{
private
Long
id
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailD
to
.java
View file @
e4ca7afc
...
...
@@ -12,7 +12,7 @@ import java.sql.Timestamp;
*/
@Getter
@Setter
public
class
DictDetailD
TO
implements
Serializable
{
public
class
DictDetailD
to
implements
Serializable
{
private
Long
id
;
...
...
@@ -22,7 +22,7 @@ public class DictDetailDTO implements Serializable {
private
String
sort
;
private
DictSmallD
TO
dict
;
private
DictSmallD
to
dict
;
private
Timestamp
createTime
;
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictD
to
.java
View file @
e4ca7afc
...
...
@@ -13,7 +13,7 @@ import java.util.List;
*/
@Getter
@Setter
public
class
DictD
TO
implements
Serializable
{
public
class
DictD
to
implements
Serializable
{
private
Long
id
;
...
...
@@ -21,7 +21,7 @@ public class DictDTO implements Serializable {
private
String
remark
;
private
List
<
DictDetailD
TO
>
dictDetails
;
private
List
<
DictDetailD
to
>
dictDetails
;
private
Timestamp
createTime
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictQueryCriteria.java
View file @
e4ca7afc
...
...
@@ -4,12 +4,12 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
/**
* @author Zheng Jie
* 公共查询类
*/
@Data
public
class
DictQueryCriteria
{
// 多字段模糊
@Query
(
blurry
=
"name,remark"
)
private
String
blurry
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictSmallD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictSmallD
to
.java
View file @
e4ca7afc
...
...
@@ -10,7 +10,7 @@ import java.io.Serializable;
*/
@Getter
@Setter
public
class
DictSmallD
TO
implements
Serializable
{
public
class
DictSmallD
to
implements
Serializable
{
private
Long
id
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobD
to
.java
View file @
e4ca7afc
...
...
@@ -14,7 +14,7 @@ import java.sql.Timestamp;
@Getter
@Setter
@NoArgsConstructor
public
class
JobD
TO
implements
Serializable
{
public
class
JobD
to
implements
Serializable
{
private
Long
id
;
...
...
@@ -24,13 +24,13 @@ public class JobDTO implements Serializable {
private
Boolean
enabled
;
private
DeptD
TO
dept
;
private
DeptD
to
dept
;
private
String
deptSuperiorName
;
private
Timestamp
createTime
;
public
JobD
TO
(
String
name
,
Boolean
enabled
)
{
public
JobD
to
(
String
name
,
Boolean
enabled
)
{
this
.
name
=
name
;
this
.
enabled
=
enabled
;
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobSmallD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobSmallD
to
.java
View file @
e4ca7afc
...
...
@@ -10,7 +10,7 @@ import java.io.Serializable;
*/
@Data
@NoArgsConstructor
public
class
JobSmallD
TO
implements
Serializable
{
public
class
JobSmallD
to
implements
Serializable
{
private
Long
id
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuD
to
.java
View file @
e4ca7afc
package
me.zhengjie.modules.system.service.dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
@@ -11,9 +9,8 @@ import java.util.List;
* @author Zheng Jie
* @date 2018-12-17
*/
@Getter
@Setter
public
class
MenuDTO
implements
Serializable
{
@Data
public
class
MenuDto
implements
Serializable
{
private
Long
id
;
...
...
@@ -41,7 +38,7 @@ public class MenuDTO implements Serializable {
private
String
icon
;
private
List
<
MenuD
TO
>
children
;
private
List
<
MenuD
to
>
children
;
private
Timestamp
createTime
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuQueryCriteria.java
View file @
e4ca7afc
...
...
@@ -7,12 +7,12 @@ import java.sql.Timestamp;
import
java.util.List
;
/**
* @author Zheng Jie
* 公共查询类
*/
@Data
public
class
MenuQueryCriteria
{
// 多字段模糊
@Query
(
blurry
=
"name,path,component"
)
private
String
blurry
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleD
to
.java
View file @
e4ca7afc
package
me.zhengjie.modules.system.service.dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Set
;
...
...
@@ -11,9 +9,8 @@ import java.util.Set;
* @author Zheng Jie
* @date 2018-11-23
*/
@Getter
@Setter
public
class
RoleDTO
implements
Serializable
{
@Data
public
class
RoleDto
implements
Serializable
{
private
Long
id
;
...
...
@@ -27,9 +24,9 @@ public class RoleDTO implements Serializable {
private
String
permission
;
private
Set
<
MenuD
TO
>
menus
;
private
Set
<
MenuD
to
>
menus
;
private
Set
<
DeptD
TO
>
depts
;
private
Set
<
DeptD
to
>
depts
;
private
Timestamp
createTime
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleQueryCriteria.java
View file @
e4ca7afc
...
...
@@ -7,12 +7,12 @@ import java.sql.Timestamp;
import
java.util.List
;
/**
* @author Zheng Jie
* 公共查询类
*/
@Data
public
class
RoleQueryCriteria
{
// 多字段模糊
@Query
(
blurry
=
"name,remark"
)
private
String
blurry
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleSmallD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleSmallD
to
.java
View file @
e4ca7afc
...
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
* @date 2018-11-23
*/
@Data
public
class
RoleSmallD
TO
implements
Serializable
{
public
class
RoleSmallD
to
implements
Serializable
{
private
Long
id
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserD
TO
.java
→
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserD
to
.java
View file @
e4ca7afc
...
...
@@ -2,9 +2,7 @@ package me.zhengjie.modules.system.service.dto;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Date
;
...
...
@@ -14,9 +12,8 @@ import java.util.Set;
* @author Zheng Jie
* @date 2018-11-23
*/
@Getter
@Setter
public
class
UserDTO
implements
Serializable
{
@Data
public
class
UserDto
implements
Serializable
{
@ApiModelProperty
(
hidden
=
true
)
private
Long
id
;
...
...
@@ -37,12 +34,12 @@ public class UserDTO implements Serializable {
private
Date
lastPasswordResetTime
;
@ApiModelProperty
(
hidden
=
true
)
private
Set
<
RoleSmallD
TO
>
roles
;
private
Set
<
RoleSmallD
to
>
roles
;
@ApiModelProperty
(
hidden
=
true
)
private
JobSmallD
TO
job
;
private
JobSmallD
to
job
;
private
DeptSmallD
TO
dept
;
private
DeptSmallD
to
dept
;
private
Long
deptId
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserQueryCriteria.java
View file @
e4ca7afc
...
...
@@ -20,7 +20,6 @@ public class UserQueryCriteria implements Serializable {
@Query
(
propName
=
"id"
,
type
=
Query
.
Type
.
IN
,
joinName
=
"dept"
)
private
Set
<
Long
>
deptIds
;
// 多字段模糊
@Query
(
blurry
=
"email,username"
)
private
String
blurry
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java
View file @
e4ca7afc
...
...
@@ -2,13 +2,13 @@ package me.zhengjie.modules.system.service.impl;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Dept
;
import
me.zhengjie.modules.system.service.dto.DeptDto
;
import
me.zhengjie.modules.system.service.dto.DeptQueryCriteria
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.modules.system.repository.DeptRepository
;
import
me.zhengjie.modules.system.service.DeptService
;
import
me.zhengjie.modules.system.service.dto.DeptDTO
;
import
me.zhengjie.modules.system.service.mapper.DeptMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
...
...
@@ -43,13 +43,13 @@ public class DeptServiceImpl implements DeptService {
@Override
@Cacheable
public
List
<
DeptD
TO
>
queryAll
(
DeptQueryCriteria
criteria
)
{
public
List
<
DeptD
to
>
queryAll
(
DeptQueryCriteria
criteria
)
{
return
deptMapper
.
toDto
(
deptRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
@Override
@Cacheable
(
key
=
"#p0"
)
public
DeptD
TO
findById
(
Long
id
)
{
public
DeptD
to
findById
(
Long
id
)
{
Dept
dept
=
deptRepository
.
findById
(
id
).
orElseGet
(
Dept:
:
new
);
ValidationUtil
.
isNull
(
dept
.
getId
(),
"Dept"
,
"id"
,
id
);
return
deptMapper
.
toDto
(
dept
);
...
...
@@ -68,17 +68,17 @@ public class DeptServiceImpl implements DeptService {
@Override
@Cacheable
public
Object
buildTree
(
List
<
DeptD
TO
>
deptD
TOS
)
{
Set
<
DeptD
TO
>
trees
=
new
LinkedHashSet
<>();
Set
<
DeptD
TO
>
depts
=
new
LinkedHashSet
<>();
List
<
String
>
deptNames
=
deptD
TOS
.
stream
().
map
(
DeptD
TO
:
:
getName
).
collect
(
Collectors
.
toList
());
public
Object
buildTree
(
List
<
DeptD
to
>
deptD
tos
)
{
Set
<
DeptD
to
>
trees
=
new
LinkedHashSet
<>();
Set
<
DeptD
to
>
depts
=
new
LinkedHashSet
<>();
List
<
String
>
deptNames
=
deptD
tos
.
stream
().
map
(
DeptD
to
:
:
getName
).
collect
(
Collectors
.
toList
());
boolean
isChild
;
for
(
DeptD
TO
deptDTO
:
deptD
TOS
)
{
for
(
DeptD
to
deptDTO
:
deptD
tos
)
{
isChild
=
false
;
if
(
"0"
.
equals
(
deptDTO
.
getPid
().
toString
()))
{
trees
.
add
(
deptDTO
);
}
for
(
DeptD
TO
it
:
deptD
TOS
)
{
for
(
DeptD
to
it
:
deptD
tos
)
{
if
(
it
.
getPid
().
equals
(
deptDTO
.
getId
()))
{
isChild
=
true
;
if
(
deptDTO
.
getChildren
()
==
null
)
{
...
...
@@ -87,28 +87,29 @@ public class DeptServiceImpl implements DeptService {
deptDTO
.
getChildren
().
add
(
it
);
}
}
if
(
isChild
)
if
(
isChild
)
{
depts
.
add
(
deptDTO
);
else
if
(!
deptNames
.
contains
(
deptRepository
.
findNameById
(
deptDTO
.
getPid
())))
}
else
if
(!
deptNames
.
contains
(
deptRepository
.
findNameById
(
deptDTO
.
getPid
())))
{
depts
.
add
(
deptDTO
);
}
}
if
(
CollectionUtils
.
isEmpty
(
trees
))
{
trees
=
depts
;
}
Integer
totalElements
=
deptD
TOS
.
size
();
Integer
totalElements
=
deptD
tos
.
size
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
"totalElements"
,
totalElements
);
map
.
put
(
"content"
,
CollectionUtils
.
isEmpty
(
trees
)?
deptD
TOS
:
trees
);
map
.
put
(
"content"
,
CollectionUtils
.
isEmpty
(
trees
)?
deptD
tos
:
trees
);
return
map
;
}
@Override
@CacheEvict
(
allEntries
=
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
DeptD
TO
create
(
Dept
resources
)
{
public
DeptD
to
create
(
Dept
resources
)
{
return
deptMapper
.
toDto
(
deptRepository
.
save
(
resources
));
}
...
...
@@ -133,9 +134,9 @@ public class DeptServiceImpl implements DeptService {
}
@Override
public
void
download
(
List
<
DeptD
TO
>
deptD
TO
s
,
HttpServletResponse
response
)
throws
IOException
{
public
void
download
(
List
<
DeptD
to
>
deptD
to
s
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
DeptD
TO
deptDTO
:
deptD
TO
s
)
{
for
(
DeptD
to
deptDTO
:
deptD
to
s
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"部门名称"
,
deptDTO
.
getName
());
map
.
put
(
"部门状态"
,
deptDTO
.
getEnabled
()
?
"启用"
:
"停用"
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java
View file @
e4ca7afc
...
...
@@ -7,7 +7,7 @@ import me.zhengjie.utils.QueryHelp;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.modules.system.repository.DictDetailRepository
;
import
me.zhengjie.modules.system.service.DictDetailService
;
import
me.zhengjie.modules.system.service.dto.DictDetailD
TO
;
import
me.zhengjie.modules.system.service.dto.DictDetailD
to
;
import
me.zhengjie.modules.system.service.mapper.DictDetailMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
...
...
@@ -46,7 +46,7 @@ public class DictDetailServiceImpl implements DictDetailService {
@Override
@Cacheable
(
key
=
"#p0"
)
public
DictDetailD
TO
findById
(
Long
id
)
{
public
DictDetailD
to
findById
(
Long
id
)
{
DictDetail
dictDetail
=
dictDetailRepository
.
findById
(
id
).
orElseGet
(
DictDetail:
:
new
);
ValidationUtil
.
isNull
(
dictDetail
.
getId
(),
"DictDetail"
,
"id"
,
id
);
return
dictDetailMapper
.
toDto
(
dictDetail
);
...
...
@@ -55,7 +55,7 @@ public class DictDetailServiceImpl implements DictDetailService {
@Override
@CacheEvict
(
allEntries
=
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
DictDetailD
TO
create
(
DictDetail
resources
)
{
public
DictDetailD
to
create
(
DictDetail
resources
)
{
return
dictDetailMapper
.
toDto
(
dictDetailRepository
.
save
(
resources
));
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java
View file @
e4ca7afc
...
...
@@ -2,7 +2,7 @@ package me.zhengjie.modules.system.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictDetailD
TO
;
import
me.zhengjie.modules.system.service.dto.DictDetailD
to
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageUtil
;
...
...
@@ -10,7 +10,7 @@ import me.zhengjie.utils.QueryHelp;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.modules.system.repository.DictRepository
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictD
TO
;
import
me.zhengjie.modules.system.service.dto.DictD
to
;
import
me.zhengjie.modules.system.service.mapper.DictMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
...
...
@@ -54,14 +54,14 @@ public class DictServiceImpl implements DictService {
}
@Override
public
List
<
DictD
TO
>
queryAll
(
DictQueryCriteria
dict
)
{
public
List
<
DictD
to
>
queryAll
(
DictQueryCriteria
dict
)
{
List
<
Dict
>
list
=
dictRepository
.
findAll
((
root
,
query
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
dict
,
cb
));
return
dictMapper
.
toDto
(
list
);
}
@Override
@Cacheable
(
key
=
"#p0"
)
public
DictD
TO
findById
(
Long
id
)
{
public
DictD
to
findById
(
Long
id
)
{
Dict
dict
=
dictRepository
.
findById
(
id
).
orElseGet
(
Dict:
:
new
);
ValidationUtil
.
isNull
(
dict
.
getId
(),
"Dict"
,
"id"
,
id
);
return
dictMapper
.
toDto
(
dict
);
...
...
@@ -70,7 +70,7 @@ public class DictServiceImpl implements DictService {
@Override
@CacheEvict
(
allEntries
=
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
DictD
TO
create
(
Dict
resources
)
{
public
DictD
to
create
(
Dict
resources
)
{
return
dictMapper
.
toDto
(
dictRepository
.
save
(
resources
));
}
...
...
@@ -92,11 +92,11 @@ public class DictServiceImpl implements DictService {
}
@Override
public
void
download
(
List
<
DictD
TO
>
dictD
TOS
,
HttpServletResponse
response
)
throws
IOException
{
public
void
download
(
List
<
DictD
to
>
dictD
tos
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
DictD
TO
dictDTO
:
dictD
TOS
)
{
for
(
DictD
to
dictDTO
:
dictD
tos
)
{
if
(
CollectionUtil
.
isNotEmpty
(
dictDTO
.
getDictDetails
())){
for
(
DictDetailD
TO
dictDetail
:
dictDTO
.
getDictDetails
())
{
for
(
DictDetailD
to
dictDetail
:
dictDTO
.
getDictDetails
())
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"字典名称"
,
dictDTO
.
getName
());
map
.
put
(
"字典描述"
,
dictDTO
.
getRemark
());
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java
View file @
e4ca7afc
...
...
@@ -9,7 +9,7 @@ import me.zhengjie.utils.QueryHelp;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.modules.system.repository.JobRepository
;
import
me.zhengjie.modules.system.service.JobService
;
import
me.zhengjie.modules.system.service.dto.JobD
TO
;
import
me.zhengjie.modules.system.service.dto.JobD
to
;
import
me.zhengjie.modules.system.service.mapper.JobMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
...
...
@@ -52,7 +52,7 @@ public class JobServiceImpl implements JobService {
@Cacheable
public
Map
<
String
,
Object
>
queryAll
(
JobQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
Job
>
page
=
jobRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
List
<
JobD
TO
>
jobs
=
new
ArrayList
<>();
List
<
JobD
to
>
jobs
=
new
ArrayList
<>();
for
(
Job
job
:
page
.
getContent
())
{
jobs
.
add
(
jobMapper
.
toDto
(
job
,
deptRepository
.
findNameById
(
job
.
getDept
().
getPid
())));
}
...
...
@@ -61,14 +61,14 @@ public class JobServiceImpl implements JobService {
@Override
@Cacheable
public
List
<
JobD
TO
>
queryAll
(
JobQueryCriteria
criteria
)
{
public
List
<
JobD
to
>
queryAll
(
JobQueryCriteria
criteria
)
{
List
<
Job
>
list
=
jobRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
));
return
jobMapper
.
toDto
(
list
);
}
@Override
@Cacheable
(
key
=
"#p0"
)
public
JobD
TO
findById
(
Long
id
)
{
public
JobD
to
findById
(
Long
id
)
{
Job
job
=
jobRepository
.
findById
(
id
).
orElseGet
(
Job:
:
new
);
ValidationUtil
.
isNull
(
job
.
getId
(),
"Job"
,
"id"
,
id
);
return
jobMapper
.
toDto
(
job
);
...
...
@@ -77,7 +77,7 @@ public class JobServiceImpl implements JobService {
@Override
@CacheEvict
(
allEntries
=
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
JobD
TO
create
(
Job
resources
)
{
public
JobD
to
create
(
Job
resources
)
{
return
jobMapper
.
toDto
(
jobRepository
.
save
(
resources
));
}
...
...
@@ -99,9 +99,9 @@ public class JobServiceImpl implements JobService {
}
@Override
public
void
download
(
List
<
JobD
TO
>
jobD
TO
s
,
HttpServletResponse
response
)
throws
IOException
{
public
void
download
(
List
<
JobD
to
>
jobD
to
s
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
JobD
TO
jobDTO
:
jobD
TO
s
)
{
for
(
JobD
to
jobDTO
:
jobD
to
s
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"岗位名称"
,
jobDTO
.
getName
());
map
.
put
(
"所属部门"
,
jobDTO
.
getDept
().
getName
());
...
...
Prev
1
2
3
4
5
6
7
8
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