mirror of https://github.com/elunez/eladmin
代码优化
parent
aaeb67b280
commit
776cee4b14
|
@ -52,6 +52,8 @@ public @interface Query {
|
||||||
, IN
|
, IN
|
||||||
// 不等于
|
// 不等于
|
||||||
,NOT_EQUAL
|
,NOT_EQUAL
|
||||||
|
// between
|
||||||
|
,BETWEEN
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,6 @@ public class ColumnInfo {
|
||||||
// 字典名称
|
// 字典名称
|
||||||
private String dictName;
|
private String dictName;
|
||||||
|
|
||||||
// 关联表名
|
|
||||||
private String joinName;
|
|
||||||
|
|
||||||
// 日期注解
|
// 日期注解
|
||||||
private String dateAnnotation;
|
private String dateAnnotation;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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())){
|
||||||
|
|
|
@ -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 {
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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 {
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
@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);
|
||||||
|
|
|
@ -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{
|
||||||
@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;
|
|
||||||
}
|
}
|
|
@ -22,5 +22,7 @@ public class DictDetailDTO implements Serializable {
|
||||||
|
|
||||||
private String sort;
|
private String sort;
|
||||||
|
|
||||||
|
private DictSmallDTO dict;
|
||||||
|
|
||||||
private Timestamp createTime;
|
private Timestamp createTime;
|
||||||
}
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -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 {
|
||||||
@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;
|
|
||||||
}
|
}
|
|
@ -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 {
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
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> {
|
||||||
|
|
||||||
|
}
|
|
@ -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{
|
||||||
</#if>
|
</#if>
|
||||||
<#if dateRanges??>
|
<#if dateRanges??>
|
||||||
<#list dateRanges as column>
|
<#list dateRanges as column>
|
||||||
|
@Query(type = Query.Type.BETWEEN)
|
||||||
// 时间段查询
|
private List<${column.columnType}> createTime;
|
||||||
@Query(type = Query.Type.GREATER_THAN, propName = "${column.changeColumnName}")
|
|
||||||
private ${column.columnType} ${column.changeColumnName}Start;
|
|
||||||
|
|
||||||
@Query(type = Query.Type.LESS_THAN, propName = "${column.changeColumnName}")
|
|
||||||
private ${column.columnType} ${column.changeColumnName}End;
|
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
|
@ -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 {
|
||||||
public void contextLoads() {
|
public void contextLoads() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class QiniuController {
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download/list")
|
@GetMapping(value = "/download")
|
||||||
public void download(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException {
|
public void download(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException {
|
||||||
qiNiuService.downloadList(qiNiuService.queryAll(criteria), response);
|
qiNiuService.downloadList(qiNiuService.queryAll(criteria), response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package me.zhengjie.service.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import me.zhengjie.annotation.Query;
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +17,6 @@ public class LocalStorageQueryCriteria{
|
||||||
@Query(blurry = "name,suffix,type,operate,size")
|
@Query(blurry = "name,suffix,type,operate,size")
|
||||||
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;
|
|
||||||
}
|
}
|
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sm.ms图床
|
* sm.ms图床
|
||||||
|
@ -20,9 +21,6 @@ public class PictureQueryCriteria{
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -15,9 +16,6 @@ public class QiniuQueryCriteria{
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@Query(type = Query.Type.GREATER_THAN,propName = "updateTime")
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private Timestamp startTime;
|
private List<Timestamp> createTime;
|
||||||
|
|
||||||
@Query(type = Query.Type.LESS_THAN,propName = "updateTime")
|
|
||||||
private Timestamp endTime;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue