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
776cee4b
Commit
776cee4b
authored
Nov 24, 2019
by
dqjdda
Browse files
代码优化
parent
aaeb67b2
Changes
24
Show whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/annotation/Query.java
View file @
776cee4b
...
@@ -52,6 +52,8 @@ public @interface Query {
...
@@ -52,6 +52,8 @@ public @interface Query {
,
IN
,
IN
// 不等于
// 不等于
,
NOT_EQUAL
,
NOT_EQUAL
// between
,
BETWEEN
}
}
/**
/**
...
...
eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
View file @
776cee4b
...
@@ -109,6 +109,11 @@ public class QueryHelp {
...
@@ -109,6 +109,11 @@ public class QueryHelp {
case
NOT_EQUAL:
case
NOT_EQUAL:
list
.
add
(
cb
.
notEqual
(
getExpression
(
attributeName
,
join
,
root
),
val
));
list
.
add
(
cb
.
notEqual
(
getExpression
(
attributeName
,
join
,
root
),
val
));
break
;
break
;
case
BETWEEN:
List
<
Object
>
between
=
new
ArrayList
<>((
List
<
Object
>)
val
);
list
.
add
(
cb
.
between
(
getExpression
(
attributeName
,
join
,
root
).
as
((
Class
<?
extends
Comparable
>)
between
.
get
(
0
).
getClass
()),
(
Comparable
)
between
.
get
(
0
),
(
Comparable
)
between
.
get
(
1
)));
break
;
default
:
break
;
default
:
break
;
}
}
}
}
...
...
eladmin-generator/src/main/java/me/zhengjie/domain/ColumnInfo.java
View file @
776cee4b
...
@@ -56,9 +56,6 @@ public class ColumnInfo {
...
@@ -56,9 +56,6 @@ public class ColumnInfo {
// 字典名称
// 字典名称
private
String
dictName
;
private
String
dictName
;
// 关联表名
private
String
joinName
;
// 日期注解
// 日期注解
private
String
dateAnnotation
;
private
String
dateAnnotation
;
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GeneratorServiceImpl.java
View file @
776cee4b
...
@@ -118,9 +118,11 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -118,9 +118,11 @@ public class GeneratorServiceImpl implements GeneratorService {
throw
new
BadRequestException
(
"请先配置生成器"
);
throw
new
BadRequestException
(
"请先配置生成器"
);
}
}
try
{
try
{
GenUtil
.
generatorCode
(
columns
,
genConfig
);
// 查询是否存在关联实体字段信息
GenUtil
.
generatorCode
(
columns
,
genConfig
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
e
.
printStackTrace
();
throw
new
BadRequestException
(
"生成失败,请手动处理已生成的文件"
);
}
}
return
null
;
return
null
;
}
}
...
...
eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java
View file @
776cee4b
...
@@ -170,8 +170,6 @@ public class GenUtil {
...
@@ -170,8 +170,6 @@ public class GenUtil {
listMap
.
put
(
"capitalColumnName"
,
capitalColumnName
);
listMap
.
put
(
"capitalColumnName"
,
capitalColumnName
);
// 字典名称
// 字典名称
listMap
.
put
(
"dictName"
,
column
.
getDictName
());
listMap
.
put
(
"dictName"
,
column
.
getDictName
());
// 关联字段
listMap
.
put
(
"joinName"
,
column
.
getJoinName
());
// 日期注解
// 日期注解
listMap
.
put
(
"dateAnnotation"
,
column
.
getDateAnnotation
());
listMap
.
put
(
"dateAnnotation"
,
column
.
getDateAnnotation
());
if
(
StringUtils
.
isNotBlank
(
column
.
getDateAnnotation
())){
if
(
StringUtils
.
isNotBlank
(
column
.
getDateAnnotation
())){
...
...
eladmin-logging/src/main/java/me/zhengjie/service/dto/LogQueryCriteria.java
View file @
776cee4b
...
@@ -2,8 +2,8 @@ package me.zhengjie.service.dto;
...
@@ -2,8 +2,8 @@ package me.zhengjie.service.dto;
import
lombok.Data
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
/**
* 日志查询类
* 日志查询类
...
@@ -20,9 +20,6 @@ public class LogQueryCriteria {
...
@@ -20,9 +20,6 @@ public class LogQueryCriteria {
@Query
@Query
private
String
logType
;
private
String
logType
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java
View file @
776cee4b
...
@@ -54,7 +54,7 @@ public class QuartzJobController {
...
@@ -54,7 +54,7 @@ public class QuartzJobController {
@Log
(
"导出日志数据"
)
@Log
(
"导出日志数据"
)
@ApiOperation
(
"导出日志数据"
)
@ApiOperation
(
"导出日志数据"
)
@GetMapping
(
value
=
"/download
/log
"
)
@GetMapping
(
value
=
"/
logs/
download"
)
@PreAuthorize
(
"@el.check('timing:list')"
)
@PreAuthorize
(
"@el.check('timing:list')"
)
public
void
downloadLog
(
HttpServletResponse
response
,
JobQueryCriteria
criteria
)
throws
IOException
{
public
void
downloadLog
(
HttpServletResponse
response
,
JobQueryCriteria
criteria
)
throws
IOException
{
quartzJobService
.
downloadLog
(
quartzJobService
.
queryAllLog
(
criteria
),
response
);
quartzJobService
.
downloadLog
(
quartzJobService
.
queryAllLog
(
criteria
),
response
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/dto/JobQueryCriteria.java
View file @
776cee4b
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -18,9 +19,6 @@ public class JobQueryCriteria {
...
@@ -18,9 +19,6 @@ public class JobQueryCriteria {
@Query
@Query
private
Boolean
isSuccess
;
private
Boolean
isSuccess
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
View file @
776cee4b
...
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -51,8 +52,7 @@ public class JobController {
...
@@ -51,8 +52,7 @@ public class JobController {
@ApiOperation
(
"查询岗位"
)
@ApiOperation
(
"查询岗位"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('job:list','user:list')"
)
@PreAuthorize
(
"@el.check('job:list','user:list')"
)
public
ResponseEntity
getJobs
(
JobQueryCriteria
criteria
,
public
ResponseEntity
getJobs
(
JobQueryCriteria
criteria
,
Pageable
pageable
){
Pageable
pageable
){
// 数据权限
// 数据权限
criteria
.
setDeptIds
(
dataScope
.
getDeptIds
());
criteria
.
setDeptIds
(
dataScope
.
getDeptIds
());
return
new
ResponseEntity
<>(
jobService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
jobService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptQueryCriteria.java
View file @
776cee4b
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
...
@@ -25,9 +26,6 @@ public class DeptQueryCriteria{
...
@@ -25,9 +26,6 @@ public class DeptQueryCriteria{
@Query
@Query
private
Long
pid
;
private
Long
pid
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailDTO.java
View file @
776cee4b
...
@@ -22,5 +22,7 @@ public class DictDetailDTO implements Serializable {
...
@@ -22,5 +22,7 @@ public class DictDetailDTO implements Serializable {
private
String
sort
;
private
String
sort
;
private
DictSmallDTO
dict
;
private
Timestamp
createTime
;
private
Timestamp
createTime
;
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictSmallDTO.java
0 → 100644
View file @
776cee4b
package
me.zhengjie.modules.system.service.dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Getter
@Setter
public
class
DictSmallDTO
implements
Serializable
{
private
Long
id
;
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/JobQueryCriteria.java
View file @
776cee4b
...
@@ -3,9 +3,8 @@ package me.zhengjie.modules.system.service.dto;
...
@@ -3,9 +3,8 @@ package me.zhengjie.modules.system.service.dto;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
...
@@ -28,9 +27,6 @@ public class JobQueryCriteria {
...
@@ -28,9 +27,6 @@ public class JobQueryCriteria {
@Query
(
propName
=
"id"
,
joinName
=
"dept"
,
type
=
Query
.
Type
.
IN
)
@Query
(
propName
=
"id"
,
joinName
=
"dept"
,
type
=
Query
.
Type
.
IN
)
private
Set
<
Long
>
deptIds
;
private
Set
<
Long
>
deptIds
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuQueryCriteria.java
View file @
776cee4b
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
/**
* 公共查询类
* 公共查询类
...
@@ -15,9 +16,6 @@ public class MenuQueryCriteria {
...
@@ -15,9 +16,6 @@ public class MenuQueryCriteria {
@Query
(
blurry
=
"name,path,component"
)
@Query
(
blurry
=
"name,path,component"
)
private
String
blurry
;
private
String
blurry
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleQueryCriteria.java
View file @
776cee4b
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
/**
* 公共查询类
* 公共查询类
...
@@ -15,9 +16,6 @@ public class RoleQueryCriteria {
...
@@ -15,9 +16,6 @@ public class RoleQueryCriteria {
@Query
(
blurry
=
"name,remark"
)
@Query
(
blurry
=
"name,remark"
)
private
String
blurry
;
private
String
blurry
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserQueryCriteria.java
View file @
776cee4b
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
me.zhengjie.annotation.Query
;
import
me.zhengjie.annotation.Query
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
...
@@ -28,9 +29,6 @@ public class UserQueryCriteria implements Serializable {
...
@@ -28,9 +29,6 @@ public class UserQueryCriteria implements Serializable {
private
Long
deptId
;
private
Long
deptId
;
@Query
(
type
=
Query
.
Type
.
GREATER_THAN
,
propName
=
"createTime"
)
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
Timestamp
startTime
;
private
List
<
Timestamp
>
createTime
;
@Query
(
type
=
Query
.
Type
.
LESS_THAN
,
propName
=
"createTime"
)
private
Timestamp
endTime
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/DictDetailMapper.java
View file @
776cee4b
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
* @author Zheng Jie
* @author Zheng Jie
* @date 2019-04-10
* @date 2019-04-10
*/
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
@Mapper
(
componentModel
=
"spring"
,
uses
=
{
DictSmallMapper
.
class
},
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
DictDetailMapper
extends
BaseMapper
<
DictDetailDTO
,
DictDetail
>
{
public
interface
DictDetailMapper
extends
BaseMapper
<
DictDetailDTO
,
DictDetail
>
{
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/DictSmallMapper.java
0 → 100644
View file @
776cee4b
package
me.zhengjie.modules.system.service.mapper
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictDTO
;
import
me.zhengjie.modules.system.service.dto.DictSmallDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
DictSmallMapper
extends
BaseMapper
<
DictSmallDTO
,
Dict
>
{
}
\ No newline at end of file
eladmin-system/src/main/resources/template/generator/admin/QueryCriteria.ftl
View file @
776cee4b
...
@@ -7,6 +7,9 @@ import java.sql.Timestamp;
...
@@ -7,6 +7,9 @@ import java.sql.Timestamp;
<#
if
queryHasBigDecimal>
<#
if
queryHasBigDecimal>
import
java.math.BigDecimal;
import
java.math.BigDecimal;
</#
if
>
</#
if
>
<#
if
dateRanges??>
import
java.util.List;
</#
if
>
<#
if
queryColumns??>
<#
if
queryColumns??>
import
me.zhengjie.annotation.Query;
import
me.zhengjie.annotation.Query;
</#
if
>
</#
if
>
...
@@ -49,13 +52,8 @@ public class ${className}QueryCriteria{
...
@@ -49,13 +52,8 @@ public class ${className}QueryCriteria{
</#
if
>
</#
if
>
<#
if
dateRanges
??>
<#
if
dateRanges
??>
<#
list
dateRanges
as
column
>
<#
list
dateRanges
as
column
>
@
Q
uery
(
type
=
Q
uery
.Type.BETWEEN
)
//
时间段查询
private
L
ist
<$
{
column
.columnType
}
>
createTime
;
@
Q
uery
(
type
=
Q
uery
.Type.GREATER_THAN
,
propName
=
"${column.changeColumnName}"
)
private
$
{
column
.columnType
}
$
{
column
.changeColumnName
}
S
tart
;
@
Q
uery
(
type
=
Q
uery
.Type.LESS_THAN
,
propName
=
"${column.changeColumnName}"
)
private
$
{
column
.columnType
}
$
{
column
.changeColumnName
}
E
nd
;
</#
list
>
</#
list
>
</#
if
>
</#
if
>
}
}
\ No newline at end of file
eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java
View file @
776cee4b
...
@@ -5,6 +5,9 @@ import org.junit.runner.RunWith;
...
@@ -5,6 +5,9 @@ import org.junit.runner.RunWith;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.ArrayList
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@SpringBootTest
public
class
EladminSystemApplicationTests
{
public
class
EladminSystemApplicationTests
{
...
@@ -13,5 +16,8 @@ public class EladminSystemApplicationTests {
...
@@ -13,5 +16,8 @@ public class EladminSystemApplicationTests {
public
void
contextLoads
()
{
public
void
contextLoads
()
{
}
}
public
static
void
main
(
String
[]
args
)
{
}
}
}
Prev
1
2
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