Commit 40852235 authored by dqjdda's avatar dqjdda
Browse files

Merge branch '2.4dev' into 2.3opt

parents 4681ca6e 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;
} }
...@@ -42,6 +42,14 @@ public class DictController { ...@@ -42,6 +42,14 @@ public class DictController {
dictService.download(dictService.queryAll(criteria), response); dictService.download(dictService.queryAll(criteria), response);
} }
@Log("查询字典")
@ApiOperation("查询字典")
@GetMapping(value = "/all")
@PreAuthorize("@el.check('dict:list')")
public ResponseEntity all(){
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
}
@Log("查询字典") @Log("查询字典")
@ApiOperation("查询字典") @ApiOperation("查询字典")
@GetMapping @GetMapping
......
...@@ -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);
......
...@@ -4,7 +4,7 @@ import io.swagger.annotations.Api; ...@@ -4,7 +4,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import me.zhengjie.aop.log.Log; import me.zhengjie.aop.log.Log;
import me.zhengjie.config.DataScope; import me.zhengjie.config.DataScope;
import me.zhengjie.modules.tools.domain.VerificationCode; import me.zhengjie.domain.VerificationCode;
import me.zhengjie.modules.system.domain.User; import me.zhengjie.modules.system.domain.User;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.vo.UserPassVo; import me.zhengjie.modules.system.domain.vo.UserPassVo;
...@@ -12,7 +12,7 @@ import me.zhengjie.modules.system.service.DeptService; ...@@ -12,7 +12,7 @@ import me.zhengjie.modules.system.service.DeptService;
import me.zhengjie.modules.system.service.RoleService; import me.zhengjie.modules.system.service.RoleService;
import me.zhengjie.modules.system.service.dto.RoleSmallDTO; import me.zhengjie.modules.system.service.dto.RoleSmallDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria; import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.tools.service.VerificationCodeService; import me.zhengjie.service.VerificationCodeService;
import me.zhengjie.utils.*; import me.zhengjie.utils.*;
import me.zhengjie.modules.system.service.UserService; import me.zhengjie.modules.system.service.UserService;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
......
...@@ -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
...@@ -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
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; ...@@ -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
...@@ -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;
} }
...@@ -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;
} }
...@@ -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;
} }
...@@ -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
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
...@@ -70,4 +70,13 @@ public class ${className}Controller { ...@@ -70,4 +70,13 @@ public class ${className}Controller {
${changeClassName}Service.delete(${pkChangeColName}); ${changeClassName}Service.delete(${pkChangeColName});
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
@Log("多选删除${className}")
@ApiOperation("多选删除${className}")
@PreAuthorize("@el.check('${changeClassName}:del')")
@DeleteMapping
public ResponseEntity deleteAll(@RequestBody ${pkColumnType}[] ids) {
${changeClassName}Service.deleteAll(ids);
return new ResponseEntity(HttpStatus.OK);
}
} }
\ No newline at end of file
...@@ -23,8 +23,8 @@ public class ${className}DTO implements Serializable { ...@@ -23,8 +23,8 @@ public class ${className}DTO implements Serializable {
<#if columns??> <#if columns??>
<#list columns as column> <#list columns as column>
<#if column.columnComment != ''> <#if column.remark != ''>
// ${column.columnComment} // ${column.remark}
</#if> </#if>
<#if column.columnKey = 'PRI'> <#if column.columnKey = 'PRI'>
<#if !auto && pkColumnType = 'Long'> <#if !auto && pkColumnType = 'Long'>
......
...@@ -4,6 +4,14 @@ import lombok.Data; ...@@ -4,6 +4,14 @@ import lombok.Data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*; import javax.persistence.*;
<#if isNotNullColumns??>
import javax.validation.constraints.*;
</#if>
<#if hasDateAnnotation>
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
</#if>
<#if hasTimestamp> <#if hasTimestamp>
import java.sql.Timestamp; import java.sql.Timestamp;
</#if> </#if>
...@@ -23,8 +31,8 @@ public class ${className} implements Serializable { ...@@ -23,8 +31,8 @@ public class ${className} implements Serializable {
<#if columns??> <#if columns??>
<#list columns as column> <#list columns as column>
<#if column.columnComment != ''> <#if column.remark != ''>
// ${column.columnComment} // ${column.remark}
</#if> </#if>
<#if column.columnKey = 'PRI'> <#if column.columnKey = 'PRI'>
@Id @Id
...@@ -32,7 +40,21 @@ public class ${className} implements Serializable { ...@@ -32,7 +40,21 @@ public class ${className} implements Serializable {
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
</#if> </#if>
</#if> </#if>
@Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true</#if><#if column.isNullable = 'NO' && column.columnKey != 'PRI'>,nullable = false</#if>) @Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true</#if><#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false</#if>)
<#if column.istNotNull && column.columnKey != 'PRI'>
<#if column.columnType = 'String'>
@NotBlank
<#else>
@NotNull
</#if>
</#if>
<#if column.dateAnnotation??>
<#if column.dateAnnotation = 'CreationTimestamp'>
@CreationTimestamp
<#else>
@UpdateTimestamp
</#if>
</#if>
private ${column.columnType} ${column.changeColumnName}; private ${column.columnType} ${column.changeColumnName};
</#list> </#list>
</#if> </#if>
......
...@@ -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>
...@@ -20,15 +23,37 @@ public class ${className}QueryCriteria{ ...@@ -20,15 +23,37 @@ public class ${className}QueryCriteria{
<#if queryColumns??> <#if queryColumns??>
<#list queryColumns as column> <#list queryColumns as column>
<#if column.columnQuery = '1'> <#if column.queryType = '='>
// 模糊
@Query(type = Query.Type.INNER_LIKE)
</#if>
<#if column.columnQuery = '2'>
// 精确 // 精确
@Query @Query
</#if>
private ${column.columnType} ${column.changeColumnName}; private ${column.columnType} ${column.changeColumnName};
</#if>
<#if column.queryType = 'Like'>
// 模糊
@Query(type = Query.Type.INNER_LIKE)
private ${column.columnType} ${column.changeColumnName};
</#if>
<#if column.queryType = '!='>
// 不等于
@Query(type = Query.Type.NOT_EQUAL)
private ${column.columnType} ${column.changeColumnName};
</#if>
<#if column.queryType = '>='>
// 大于等于
@Query(type = Query.Type.GREATER_THAN)
private ${column.columnType} ${column.changeColumnName};
</#if>
<#if column.queryType = '<='>
// 小于等于
@Query(type = Query.Type.LESS_THAN)
private ${column.columnType} ${column.changeColumnName};
</#if>
</#list>
</#if>
<#if dateRanges??>
<#list dateRanges as column>
@Query(type = Query.Type.BETWEEN)
private List<${column.columnType}> createTime;
</#list> </#list>
</#if> </#if>
} }
\ No newline at end of file
...@@ -43,5 +43,7 @@ public interface ${className}Service { ...@@ -43,5 +43,7 @@ public interface ${className}Service {
void delete(${pkColumnType} ${pkChangeColName}); void delete(${pkColumnType} ${pkChangeColName});
void deleteAll(${pkColumnType}[] ids);
void download(List<${className}DTO> all, HttpServletResponse response) throws IOException; void download(List<${className}DTO> all, HttpServletResponse response) throws IOException;
} }
\ No newline at end of file
...@@ -133,6 +133,13 @@ public class ${className}ServiceImpl implements ${className}Service { ...@@ -133,6 +133,13 @@ public class ${className}ServiceImpl implements ${className}Service {
${changeClassName}Repository.deleteById(${pkChangeColName}); ${changeClassName}Repository.deleteById(${pkChangeColName});
} }
@Override
@CacheEvict(allEntries = true)
public void deleteAll(${pkColumnType}[] ids) {
for (${pkColumnType} id : ids) {
${changeClassName}Repository.deleteById(${pkChangeColName});
}
}
@Override @Override
public void download(List<${className}DTO> all, HttpServletResponse response) throws IOException { public void download(List<${className}DTO> all, HttpServletResponse response) throws IOException {
...@@ -141,8 +148,8 @@ public class ${className}ServiceImpl implements ${className}Service { ...@@ -141,8 +148,8 @@ public class ${className}ServiceImpl implements ${className}Service {
Map<String,Object> map = new LinkedHashMap<>(); Map<String,Object> map = new LinkedHashMap<>();
<#list columns as column> <#list columns as column>
<#if column.columnKey != 'PRI'> <#if column.columnKey != 'PRI'>
<#if column.columnComment != ''> <#if column.remark != ''>
map.put("${column.columnComment}", ${changeClassName}.get${column.capitalColumnName}()); map.put("${column.remark}", ${changeClassName}.get${column.capitalColumnName}());
<#else> <#else>
map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}()); map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}());
</#if> </#if>
......
...@@ -14,6 +14,13 @@ export function del(${pkChangeColName}) { ...@@ -14,6 +14,13 @@ export function del(${pkChangeColName}) {
method: 'delete' method: 'delete'
}) })
} }
export function delAll(ids) {
return request({
url: 'api/${changeClassName}/',
method: 'delete',
data: ids
})
}
export function edit(data) { export function edit(data) {
return request({ return request({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment