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
0f0392d7
"eladmin-system/src/vscode:/vscode.git/clone" did not exist on "8cb7dc886f1b56bb331d9a5225f0c66e90655f3e"
Commit
0f0392d7
authored
Sep 26, 2019
by
dqjdda
Browse files
Merge branch '2.2DEV'
parents
d0ffe1a8
f9bb8cf2
Changes
72
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java
View file @
0f0392d7
...
@@ -15,4 +15,6 @@ public class MenuMetaVo implements Serializable {
...
@@ -15,4 +15,6 @@ public class MenuMetaVo implements Serializable {
private
String
title
;
private
String
title
;
private
String
icon
;
private
String
icon
;
private
Boolean
noCache
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuVo.java
View file @
0f0392d7
...
@@ -19,6 +19,8 @@ public class MenuVo implements Serializable {
...
@@ -19,6 +19,8 @@ public class MenuVo implements Serializable {
private
String
path
;
private
String
path
;
private
Boolean
hidden
;
private
String
redirect
;
private
String
redirect
;
private
String
component
;
private
String
component
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java
View file @
0f0392d7
...
@@ -23,6 +23,13 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
...
@@ -23,6 +23,13 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
*/
*/
Menu
findByName
(
String
name
);
Menu
findByName
(
String
name
);
/**
* findByName
* @param name
* @return
*/
Menu
findByComponentName
(
String
name
);
/**
/**
* findByPid
* findByPid
* @param pid
* @param pid
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/PermissionRepository.java
View file @
0f0392d7
package
me.zhengjie.modules.system.repository
;
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Permission
;
import
me.zhengjie.modules.system.domain.Permission
;
import
me.zhengjie.modules.system.domain.Role
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java
View file @
0f0392d7
...
@@ -3,6 +3,8 @@ package me.zhengjie.modules.system.repository;
...
@@ -3,6 +3,8 @@ package me.zhengjie.modules.system.repository;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.modules.system.domain.Role
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -21,5 +23,11 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
...
@@ -21,5 +23,11 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
Set
<
Role
>
findByUsers_Id
(
Long
id
);
Set
<
Role
>
findByUsers_Id
(
Long
id
);
Set
<
Role
>
findByMenus_Id
(
Long
id
);
@Modifying
@Query
(
value
=
"delete from roles_permissions where permission_id = ?1"
,
nativeQuery
=
true
)
void
untiedPermission
(
Long
id
);
@Modifying
@Query
(
value
=
"delete from roles_menus where menu_id = ?1"
,
nativeQuery
=
true
)
void
untiedMenu
(
Long
id
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java
0 → 100644
View file @
0f0392d7
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.UserAvatar
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.Date
;
/**
* @author Zheng Jie
* @date 2018-11-22
*/
public
interface
UserAvatarRepository
extends
JpaRepository
<
UserAvatar
,
Long
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
View file @
0f0392d7
...
@@ -7,6 +7,7 @@ import me.zhengjie.modules.system.domain.Dept;
...
@@ -7,6 +7,7 @@ import me.zhengjie.modules.system.domain.Dept;
import
me.zhengjie.modules.system.service.DeptService
;
import
me.zhengjie.modules.system.service.DeptService
;
import
me.zhengjie.modules.system.service.dto.DeptDTO
;
import
me.zhengjie.modules.system.service.dto.DeptDTO
;
import
me.zhengjie.modules.system.service.dto.DeptQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.DeptQueryCriteria
;
import
me.zhengjie.utils.ThrowableUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -63,7 +64,11 @@ public class DeptController {
...
@@ -63,7 +64,11 @@ public class DeptController {
@DeleteMapping
(
value
=
"/dept/{id}"
)
@DeleteMapping
(
value
=
"/dept/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','DEPT_ALL','DEPT_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','DEPT_ALL','DEPT_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
deptService
.
delete
(
id
);
try
{
deptService
.
delete
(
id
);
}
catch
(
Throwable
e
){
ThrowableUtil
.
throwForeignKeyException
(
e
,
"该部门存在岗位或者角色关联,请取消关联后再试"
);
}
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
0f0392d7
...
@@ -4,7 +4,6 @@ import me.zhengjie.aop.log.Log;
...
@@ -4,7 +4,6 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictDTO
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
View file @
0f0392d7
...
@@ -6,6 +6,7 @@ import me.zhengjie.exception.BadRequestException;
...
@@ -6,6 +6,7 @@ import me.zhengjie.exception.BadRequestException;
import
me.zhengjie.modules.system.domain.Job
;
import
me.zhengjie.modules.system.domain.Job
;
import
me.zhengjie.modules.system.service.JobService
;
import
me.zhengjie.modules.system.service.JobService
;
import
me.zhengjie.modules.system.service.dto.JobQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.JobQueryCriteria
;
import
me.zhengjie.utils.ThrowableUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -64,7 +65,11 @@ public class JobController {
...
@@ -64,7 +65,11 @@ public class JobController {
@DeleteMapping
(
value
=
"/job/{id}"
)
@DeleteMapping
(
value
=
"/job/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
jobService
.
delete
(
id
);
try
{
jobService
.
delete
(
id
);
}
catch
(
Throwable
e
){
ThrowableUtil
.
throwForeignKeyException
(
e
,
"该岗位存在用户关联,请取消关联后再试"
);
}
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java
View file @
0f0392d7
...
@@ -16,7 +16,9 @@ import org.springframework.http.ResponseEntity;
...
@@ -16,7 +16,9 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -90,14 +92,10 @@ public class MenuController {
...
@@ -90,14 +92,10 @@ public class MenuController {
@PreAuthorize
(
"hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
List
<
Menu
>
menuList
=
menuService
.
findByPid
(
id
);
List
<
Menu
>
menuList
=
menuService
.
findByPid
(
id
);
Set
<
Menu
>
menuSet
=
new
HashSet
<>();
// 特殊情况,对级联删除进行处理
menuSet
.
add
(
menuService
.
findOne
(
id
));
for
(
Menu
menu
:
menuList
)
{
menuSet
=
menuService
.
getDeleteMenus
(
menuList
,
menuSet
);
roleService
.
untiedMenu
(
menu
);
menuService
.
delete
(
menuSet
);
menuService
.
delete
(
menu
.
getId
());
}
roleService
.
untiedMenu
(
menuService
.
findOne
(
id
));
menuService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/PermissionController.java
View file @
0f0392d7
...
@@ -6,6 +6,7 @@ import me.zhengjie.exception.BadRequestException;
...
@@ -6,6 +6,7 @@ import me.zhengjie.exception.BadRequestException;
import
me.zhengjie.modules.system.service.PermissionService
;
import
me.zhengjie.modules.system.service.PermissionService
;
import
me.zhengjie.modules.system.service.dto.PermissionDTO
;
import
me.zhengjie.modules.system.service.dto.PermissionDTO
;
import
me.zhengjie.modules.system.service.dto.PermissionQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.PermissionQueryCriteria
;
import
me.zhengjie.modules.system.service.mapper.PermissionMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -13,7 +14,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
...
@@ -13,7 +14,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -26,6 +29,9 @@ public class PermissionController {
...
@@ -26,6 +29,9 @@ public class PermissionController {
@Autowired
@Autowired
private
PermissionService
permissionService
;
private
PermissionService
permissionService
;
@Autowired
private
PermissionMapper
permissionMapper
;
private
static
final
String
ENTITY_NAME
=
"permission"
;
private
static
final
String
ENTITY_NAME
=
"permission"
;
/**
/**
...
@@ -68,7 +74,11 @@ public class PermissionController {
...
@@ -68,7 +74,11 @@ public class PermissionController {
@DeleteMapping
(
value
=
"/permissions/{id}"
)
@DeleteMapping
(
value
=
"/permissions/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
permissionService
.
delete
(
id
);
List
<
Permission
>
permissions
=
permissionService
.
findByPid
(
id
);
Set
<
Permission
>
permissionSet
=
new
HashSet
<>();
permissionSet
.
add
(
permissionMapper
.
toEntity
(
permissionService
.
findById
(
id
)));
permissionSet
=
permissionService
.
getDeletePermission
(
permissions
,
permissionSet
);
permissionService
.
delete
(
permissionSet
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java
View file @
0f0392d7
...
@@ -5,10 +5,11 @@ import me.zhengjie.aop.log.Log;
...
@@ -5,10 +5,11 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.service.RoleService
;
import
me.zhengjie.modules.system.service.RoleService
;
import
me.zhengjie.modules.system.service.dto.MenuQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.RoleQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.RoleQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.RoleSmallDTO
;
import
me.zhengjie.modules.system.service.dto.RoleSmallDTO
;
import
me.zhengjie.utils.SecurityUtils
;
import
me.zhengjie.utils.SecurityUtils
;
import
me.zhengjie.utils.ThrowableUtil
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
...
@@ -16,6 +17,7 @@ import org.springframework.data.web.PageableDefault;
...
@@ -16,6 +17,7 @@ import org.springframework.data.web.PageableDefault;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.transaction.TransactionSystemException
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -107,7 +109,11 @@ public class RoleController {
...
@@ -107,7 +109,11 @@ public class RoleController {
@DeleteMapping
(
value
=
"/roles/{id}"
)
@DeleteMapping
(
value
=
"/roles/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','ROLES_ALL','ROLES_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','ROLES_ALL','ROLES_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
roleService
.
delete
(
id
);
try
{
roleService
.
delete
(
id
);
}
catch
(
Throwable
e
){
ThrowableUtil
.
throwForeignKeyException
(
e
,
"该角色存在用户关联,请取消关联后再试"
);
}
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
View file @
0f0392d7
...
@@ -26,6 +26,8 @@ import org.springframework.util.ObjectUtils;
...
@@ -26,6 +26,8 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -55,6 +57,13 @@ public class UserController {
...
@@ -55,6 +57,13 @@ public class UserController {
@Autowired
@Autowired
private
VerificationCodeService
verificationCodeService
;
private
VerificationCodeService
verificationCodeService
;
@Log
(
"导出用户数据"
)
@GetMapping
(
value
=
"/users/download"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','USER_ALL','USER_SELECT')"
)
public
void
update
(
HttpServletResponse
response
,
UserQueryCriteria
criteria
)
throws
IOException
{
userService
.
download
(
userService
.
queryAll
(
criteria
),
response
);
}
@Log
(
"查询用户"
)
@Log
(
"查询用户"
)
@GetMapping
(
value
=
"/users"
)
@GetMapping
(
value
=
"/users"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','USER_ALL','USER_SELECT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','USER_ALL','USER_SELECT')"
)
...
@@ -147,8 +156,7 @@ public class UserController {
...
@@ -147,8 +156,7 @@ public class UserController {
*/
*/
@PostMapping
(
value
=
"/users/updateAvatar"
)
@PostMapping
(
value
=
"/users/updateAvatar"
)
public
ResponseEntity
updateAvatar
(
@RequestParam
MultipartFile
file
){
public
ResponseEntity
updateAvatar
(
@RequestParam
MultipartFile
file
){
Picture
picture
=
pictureService
.
upload
(
file
,
SecurityUtils
.
getUsername
());
userService
.
updateAvatar
(
file
);
userService
.
updateAvatar
(
SecurityUtils
.
getUsername
(),
picture
.
getUrl
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java
View file @
0f0392d7
...
@@ -22,7 +22,7 @@ public interface DeptService {
...
@@ -22,7 +22,7 @@ public interface DeptService {
* @param criteria
* @param criteria
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
List
<
DeptDTO
>
queryAll
(
DeptQueryCriteria
criteria
);
List
<
DeptDTO
>
queryAll
(
DeptQueryCriteria
criteria
);
/**
/**
...
@@ -60,7 +60,7 @@ public interface DeptService {
...
@@ -60,7 +60,7 @@ public interface DeptService {
* @param deptDTOS
* @param deptDTOS
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Object
buildTree
(
List
<
DeptDTO
>
deptDTOS
);
Object
buildTree
(
List
<
DeptDTO
>
deptDTOS
);
/**
/**
...
@@ -68,7 +68,7 @@ public interface DeptService {
...
@@ -68,7 +68,7 @@ public interface DeptService {
* @param pid
* @param pid
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
List
<
Dept
>
findByPid
(
long
pid
);
List
<
Dept
>
findByPid
(
long
pid
);
Set
<
Dept
>
findByRoleIds
(
Long
id
);
Set
<
Dept
>
findByRoleIds
(
Long
id
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java
View file @
0f0392d7
...
@@ -47,6 +47,6 @@ public interface DictDetailService {
...
@@ -47,6 +47,6 @@ public interface DictDetailService {
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
delete
(
Long
id
);
void
delete
(
Long
id
);
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Map
queryAll
(
DictDetailQueryCriteria
criteria
,
Pageable
pageable
);
Map
queryAll
(
DictDetailQueryCriteria
criteria
,
Pageable
pageable
);
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java
View file @
0f0392d7
...
@@ -21,7 +21,7 @@ public interface DictService {
...
@@ -21,7 +21,7 @@ public interface DictService {
* @param pageable
* @param pageable
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Object
queryAll
(
DictQueryCriteria
dict
,
Pageable
pageable
);
Object
queryAll
(
DictQueryCriteria
dict
,
Pageable
pageable
);
/**
/**
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java
View file @
0f0392d7
...
@@ -9,6 +9,7 @@ import org.springframework.cache.annotation.CacheEvict;
...
@@ -9,6 +9,7 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -22,7 +23,7 @@ public interface MenuService {
...
@@ -22,7 +23,7 @@ public interface MenuService {
* @param criteria
* @param criteria
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
List
<
MenuDTO
>
queryAll
(
MenuQueryCriteria
criteria
);
List
<
MenuDTO
>
queryAll
(
MenuQueryCriteria
criteria
);
/**
/**
...
@@ -49,11 +50,12 @@ public interface MenuService {
...
@@ -49,11 +50,12 @@ public interface MenuService {
void
update
(
Menu
resources
);
void
update
(
Menu
resources
);
/**
/**
* delete
* getDeleteMenus
* @param id
* @param menuList
* @param menuSet
* @return
*/
*/
@CacheEvict
(
allEntries
=
true
)
Set
<
Menu
>
getDeleteMenus
(
List
<
Menu
>
menuList
,
Set
<
Menu
>
menuSet
);
void
delete
(
Long
id
);
/**
/**
* permission tree
* permission tree
...
@@ -92,4 +94,11 @@ public interface MenuService {
...
@@ -92,4 +94,11 @@ public interface MenuService {
Object
buildMenus
(
List
<
MenuDTO
>
byRoles
);
Object
buildMenus
(
List
<
MenuDTO
>
byRoles
);
Menu
findOne
(
Long
id
);
Menu
findOne
(
Long
id
);
/**
* delete
* @param menuSet
*/
@CacheEvict
(
allEntries
=
true
)
void
delete
(
Set
<
Menu
>
menuSet
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/PermissionService.java
View file @
0f0392d7
...
@@ -8,6 +8,7 @@ import org.springframework.cache.annotation.CacheEvict;
...
@@ -8,6 +8,7 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -41,10 +42,10 @@ public interface PermissionService {
...
@@ -41,10 +42,10 @@ public interface PermissionService {
/**
/**
* delete
* delete
* @param
id
* @param
permissions
*/
*/
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
delete
(
Long
id
);
void
delete
(
Set
<
Permission
>
permissions
);
/**
/**
* permission tree
* permission tree
...
@@ -66,7 +67,7 @@ public interface PermissionService {
...
@@ -66,7 +67,7 @@ public interface PermissionService {
* @param permissionDTOS
* @param permissionDTOS
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Object
buildTree
(
List
<
PermissionDTO
>
permissionDTOS
);
Object
buildTree
(
List
<
PermissionDTO
>
permissionDTOS
);
/**
/**
...
@@ -74,6 +75,8 @@ public interface PermissionService {
...
@@ -74,6 +75,8 @@ public interface PermissionService {
* @param criteria
* @param criteria
* @return
* @return
*/
*/
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
List
<
PermissionDTO
>
queryAll
(
PermissionQueryCriteria
criteria
);
List
<
PermissionDTO
>
queryAll
(
PermissionQueryCriteria
criteria
);
Set
<
Permission
>
getDeletePermission
(
List
<
Permission
>
permissions
,
Set
<
Permission
>
permissionSet
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java
View file @
0f0392d7
package
me.zhengjie.modules.system.service
;
package
me.zhengjie.modules.system.service
;
import
me.zhengjie.modules.system.domain.Menu
;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.modules.system.service.dto.RoleDTO
;
import
me.zhengjie.modules.system.service.dto.RoleDTO
;
import
me.zhengjie.modules.system.service.dto.RoleQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.RoleQueryCriteria
;
...
@@ -59,7 +58,7 @@ public interface RoleService {
...
@@ -59,7 +58,7 @@ public interface RoleService {
@Cacheable
(
key
=
"'findByUsers_Id:' + #p0"
)
@Cacheable
(
key
=
"'findByUsers_Id:' + #p0"
)
List
<
RoleSmallDTO
>
findByUsers_Id
(
Long
id
);
List
<
RoleSmallDTO
>
findByUsers_Id
(
Long
id
);
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Integer
findByRoles
(
Set
<
Role
>
roles
);
Integer
findByRoles
(
Set
<
Role
>
roles
);
/**
/**
...
@@ -79,13 +78,14 @@ public interface RoleService {
...
@@ -79,13 +78,14 @@ public interface RoleService {
void
updateMenu
(
Role
resources
,
RoleDTO
roleDTO
);
void
updateMenu
(
Role
resources
,
RoleDTO
roleDTO
);
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
untiedMenu
(
Menu
menu
);
void
untiedMenu
(
Long
id
);
/**
/**
* queryAll
* queryAll
* @param pageable
* @param pageable
* @return
* @return
*/
*/
@Cacheable
Object
queryAll
(
Pageable
pageable
);
Object
queryAll
(
Pageable
pageable
);
/**
/**
...
@@ -94,5 +94,17 @@ public interface RoleService {
...
@@ -94,5 +94,17 @@ public interface RoleService {
* @param criteria
* @param criteria
* @return
* @return
*/
*/
@Cacheable
Object
queryAll
(
RoleQueryCriteria
criteria
,
Pageable
pageable
);
Object
queryAll
(
RoleQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll
* @param criteria
* @return
*/
@Cacheable
List
<
RoleDTO
>
queryAll
(
RoleQueryCriteria
criteria
);
@CacheEvict
(
allEntries
=
true
)
void
untiedPermission
(
Long
id
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
View file @
0f0392d7
...
@@ -8,6 +8,11 @@ import org.springframework.cache.annotation.CacheConfig;
...
@@ -8,6 +8,11 @@ import org.springframework.cache.annotation.CacheConfig;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -64,11 +69,10 @@ public interface UserService {
...
@@ -64,11 +69,10 @@ public interface UserService {
/**
/**
* 修改头像
* 修改头像
* @param username
* @param file
* @param url
*/
*/
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
updateAvatar
(
String
username
,
String
url
);
void
updateAvatar
(
MultipartFile
file
);
/**
/**
* 修改邮箱
* 修改邮箱
...
@@ -78,6 +82,11 @@ public interface UserService {
...
@@ -78,6 +82,11 @@ public interface UserService {
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
updateEmail
(
String
username
,
String
email
);
void
updateEmail
(
String
username
,
String
email
);
@Cacheable
(
keyGenerator
=
"keyGenerator"
)
@Cacheable
Object
queryAll
(
UserQueryCriteria
criteria
,
Pageable
pageable
);
Object
queryAll
(
UserQueryCriteria
criteria
,
Pageable
pageable
);
@Cacheable
List
<
UserDTO
>
queryAll
(
UserQueryCriteria
criteria
);
void
download
(
List
<
UserDTO
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
;
}
}
Prev
1
2
3
4
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