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
8cb7dc88
Commit
8cb7dc88
authored
Oct 24, 2019
by
dqjdda
Browse files
加入实体基类、DTO基类、修改部分实体继承基类
parent
bf7c1eeb
Changes
46
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/aspect/LimitAspect.java
View file @
8cb7dc88
...
@@ -44,7 +44,7 @@ public class LimitAspect {
...
@@ -44,7 +44,7 @@ public class LimitAspect {
String
key
=
limit
.
key
();
String
key
=
limit
.
key
();
if
(
StringUtils
.
isEmpty
(
key
))
{
if
(
StringUtils
.
isEmpty
(
key
))
{
if
(
limitType
==
LimitType
.
IP
)
{
if
(
limitType
==
LimitType
.
IP
)
{
key
=
StringUtils
.
getI
P
(
request
);
key
=
StringUtils
.
getI
p
(
request
);
}
else
{
}
else
{
key
=
signatureMethod
.
getName
();
key
=
signatureMethod
.
getName
();
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/aspect/LimitType.java
View file @
8cb7dc88
package
me.zhengjie.aspect
;
package
me.zhengjie.aspect
;
/**
* 限流枚举
* @author /
*/
public
enum
LimitType
{
public
enum
LimitType
{
// 默认
CUSTOMER
,
CUSTOMER
,
//
by ip addr
//
by ip addr
IP
;
IP
;
}
}
eladmin-common/src/main/java/me/zhengjie/base/BaseDTO.java
0 → 100644
View file @
8cb7dc88
package
me.zhengjie.base
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author Zheng Jie
* @Date 2019年10月24日20:48:53
*/
@Getter
@Setter
public
class
BaseDTO
implements
Serializable
{
private
Boolean
isDelete
;
private
Timestamp
createTime
;
private
Timestamp
updateTime
;
}
eladmin-common/src/main/java/me/zhengjie/base/BaseEntity.java
0 → 100644
View file @
8cb7dc88
package
me.zhengjie.base
;
import
lombok.*
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
javax.persistence.Column
;
import
javax.persistence.MappedSuperclass
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.lang.reflect.Field
;
/**
* @author Zheng Jie
* @Date 2019年10月24日20:46:32
*/
@Getter
@Setter
@MappedSuperclass
public
class
BaseEntity
implements
Serializable
{
// 删除标识
@Column
(
name
=
"is_delete"
,
columnDefinition
=
"bit default 0"
)
private
Boolean
isDelete
=
false
;
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
@Column
(
name
=
"update_time"
)
@UpdateTimestamp
private
Timestamp
updateTime
;
public
@interface
New
{}
public
@interface
Update
{}
@Override
public
String
toString
()
{
ToStringBuilder
builder
=
new
ToStringBuilder
(
this
);
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
try
{
for
(
Field
f
:
fields
)
{
f
.
setAccessible
(
true
);
builder
.
append
(
f
.
getName
(),
f
.
get
(
this
)).
append
(
"\n"
);
}
}
catch
(
Exception
e
)
{
builder
.
append
(
"toString builder encounter an error"
);
}
return
builder
.
toString
();
}
}
eladmin-common/src/main/java/me/zhengjie/
mapper/Entity
Mapper.java
→
eladmin-common/src/main/java/me/zhengjie/
base/Base
Mapper.java
View file @
8cb7dc88
package
me.zhengjie.
mapper
;
package
me.zhengjie.
base
;
import
java.util.List
;
import
java.util.List
;
...
@@ -6,7 +6,7 @@ import java.util.List;
...
@@ -6,7 +6,7 @@ import java.util.List;
* @author Zheng Jie
* @author Zheng Jie
* @date 2018-11-23
* @date 2018-11-23
*/
*/
public
interface
Entity
Mapper
<
D
,
E
>
{
public
interface
Base
Mapper
<
D
,
E
>
{
/**
/**
* DTO转Entity
* DTO转Entity
...
...
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
View file @
8cb7dc88
...
@@ -145,7 +145,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -145,7 +145,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
if
(!
dest
.
getParentFile
().
exists
())
{
if
(!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
dest
.
getParentFile
().
mkdirs
();
}
}
file
.
transferTo
(
dest
);
// 文件写入
// 文件写入
file
.
transferTo
(
dest
);
return
dest
;
return
dest
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -197,7 +198,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -197,7 +198,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return
"音乐"
;
return
"音乐"
;
}
else
if
(
video
.
contains
(
type
)){
}
else
if
(
video
.
contains
(
type
)){
return
"视频"
;
return
"视频"
;
}
else
return
"其他"
;
}
else
{
return
"其他"
;
}
}
}
public
static
String
getFileTypeByMimeType
(
String
type
)
{
public
static
String
getFileTypeByMimeType
(
String
type
)
{
...
@@ -215,8 +218,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -215,8 +218,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
* 判断两个文件是否相同
* 判断两个文件是否相同
*/
*/
public
static
boolean
check
(
File
file1
,
File
file2
)
{
public
static
boolean
check
(
File
file1
,
File
file2
)
{
String
img1Md5
=
getM
D
5
(
file1
);
String
img1Md5
=
getM
d
5
(
file1
);
String
img2Md5
=
getM
D
5
(
file2
);
String
img2Md5
=
getM
d
5
(
file2
);
return
img1Md5
.
equals
(
img2Md5
);
return
img1Md5
.
equals
(
img2Md5
);
}
}
...
@@ -244,7 +247,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -244,7 +247,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return
b
;
return
b
;
}
}
private
static
String
getM
D
5
(
byte
[]
bytes
)
{
private
static
String
getM
d
5
(
byte
[]
bytes
)
{
// 16进制字符
// 16进制字符
char
[]
hexDigits
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
char
[]
hexDigits
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
try
{
try
{
...
@@ -266,8 +269,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -266,8 +269,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return
null
;
return
null
;
}
}
public
static
String
getM
D
5
(
File
file
)
{
public
static
String
getM
d
5
(
File
file
)
{
return
getM
D
5
(
getByte
(
file
));
return
getM
d
5
(
getByte
(
file
));
}
}
}
}
eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
View file @
8cb7dc88
...
@@ -69,6 +69,7 @@ public class QueryHelp {
...
@@ -69,6 +69,7 @@ public class QueryHelp {
join
=
root
.
join
(
name
,
JoinType
.
RIGHT
);
join
=
root
.
join
(
name
,
JoinType
.
RIGHT
);
}
}
break
;
break
;
default
:
break
;
}
}
}
}
}
}
...
@@ -105,6 +106,7 @@ public class QueryHelp {
...
@@ -105,6 +106,7 @@ public class QueryHelp {
list
.
add
(
getExpression
(
attributeName
,
join
,
root
).
in
((
Collection
<
Long
>)
val
));
list
.
add
(
getExpression
(
attributeName
,
join
,
root
).
in
((
Collection
<
Long
>)
val
));
}
}
break
;
break
;
default
:
break
;
}
}
}
}
field
.
setAccessible
(
accessible
);
field
.
setAccessible
(
accessible
);
...
...
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
View file @
8cb7dc88
...
@@ -107,7 +107,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
...
@@ -107,7 +107,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
/**
* 获取ip地址
* 获取ip地址
*/
*/
public
static
String
getI
P
(
HttpServletRequest
request
)
{
public
static
String
getI
p
(
HttpServletRequest
request
)
{
String
ip
=
request
.
getHeader
(
"x-forwarded-for"
);
String
ip
=
request
.
getHeader
(
"x-forwarded-for"
);
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
...
...
eladmin-common/src/test/java/me/zhengjie/utils/StringUtilsTest.java
View file @
8cb7dc88
...
@@ -38,6 +38,6 @@ public class StringUtilsTest {
...
@@ -38,6 +38,6 @@ public class StringUtilsTest {
@Test
@Test
public
void
testGetIP
()
{
public
void
testGetIP
()
{
assertEquals
(
"127.0.0.1"
,
getI
P
(
new
MockHttpServletRequest
()));
assertEquals
(
"127.0.0.1"
,
getI
p
(
new
MockHttpServletRequest
()));
}
}
}
}
\ No newline at end of file
eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java
View file @
8cb7dc88
...
@@ -52,7 +52,7 @@ public class LogAspect {
...
@@ -52,7 +52,7 @@ public class LogAspect {
currentTime
=
System
.
currentTimeMillis
();
currentTime
=
System
.
currentTimeMillis
();
result
=
joinPoint
.
proceed
();
result
=
joinPoint
.
proceed
();
Log
log
=
new
Log
(
"INFO"
,
System
.
currentTimeMillis
()
-
currentTime
);
Log
log
=
new
Log
(
"INFO"
,
System
.
currentTimeMillis
()
-
currentTime
);
logService
.
save
(
getUsername
(),
StringUtils
.
getI
P
(
RequestHolder
.
getHttpServletRequest
()),
joinPoint
,
log
);
logService
.
save
(
getUsername
(),
StringUtils
.
getI
p
(
RequestHolder
.
getHttpServletRequest
()),
joinPoint
,
log
);
return
result
;
return
result
;
}
}
...
@@ -66,7 +66,7 @@ public class LogAspect {
...
@@ -66,7 +66,7 @@ public class LogAspect {
public
void
logAfterThrowing
(
JoinPoint
joinPoint
,
Throwable
e
)
{
public
void
logAfterThrowing
(
JoinPoint
joinPoint
,
Throwable
e
)
{
Log
log
=
new
Log
(
"ERROR"
,
System
.
currentTimeMillis
()
-
currentTime
);
Log
log
=
new
Log
(
"ERROR"
,
System
.
currentTimeMillis
()
-
currentTime
);
log
.
setExceptionDetail
(
ThrowableUtil
.
getStackTrace
(
e
).
getBytes
());
log
.
setExceptionDetail
(
ThrowableUtil
.
getStackTrace
(
e
).
getBytes
());
logService
.
save
(
getUsername
(),
StringUtils
.
getI
P
(
RequestHolder
.
getHttpServletRequest
()),
(
ProceedingJoinPoint
)
joinPoint
,
log
);
logService
.
save
(
getUsername
(),
StringUtils
.
getI
p
(
RequestHolder
.
getHttpServletRequest
()),
(
ProceedingJoinPoint
)
joinPoint
,
log
);
}
}
public
String
getUsername
()
{
public
String
getUsername
()
{
...
...
eladmin-logging/src/main/java/me/zhengjie/service/mapper/LogErrorMapper.java
View file @
8cb7dc88
package
me.zhengjie.service.mapper
;
package
me.zhengjie.service.mapper
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.mapper.EntityMapper
;
import
me.zhengjie.service.dto.LogErrorDTO
;
import
me.zhengjie.service.dto.LogErrorDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
import
org.mapstruct.ReportingPolicy
;
...
@@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
...
@@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
* @date 2019-5-22
* @date 2019-5-22
*/
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
LogErrorMapper
extends
Entity
Mapper
<
LogErrorDTO
,
Log
>
{
public
interface
LogErrorMapper
extends
Base
Mapper
<
LogErrorDTO
,
Log
>
{
}
}
\ No newline at end of file
eladmin-logging/src/main/java/me/zhengjie/service/mapper/LogSmallMapper.java
View file @
8cb7dc88
package
me.zhengjie.service.mapper
;
package
me.zhengjie.service.mapper
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.mapper.EntityMapper
;
import
me.zhengjie.service.dto.LogSmallDTO
;
import
me.zhengjie.service.dto.LogSmallDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
import
org.mapstruct.ReportingPolicy
;
...
@@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
...
@@ -11,6 +11,6 @@ import org.mapstruct.ReportingPolicy;
* @date 2019-5-22
* @date 2019-5-22
*/
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
LogSmallMapper
extends
Entity
Mapper
<
LogSmallDTO
,
Log
>
{
public
interface
LogSmallMapper
extends
Base
Mapper
<
LogSmallDTO
,
Log
>
{
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzJob.java
View file @
8cb7dc88
package
me.zhengjie.modules.quartz.domain
;
package
me.zhengjie.modules.quartz.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -16,7 +13,7 @@ import java.sql.Timestamp;
...
@@ -16,7 +13,7 @@ import java.sql.Timestamp;
@Data
@Data
@Entity
@Entity
@Table
(
name
=
"quartz_job"
)
@Table
(
name
=
"quartz_job"
)
public
class
QuartzJob
implem
en
t
s
Serializable
{
public
class
QuartzJob
ext
en
d
s
BaseEntity
{
public
static
final
String
JOB_KEY
=
"JOB_KEY"
;
public
static
final
String
JOB_KEY
=
"JOB_KEY"
;
...
@@ -56,11 +53,4 @@ public class QuartzJob implements Serializable {
...
@@ -56,11 +53,4 @@ public class QuartzJob implements Serializable {
@Column
(
name
=
"remark"
)
@Column
(
name
=
"remark"
)
@NotBlank
@NotBlank
private
String
remark
;
private
String
remark
;
// 创建日期
@UpdateTimestamp
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
public
interface
Update
{}
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java
View file @
8cb7dc88
...
@@ -2,12 +2,12 @@ package me.zhengjie.modules.system.domain;
...
@@ -2,12 +2,12 @@ package me.zhengjie.modules.system.domain;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.annotations.CreationTimestamp
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.sql.Timestamp
;
import
java.io.Serializable
;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
...
@@ -15,9 +15,10 @@ import java.util.Set;
...
@@ -15,9 +15,10 @@ import java.util.Set;
* @date 2019-03-25
* @date 2019-03-25
*/
*/
@Entity
@Entity
@Data
@Getter
@Setter
@Table
(
name
=
"dept"
)
@Table
(
name
=
"dept"
)
public
class
Dept
implem
en
t
s
Serializable
{
public
class
Dept
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -39,10 +40,4 @@ public class Dept implements Serializable {
...
@@ -39,10 +40,4 @@ public class Dept implements Serializable {
@JsonIgnore
@JsonIgnore
@ManyToMany
(
mappedBy
=
"depts"
)
@ManyToMany
(
mappedBy
=
"depts"
)
private
Set
<
Role
>
roles
;
private
Set
<
Role
>
roles
;
@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/Dict.java
View file @
8cb7dc88
package
me.zhengjie.modules.system.domain
;
package
me.zhengjie.modules.system.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
...
@@ -12,9 +16,10 @@ import java.util.List;
...
@@ -12,9 +16,10 @@ import java.util.List;
* @date 2019-04-10
* @date 2019-04-10
*/
*/
@Entity
@Entity
@Data
@Getter
@Setter
@Table
(
name
=
"dict"
)
@Table
(
name
=
"dict"
)
public
class
Dict
implem
en
t
s
Serializable
{
public
class
Dict
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -31,6 +36,4 @@ public class Dict implements Serializable {
...
@@ -31,6 +36,4 @@ public class Dict implements Serializable {
@OneToMany
(
mappedBy
=
"dict"
,
cascade
={
CascadeType
.
PERSIST
,
CascadeType
.
REMOVE
})
@OneToMany
(
mappedBy
=
"dict"
,
cascade
={
CascadeType
.
PERSIST
,
CascadeType
.
REMOVE
})
private
List
<
DictDetail
>
dictDetails
;
private
List
<
DictDetail
>
dictDetails
;
public
@interface
Update
{}
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/DictDetail.java
View file @
8cb7dc88
package
me.zhengjie.modules.system.domain
;
package
me.zhengjie.modules.system.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -10,9 +14,10 @@ import java.io.Serializable;
...
@@ -10,9 +14,10 @@ import java.io.Serializable;
* @date 2019-04-10
* @date 2019-04-10
*/
*/
@Entity
@Entity
@Data
@Getter
@Setter
@Table
(
name
=
"dict_detail"
)
@Table
(
name
=
"dict_detail"
)
public
class
DictDetail
implem
en
t
s
Serializable
{
public
class
DictDetail
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -36,6 +41,4 @@ public class DictDetail implements Serializable {
...
@@ -36,6 +41,4 @@ public class DictDetail implements Serializable {
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"dict_id"
)
@JoinColumn
(
name
=
"dict_id"
)
private
Dict
dict
;
private
Dict
dict
;
public
@interface
Update
{}
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Job.java
View file @
8cb7dc88
package
me.zhengjie.modules.system.domain
;
package
me.zhengjie.modules.system.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.*
;
import
org.hibernate.annotations.*
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
...
@@ -15,9 +18,10 @@ import java.io.Serializable;
...
@@ -15,9 +18,10 @@ import java.io.Serializable;
* @date 2019-03-29
* @date 2019-03-29
*/
*/
@Entity
@Entity
@Data
@Getter
@Setter
@Table
(
name
=
"job"
)
@Table
(
name
=
"job"
)
public
class
Job
implem
en
t
s
Serializable
{
public
class
Job
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -40,10 +44,4 @@ public class Job implements Serializable {
...
@@ -40,10 +44,4 @@ public class Job implements Serializable {
@OneToOne
@OneToOne
@JoinColumn
(
name
=
"dept_id"
)
@JoinColumn
(
name
=
"dept_id"
)
private
Dept
dept
;
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 @
8cb7dc88
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
...
@@ -20,7 +21,7 @@ import java.util.Set;
...
@@ -20,7 +21,7 @@ import java.util.Set;
@Getter
@Getter
@Setter
@Setter
@Table
(
name
=
"menu"
)
@Table
(
name
=
"menu"
)
public
class
Menu
implem
en
t
s
Serializable
{
public
class
Menu
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -63,12 +64,6 @@ public class Menu implements Serializable {
...
@@ -63,12 +64,6 @@ public class Menu implements Serializable {
@JsonIgnore
@JsonIgnore
private
Set
<
Role
>
roles
;
private
Set
<
Role
>
roles
;
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
public
interface
Update
{}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Permission.java
View file @
8cb7dc88
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
...
@@ -19,7 +20,7 @@ import java.util.Set;
...
@@ -19,7 +20,7 @@ import java.util.Set;
@Getter
@Getter
@Setter
@Setter
@Table
(
name
=
"permission"
)
@Table
(
name
=
"permission"
)
public
class
Permission
implem
en
t
s
Serializable
{
public
class
Permission
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -40,21 +41,4 @@ public class Permission implements Serializable{
...
@@ -40,21 +41,4 @@ public class Permission implements Serializable{
@JsonIgnore
@JsonIgnore
@ManyToMany
(
mappedBy
=
"permissions"
)
@ManyToMany
(
mappedBy
=
"permissions"
)
private
Set
<
Role
>
roles
;
private
Set
<
Role
>
roles
;
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
@Override
public
String
toString
()
{
return
"Permission{"
+
"id="
+
id
+
", name='"
+
name
+
'\''
+
", pid="
+
pid
+
", alias='"
+
alias
+
'\''
+
", createTime="
+
createTime
+
'}'
;
}
public
interface
Update
{}
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Role.java
View file @
8cb7dc88
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
...
@@ -3,6 +3,7 @@ package me.zhengjie.modules.system.domain;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
...
@@ -21,7 +22,7 @@ import java.util.Set;
...
@@ -21,7 +22,7 @@ import java.util.Set;
@Table
(
name
=
"role"
)
@Table
(
name
=
"role"
)
@Getter
@Getter
@Setter
@Setter
public
class
Role
implem
en
t
s
Serializable
{
public
class
Role
ext
en
d
s
BaseEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -59,20 +60,6 @@ public class Role implements Serializable {
...
@@ -59,20 +60,6 @@ public class Role implements Serializable {
@JoinTable
(
name
=
"roles_depts"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"dept_id"
,
referencedColumnName
=
"id"
)})
@JoinTable
(
name
=
"roles_depts"
,
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"dept_id"
,
referencedColumnName
=
"id"
)})
private
Set
<
Dept
>
depts
;
private
Set
<
Dept
>
depts
;
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
@Override
public
String
toString
()
{
return
"Role{"
+
"id="
+
id
+
", name='"
+
name
+
'\''
+
", remark='"
+
remark
+
'\''
+
", createDateTime="
+
createTime
+
'}'
;
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment