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
45973ab8
"source/vscode:/vscode.git/clone" did not exist on "895a14769bc1cdb32dd69b3cc1db0af7a94862be"
Commit
45973ab8
authored
Feb 10, 2020
by
Elune
Browse files
Merge branch '2.5dev' of github.com:elunez/eladmin into 2.5dev
parents
e453f2b8
5f8fa1f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/base/BaseEntity.java
View file @
45973ab8
package
me.zhengjie.base
;
package
me.zhengjie.base
;
import
lombok.*
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
org.springframework.data.annotation.CreatedBy
;
import
org.springframework.data.annotation.LastModifiedBy
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.EntityListeners
;
import
javax.persistence.MappedSuperclass
;
import
javax.persistence.MappedSuperclass
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.sql.Timestamp
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -17,18 +23,39 @@ import java.lang.reflect.Field;
...
@@ -17,18 +23,39 @@ import java.lang.reflect.Field;
@Getter
@Getter
@Setter
@Setter
@MappedSuperclass
@MappedSuperclass
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
BaseEntity
implements
Serializable
{
public
class
BaseEntity
implements
Serializable
{
/** 删除标识 **/
/** 删除标识 **/
@Column
(
name
=
"is_delete"
,
columnDefinition
=
"bit default 0"
)
@Column
(
name
=
"is_delete"
,
columnDefinition
=
"bit default 0"
)
private
Boolean
isDelete
=
false
;
private
Boolean
isDelete
=
false
;
@Column
(
name
=
"create_time"
)
/**
* 创建人
*/
@CreatedBy
@Column
(
name
=
"create_by"
,
updatable
=
false
)
private
String
createdBy
;
/**
* 创建时间
*/
@CreationTimestamp
@CreationTimestamp
@Column
(
name
=
"create_time"
,
updatable
=
false
)
private
Timestamp
createTime
;
private
Timestamp
createTime
;
@Column
(
name
=
"update_time"
)
/**
* 更新人
*/
@LastModifiedBy
@Column
(
name
=
"update_by"
)
private
String
updatedBy
;
/**
* 更新时间
*/
@UpdateTimestamp
@UpdateTimestamp
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
private
Timestamp
updateTime
;
public
@interface
Update
{}
public
@interface
Update
{}
...
...
eladmin-system/src/main/java/me/zhengjie/AppRun.java
View file @
45973ab8
...
@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
...
@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
*/
*/
@EnableAsync
@EnableAsync
@RestController
@RestController
/** 开启审计功能 */
@EnableJpaAuditing
(
auditorAwareRef
=
"auditorAware"
)
@SpringBootApplication
@SpringBootApplication
@EnableTransactionManagement
@EnableTransactionManagement
public
class
AppRun
{
public
class
AppRun
{
...
...
eladmin-system/src/main/java/me/zhengjie/config/AuditorConfig.java
0 → 100644
View file @
45973ab8
package
me.zhengjie.config
;
import
me.zhengjie.utils.SecurityUtils
;
import
org.springframework.data.domain.AuditorAware
;
import
org.springframework.stereotype.Component
;
import
java.util.Optional
;
/**
* @描述 : 设置审计
* @作者 : Dong ZhaoYang
* @日期 : 2019/10/28
* @时间 : 10:29
*/
@Component
(
"auditorAware"
)
public
class
AuditorConfig
implements
AuditorAware
<
String
>
{
/**
* 返回操作员标志信息
*
* @return
*/
@Override
public
Optional
<
String
>
getCurrentAuditor
()
{
// 这里应根据实际业务情况获取具体信息
return
Optional
.
of
(
SecurityUtils
.
getUsername
());
}
}
sql/eladmin.sql
View file @
45973ab8
...
@@ -80,7 +80,8 @@ CREATE TABLE `dept` (
...
@@ -80,7 +80,8 @@ CREATE TABLE `dept` (
`pid`
bigint
(
20
)
NOT
NULL
COMMENT
'上级部门'
,
`pid`
bigint
(
20
)
NOT
NULL
COMMENT
'上级部门'
,
`enabled`
bit
(
1
)
NOT
NULL
COMMENT
'状态'
,
`enabled`
bit
(
1
)
NOT
NULL
COMMENT
'状态'
,
`create_time`
datetime
NULL
DEFAULT
NULL
COMMENT
'创建日期'
,
`create_time`
datetime
NULL
DEFAULT
NULL
COMMENT
'创建日期'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
KEY
`idx_pid`
(
`pid`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
12
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'部门'
ROW_FORMAT
=
Compact
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
12
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'部门'
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- ----------------------------
...
@@ -103,7 +104,8 @@ CREATE TABLE `dict` (
...
@@ -103,7 +104,8 @@ CREATE TABLE `dict` (
`name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'字典名称'
,
`name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'字典名称'
,
`remark`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'描述'
,
`remark`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'描述'
,
`create_time`
datetime
NULL
DEFAULT
NULL
COMMENT
'创建日期'
,
`create_time`
datetime
NULL
DEFAULT
NULL
COMMENT
'创建日期'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
KEY
`idx_name`
(
`name`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
6
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'数据字典'
ROW_FORMAT
=
Compact
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
6
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'数据字典'
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- ----------------------------
...
...
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