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
7c35a79c
Commit
7c35a79c
authored
May 05, 2020
by
ZhengJie
Browse files
[新增功能](el-admin v2.5): v2.5 beta
详情
https://www.ydyno.com/archives/1225.html
parent
d35ffc9d
Changes
295
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.security.service
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,14 +29,14 @@ import java.util.*;
/**
* @author Zheng Jie
* @
D
ate 2019年10月26日21:56:27
* @
d
ate 2019年10月26日21:56:27
*/
@Service
@Slf4j
public
class
OnlineUserService
{
private
final
SecurityProperties
properties
;
private
RedisUtils
redisUtils
;
private
final
RedisUtils
redisUtils
;
public
OnlineUserService
(
SecurityProperties
properties
,
RedisUtils
redisUtils
)
{
this
.
properties
=
properties
;
...
...
@@ -35,13 +50,13 @@ public class OnlineUserService {
* @param request /
*/
public
void
save
(
JwtUserDto
jwtUserDto
,
String
token
,
HttpServletRequest
request
){
String
job
=
jwtUserDto
.
getUser
().
getDept
().
getName
()
+
"/"
+
jwtUserDto
.
getUser
().
getJob
().
getName
()
;
String
dept
=
jwtUserDto
.
getUser
().
getDept
().
getName
();
String
ip
=
StringUtils
.
getIp
(
request
);
String
browser
=
StringUtils
.
getBrowser
(
request
);
String
address
=
StringUtils
.
getCityInfo
(
ip
);
OnlineUserDto
onlineUserDto
=
null
;
try
{
onlineUserDto
=
new
OnlineUserDto
(
jwtUserDto
.
getUsername
(),
jwtUserDto
.
getUser
().
getNickName
(),
job
,
browser
,
ip
,
address
,
EncryptUtils
.
desEncrypt
(
token
),
new
Date
());
onlineUserDto
=
new
OnlineUserDto
(
jwtUserDto
.
getUsername
(),
jwtUserDto
.
getUser
().
getNickName
(),
dept
,
browser
,
ip
,
address
,
EncryptUtils
.
desEncrypt
(
token
),
new
Date
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -114,7 +129,7 @@ public class OnlineUserService {
for
(
OnlineUserDto
user
:
all
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"用户名"
,
user
.
getUserName
());
map
.
put
(
"
岗位
"
,
user
.
get
Job
());
map
.
put
(
"
部门
"
,
user
.
get
Dept
());
map
.
put
(
"登录IP"
,
user
.
getIp
());
map
.
put
(
"登录地点"
,
user
.
getAddress
());
map
.
put
(
"浏览器"
,
user
.
getBrowser
());
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.security.service
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.EntityNotFoundException
;
import
me.zhengjie.modules.security.service.dto.JwtUserDto
;
...
...
@@ -16,19 +32,14 @@ import org.springframework.transaction.annotation.Transactional;
* @author Zheng Jie
* @date 2018-11-22
*/
@RequiredArgsConstructor
@Service
(
"userDetailsService"
)
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
UserDetailsServiceImpl
implements
UserDetailsService
{
private
final
UserService
userService
;
private
final
RoleService
roleService
;
public
UserDetailsServiceImpl
(
UserService
userService
,
RoleService
roleService
)
{
this
.
userService
=
userService
;
this
.
roleService
=
roleService
;
}
@Override
public
JwtUserDto
loadUserByUsername
(
String
username
)
{
UserDto
user
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/AuthUserDto.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.security.service.dto
;
import
lombok.Getter
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/JwtUserDto.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.security.service.dto
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/OnlineUserDto.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.security.service.dto
;
import
lombok.AllArgsConstructor
;
...
...
@@ -27,7 +42,7 @@ public class OnlineUserDto {
/**
* 岗位
*/
private
String
job
;
private
String
dept
;
/**
* 浏览器
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.annotations.CreationTimestamp
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Objects
;
import
java.util.Set
;
...
...
@@ -19,36 +34,33 @@ import java.util.Set;
@Entity
@Getter
@Setter
@Table
(
name
=
"dept"
)
public
class
Dept
implements
Serializable
{
@Table
(
name
=
"
sys_
dept"
)
public
class
Dept
extends
BaseEntity
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"dept_id"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"name"
,
nullable
=
false
)
@JsonIgnore
@ManyToMany
(
mappedBy
=
"depts"
)
@ApiModelProperty
(
value
=
"角色"
)
private
Set
<
Role
>
roles
;
@NotBlank
@ApiModelProperty
(
value
=
"部门名称"
)
private
String
name
;
@NotNull
@ApiModelProperty
(
value
=
"是否启用"
)
private
Boolean
enabled
;
@Column
(
name
=
"pid"
,
nullable
=
false
)
@NotNull
@ApiModelProperty
(
value
=
"上级部门"
)
private
Long
pid
;
@JsonIgnore
@ManyToMany
(
mappedBy
=
"depts"
)
private
Set
<
Role
>
roles
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
public
@interface
Update
{}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dict.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
...
...
@@ -18,28 +32,23 @@ import java.util.List;
@Entity
@Getter
@Setter
@Table
(
name
=
"dict"
)
public
class
Dict
implements
Serializable
{
@Table
(
name
=
"
sys_
dict"
)
public
class
Dict
extends
BaseEntity
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"dict_id"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"name"
,
nullable
=
false
,
unique
=
true
)
@NotBlank
private
String
name
;
@Column
(
name
=
"remark"
)
private
String
remark
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
@OneToMany
(
mappedBy
=
"dict"
,
cascade
={
CascadeType
.
PERSIST
,
CascadeType
.
REMOVE
})
private
List
<
DictDetail
>
dictDetails
;
public
@interface
Update
{}
@NotBlank
@ApiModelProperty
(
value
=
"名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
)
private
String
description
;
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/DictDetail.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.annotations.CreationTimestamp
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author Zheng Jie
...
...
@@ -15,34 +30,27 @@ import java.sql.Timestamp;
@Entity
@Getter
@Setter
@Table
(
name
=
"dict_detail"
)
public
class
DictDetail
implements
Serializable
{
@Table
(
name
=
"
sys_
dict_detail"
)
public
class
DictDetail
extends
BaseEntity
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"detail_id"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
/** 字典标签 */
@Column
(
name
=
"label"
,
nullable
=
false
)
private
String
label
;
/** 字典值 */
@Column
(
name
=
"value"
,
nullable
=
false
)
private
String
value
;
/** 排序 */
@Column
(
name
=
"sort"
)
private
Integer
sort
=
999
;
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"dict_id"
)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@ApiModelProperty
(
value
=
"字典"
,
hidden
=
true
)
private
Dict
dict
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
@ApiModelProperty
(
value
=
"字典标签"
)
private
String
label
;
@ApiModelProperty
(
value
=
"字典值"
)
private
String
value
;
public
@interface
Update
{}
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
dictSort
=
999
;
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Job.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.annotations.CreationTimestamp
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author Zheng Jie
...
...
@@ -18,34 +33,25 @@ import java.sql.Timestamp;
@Entity
@Getter
@Setter
@Table
(
name
=
"job"
)
public
class
Job
implements
Serializable
{
@Table
(
name
=
"
sys_
job"
)
public
class
Job
extends
BaseEntity
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"job_id"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"name"
,
nullable
=
false
)
@NotBlank
@ApiModelProperty
(
value
=
"岗位名称"
)
private
String
name
;
@Column
(
unique
=
true
)
@NotNull
private
Long
sort
;
@ApiModelProperty
(
value
=
"岗位排序"
)
private
Long
jobSort
;
@Column
(
name
=
"enabled"
,
nullable
=
false
)
@NotNull
@ApiModelProperty
(
value
=
"是否启用"
)
private
Boolean
enabled
;
@OneToOne
@JoinColumn
(
name
=
"dept_id"
)
private
Dept
dept
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
public
@interface
Update
{}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
...
...
@@ -19,62 +36,61 @@ import java.util.Set;
@Entity
@Getter
@Setter
@Table
(
name
=
"menu"
)
public
class
Menu
implements
Serializable
{
@Table
(
name
=
"
sys_
menu"
)
public
class
Menu
extends
BaseEntity
implements
Serializable
{
@Id
@
GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@
Column
(
name
=
"menu_id"
)
@NotNull
(
groups
=
{
Update
.
class
})
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@JsonIgnore
@ManyToMany
(
mappedBy
=
"menus"
)
@ApiModelProperty
(
value
=
"菜单角色"
)
private
Set
<
Role
>
roles
;
@NotBlank
private
String
name
;
@ApiModelProperty
(
value
=
"菜单标题"
)
private
String
title
;
@Column
(
unique
=
true
)
private
Long
sort
=
999L
;
@Column
(
name
=
"name"
)
@ApiModelProperty
(
value
=
"菜单组件名称"
)
private
String
componentName
;
@
Column
(
nam
e
=
"
path
"
)
private
String
path
;
@
ApiModelProperty
(
valu
e
=
"
排序
"
)
private
Integer
menuSort
=
999
;
@ApiModelProperty
(
value
=
"组件路径"
)
private
String
component
;
/** 类型,目录、菜单、按钮 */
@Column
(
name
=
"type"
)
@ApiModelProperty
(
value
=
"路由地址"
)
private
String
path
;
@ApiModelProperty
(
value
=
"菜单类型,目录、菜单、按钮"
)
private
Integer
type
;
/** 权限 */
@Column
(
name
=
"permission"
)
@ApiModelProperty
(
value
=
"权限标识"
)
private
String
permission
;
@Column
(
unique
=
true
,
name
=
"component_name"
)
private
String
componentName
;
@ApiModelProperty
(
value
=
"菜单图标"
)
private
String
icon
;
@Column
(
columnDefinition
=
"bit(1) default 0"
)
@ApiModelProperty
(
value
=
"缓存"
)
private
Boolean
cache
;
@Column
(
columnDefinition
=
"bit(1) default 0"
)
@ApiModelProperty
(
value
=
"是否隐藏"
)
private
Boolean
hidden
;
/** 上级菜单ID */
@Column
(
name
=
"pid"
,
nullable
=
false
)
@ApiModelProperty
(
value
=
"上级菜单"
)
private
Long
pid
;
/** 是否为外链 true/false */
@Column
(
name
=
"i_frame"
)
@ApiModelProperty
(
value
=
"外链菜单"
)
private
Boolean
iFrame
;
@ManyToMany
(
mappedBy
=
"menus"
)
@JsonIgnore
private
Set
<
Role
>
roles
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
public
@interface
Update
{}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Role.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
...
...
@@ -17,53 +34,51 @@ import java.util.Set;
* @author Zheng Jie
* @date 2018-11-22
*/
@Entity
@Table
(
name
=
"role"
)
@Getter
@Setter
public
class
Role
implements
Serializable
{
@Entity
@Table
(
name
=
"sys_role"
)
public
class
Role
extends
BaseEntity
implements
Serializable
{
@Id
@
GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@
Column
(
name
=
"role_id"
)
@NotNull
(
groups
=
{
Update
.
class
})
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
private
Long
id
;
@Column
(
nullable
=
false
)
@NotBlank
private
String
name
;
/** 数据权限类型 全部 、 本级 、 自定义 */
@Column
(
name
=
"data_scope"
)
private
String
dataScope
=
"本级"
;
/** 数值越小,级别越大 */
@Column
(
name
=
"level"
)
private
Integer
level
=
3
;
@Column
private
String
remark
;
/** 权限 */
@Column
(
name
=
"permission"
)
private
String
permission
;
@JsonIgnore
@ManyToMany
(
mappedBy
=
"roles"
)
@ApiModelProperty
(
value
=
"用户"
,
hidden
=
true
)
private
Set
<
User
>
users
;
@ManyToMany
@JoinTable
(
name
=
"roles_menus"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"menu_id"
,
referencedColumnName
=
"id"
)})
@JoinTable
(
name
=
"sys_roles_menus"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"role_id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"menu_id"
,
referencedColumnName
=
"menu_id"
)})
@ApiModelProperty
(
value
=
"菜单"
,
hidden
=
true
)
private
Set
<
Menu
>
menus
;
@ManyToMany
@JoinTable
(
name
=
"roles_depts"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"dept_id"
,
referencedColumnName
=
"id"
)})
@JoinTable
(
name
=
"sys_roles_depts"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"role_id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"dept_id"
,
referencedColumnName
=
"dept_id"
)})
@ApiModelProperty
(
value
=
"部门"
,
hidden
=
true
)
private
Set
<
Dept
>
depts
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
@NotBlank
@ApiModelProperty
(
value
=
"名称"
,
hidden
=
true
)
private
String
name
;
@ApiModelProperty
(
value
=
"数据权限,全部 、 本级 、 自定义"
)
private
String
dataScope
=
"本级"
;
@Column
(
name
=
"level"
)
@ApiModelProperty
(
value
=
"级别,数值越小,级别越大"
)
private
Integer
level
=
3
;
public
@interface
Update
{}
@ApiModelProperty
(
value
=
"描述"
)
private
String
description
;
@Override
public
boolean
equals
(
Object
o
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.annotations.CreationTimestamp
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.validation.constraints.Email
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Pattern
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.Set
;
...
...
@@ -21,61 +35,75 @@ import java.util.Set;
@Entity
@Getter
@Setter
@Table
(
name
=
"user"
)
public
class
User
implements
Serializable
{
@Table
(
name
=
"
sys_
user"
)
public
class
User
extends
BaseEntity
implements
Serializable
{
@Id
@
GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@
Column
(
name
=
"user_id"
)
@NotNull
(
groups
=
Update
.
class
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
private
Long
id
;
@ManyToMany
@ApiModelProperty
(
value
=
"用户角色"
)
@JoinTable
(
name
=
"sys_users_roles"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"user_id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"role_id"
)})
private
Set
<
Role
>
roles
;
@ManyToMany
@ApiModelProperty
(
value
=
"用户岗位"
)
@JoinTable
(
name
=
"sys_users_jobs"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"user_id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"job_id"
,
referencedColumnName
=
"job_id"
)})
private
Set
<
Job
>
jobs
;
@OneToOne
@JoinColumn
(
name
=
"dept_id"
)
@ApiModelProperty
(
value
=
"用户部门"
)
private
Dept
dept
;
@NotBlank
@Column
(
unique
=
true
)
@ApiModelProperty
(
value
=
"用户名称"
)
private
String
username
;
/** 用户昵称 */
@NotBlank
@ApiModelProperty
(
value
=
"用户昵称"
)
private
String
nickName
;
/** 性别 */
private
String
sex
;
@OneToOne
@JoinColumn
(
name
=
"avatar_id"
)
private
UserAvatar
userAvatar
;
@NotBlank
@Email
@NotBlank
@ApiModelProperty
(
value
=
"邮箱"
)
private
String
email
;
@NotBlank
@ApiModelProperty
(
value
=
"电话号码"
)
private
String
phone
;
@NotNull
private
Boolean
enabled
;
private
String
password
;
@ApiModelProperty
(
value
=
"用户性别"
)
private
String
gender
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
@ApiModelProperty
(
value
=
"头像真实名称"
,
hidden
=
true
)
private
String
avatarName
;
@
Column
(
name
=
"last_password_reset_time"
)
private
Date
lastPasswordResetTime
;
@
ApiModelProperty
(
value
=
"头像存储的路径"
,
hidden
=
true
)
private
String
avatarPath
;
@ManyToMany
@JoinTable
(
name
=
"users_roles"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)})
private
Set
<
Role
>
roles
;
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
@
OneToOne
@
JoinColumn
(
name
=
"job_id
"
)
private
Job
job
;
@
NotNull
@
ApiModelProperty
(
value
=
"是否启用
"
)
private
Boolean
enabled
;
@OneToOne
@JoinColumn
(
name
=
"dept_id"
)
private
Dept
dept
;
@ApiModelProperty
(
value
=
"是否为admin账号"
,
hidden
=
true
)
private
Boolean
isAdmin
=
false
;
public
@interface
Update
{}
@Column
(
name
=
"pwd_reset_time"
)
@ApiModelProperty
(
value
=
"最后修改密码的时间"
,
hidden
=
true
)
private
Date
pwdResetTime
;
@Override
public
boolean
equals
(
Object
o
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java
deleted
100644 → 0
View file @
d35ffc9d
package
me.zhengjie.modules.system.domain
;
import
cn.hutool.core.util.ObjectUtil
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author Zheng Jie
* @date 2019年9月7日 16:16:59
*/
@Entity
@Getter
@Setter
@NoArgsConstructor
@Table
(
name
=
"user_avatar"
)
public
class
UserAvatar
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
String
realName
;
private
String
path
;
private
String
size
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
public
UserAvatar
(
UserAvatar
userAvatar
,
String
realName
,
String
path
,
String
size
)
{
this
.
id
=
ObjectUtil
.
isNotEmpty
(
userAvatar
)
?
userAvatar
.
getId
()
:
null
;
this
.
realName
=
realName
;
this
.
path
=
path
;
this
.
size
=
size
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain.vo
;
import
lombok.AllArgsConstructor
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuVo.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain.vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/UserPassVo.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.domain.vo
;
import
lombok.Data
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Dept
;
...
...
@@ -26,7 +41,7 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
* @param id ID
* @return /
*/
@Query
(
value
=
"select name from dept where id = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"select name from
sys_
dept where
dept_
id = ?1"
,
nativeQuery
=
true
)
String
findNameById
(
Long
id
);
/**
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictDetailRepository.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.DictDetail
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Dict
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/JobRepository.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Job
;
...
...
@@ -9,4 +24,11 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2019-03-29
*/
public
interface
JobRepository
extends
JpaRepository
<
Job
,
Long
>,
JpaSpecificationExecutor
<
Job
>
{
/**
* 根据名称查询
* @param name 名称
* @return /
*/
Job
findByName
(
String
name
);
}
\ No newline at end of file
Prev
1
…
5
6
7
8
9
10
11
12
13
…
15
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