mirror of https://github.com/elunez/eladmin
Merge branch '2.4dev' into 2.3opt
commit
40852235b2
|
@ -50,6 +50,10 @@ public @interface Query {
|
|||
, LESS_THAN_NQ
|
||||
// jie 2019/6/4 包含
|
||||
, IN
|
||||
// 不等于
|
||||
,NOT_EQUAL
|
||||
// between
|
||||
,BETWEEN
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,6 +106,14 @@ public class QueryHelp {
|
|||
list.add(getExpression(attributeName,join,root).in((Collection<Long>) val));
|
||||
}
|
||||
break;
|
||||
case NOT_EQUAL:
|
||||
list.add(cb.notEqual(getExpression(attributeName,join,root), val));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>eladmin-generator</artifactId>
|
||||
<name>代码生成模块</name>
|
||||
|
||||
<properties>
|
||||
<configuration.version>1.9</configuration.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-common</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--模板引擎-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
<version>${configuration.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,76 @@
|
|||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.zhengjie.utils.GenUtil;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 列的数据信息
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@Table(name = "column_config")
|
||||
public class ColumnInfo {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
private String tableName;
|
||||
|
||||
// 数据库字段名称
|
||||
private String columnName;
|
||||
|
||||
// 数据库字段类型
|
||||
private String columnType;
|
||||
|
||||
// 数据库字段键类型
|
||||
private String keyType;
|
||||
|
||||
// 字段额外的参数
|
||||
private String extra;
|
||||
|
||||
// 数据库字段描述
|
||||
private String remark;
|
||||
|
||||
// 必填
|
||||
private Boolean notNull;
|
||||
|
||||
// 是否在列表显示
|
||||
private Boolean listShow;
|
||||
|
||||
// 是否表单显示
|
||||
private Boolean formShow;
|
||||
|
||||
// 表单类型
|
||||
private String formType;
|
||||
|
||||
// 查询 1:模糊 2:精确
|
||||
private String queryType;
|
||||
|
||||
// 字典名称
|
||||
private String dictName;
|
||||
|
||||
// 日期注解
|
||||
private String dateAnnotation;
|
||||
|
||||
public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) {
|
||||
this.tableName = tableName;
|
||||
this.columnName = columnName;
|
||||
this.columnType = columnType;
|
||||
this.keyType = keyType;
|
||||
this.extra = extra;
|
||||
this.notNull = notNull;
|
||||
if(GenUtil.PK.equalsIgnoreCase(keyType) && GenUtil.EXTRA.equalsIgnoreCase(extra)){
|
||||
this.notNull = false;
|
||||
}
|
||||
this.remark = remark;
|
||||
this.listShow = true;
|
||||
this.formShow = true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
package me.zhengjie.modules.generator.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import lombok.NoArgsConstructor;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 代码生成配置
|
||||
|
@ -13,20 +12,35 @@ import javax.persistence.Table;
|
|||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@Table(name = "gen_config")
|
||||
public class GenConfig {
|
||||
|
||||
public GenConfig(String tableName) {
|
||||
this.cover = false;
|
||||
this.moduleName = "eladmin-system";
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
private String tableName;
|
||||
|
||||
// 包路径
|
||||
@NotBlank
|
||||
private String pack;
|
||||
|
||||
// 模块名
|
||||
@Column(name = "module_name")
|
||||
@NotBlank
|
||||
private String moduleName;
|
||||
|
||||
// 前端文件路径
|
||||
@NotBlank
|
||||
private String path;
|
||||
|
||||
// 前端文件路径
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.generator.domain.vo;
|
||||
package me.zhengjie.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -0,0 +1,14 @@
|
|||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.domain.ColumnInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-14
|
||||
*/
|
||||
public interface ColumnInfoRepository extends JpaRepository<ColumnInfo,Long> {
|
||||
|
||||
List<ColumnInfo> findByTableNameOrderByIdAsc(String tableName);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.generator.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -8,4 +8,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @date 2019-01-14
|
||||
*/
|
||||
public interface GenConfigRepository extends JpaRepository<GenConfig,Long> {
|
||||
|
||||
GenConfig findByTableName(String tableName);
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package me.zhengjie.modules.generator.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.modules.generator.service.GenConfigService;
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import me.zhengjie.service.GenConfigService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -25,14 +25,14 @@ public class GenConfigController {
|
|||
}
|
||||
|
||||
@ApiOperation("查询")
|
||||
@GetMapping
|
||||
public ResponseEntity get(){
|
||||
return new ResponseEntity<>(genConfigService.find(), HttpStatus.OK);
|
||||
@GetMapping(value = "/{tableName}")
|
||||
public ResponseEntity get(@PathVariable String tableName){
|
||||
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping
|
||||
public ResponseEntity emailConfig(@Validated @RequestBody GenConfig genConfig){
|
||||
return new ResponseEntity<>(genConfigService.update(genConfig),HttpStatus.OK);
|
||||
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -1,17 +1,16 @@
|
|||
package me.zhengjie.modules.generator.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import cn.hutool.core.util.PageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.domain.ColumnInfo;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.generator.domain.vo.ColumnInfo;
|
||||
import me.zhengjie.modules.generator.service.GenConfigService;
|
||||
import me.zhengjie.modules.generator.service.GeneratorService;
|
||||
import me.zhengjie.service.GenConfigService;
|
||||
import me.zhengjie.service.GeneratorService;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +34,13 @@ public class GeneratorController {
|
|||
this.genConfigService = genConfigService;
|
||||
}
|
||||
|
||||
@ApiOperation("查询数据库元数据")
|
||||
@ApiOperation("查询数据库数据")
|
||||
@GetMapping(value = "/tables/all")
|
||||
public ResponseEntity getTables(){
|
||||
return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询数据库数据")
|
||||
@GetMapping(value = "/tables")
|
||||
public ResponseEntity getTables(@RequestParam(defaultValue = "") String name,
|
||||
@RequestParam(defaultValue = "0")Integer page,
|
||||
|
@ -44,19 +49,34 @@ public class GeneratorController {
|
|||
return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询表内元数据")
|
||||
@ApiOperation("查询字段数据")
|
||||
@GetMapping(value = "/columns")
|
||||
public ResponseEntity getTables(@RequestParam String tableName){
|
||||
return new ResponseEntity<>(generatorService.getColumns(tableName), HttpStatus.OK);
|
||||
List<ColumnInfo> columnInfos = generatorService.getColumns(tableName);
|
||||
// 异步同步表信息
|
||||
generatorService.sync(columnInfos);
|
||||
return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("保存字段数据")
|
||||
@PutMapping
|
||||
public ResponseEntity save(@RequestBody List<ColumnInfo> columnInfos){
|
||||
generatorService.save(columnInfos);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("生成代码")
|
||||
@PostMapping
|
||||
public ResponseEntity generator(@RequestBody List<ColumnInfo> columnInfos, @RequestParam String tableName){
|
||||
@PostMapping(value = "/{tableName}/{type}")
|
||||
public ResponseEntity generator(@PathVariable String tableName, @PathVariable Integer type){
|
||||
if(!generatorEnabled){
|
||||
throw new BadRequestException("此环境不允许生成代码!");
|
||||
}
|
||||
generatorService.generator(columnInfos,genConfigService.find(),tableName);
|
||||
switch (type){
|
||||
// 生成代码
|
||||
case 0: generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-14
|
||||
*/
|
||||
public interface GenConfigService {
|
||||
|
||||
GenConfig find(String tableName);
|
||||
|
||||
GenConfig update(String tableName, GenConfig genConfig);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import me.zhengjie.domain.ColumnInfo;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
public interface GeneratorService {
|
||||
|
||||
/**
|
||||
* 查询数据库元数据
|
||||
* @param name 表名
|
||||
* @param startEnd 分页参数
|
||||
* @return /
|
||||
*/
|
||||
Object getTables(String name, int[] startEnd);
|
||||
|
||||
/**
|
||||
* 得到数据表的元数据
|
||||
* @param name 表名
|
||||
* @return /
|
||||
*/
|
||||
List<ColumnInfo> getColumns(String name);
|
||||
|
||||
/**
|
||||
* 同步表数据
|
||||
* @param columnInfos /
|
||||
*/
|
||||
@Async
|
||||
void sync(List<ColumnInfo> columnInfos);
|
||||
|
||||
/**
|
||||
* 保持数据
|
||||
* @param columnInfos /
|
||||
*/
|
||||
void save(List<ColumnInfo> columnInfos);
|
||||
|
||||
/**
|
||||
* 获取所有table
|
||||
* @return /
|
||||
*/
|
||||
Object getTables();
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
* @param genConfig 配置信息
|
||||
* @param columns 字段信息
|
||||
* @return /
|
||||
*/
|
||||
Object generator(GenConfig genConfig, List<ColumnInfo> columns);
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
package me.zhengjie.modules.generator.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.modules.generator.repository.GenConfigRepository;
|
||||
import me.zhengjie.modules.generator.service.GenConfigService;
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import me.zhengjie.repository.GenConfigRepository;
|
||||
import me.zhengjie.service.GenConfigService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -25,16 +24,18 @@ public class GenConfigServiceImpl implements GenConfigService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'1'")
|
||||
public GenConfig find() {
|
||||
Optional<GenConfig> genConfig = genConfigRepository.findById(1L);
|
||||
return genConfig.orElseGet(GenConfig::new);
|
||||
@Cacheable(key = "#p0")
|
||||
public GenConfig find(String tableName) {
|
||||
GenConfig genConfig = genConfigRepository.findByTableName(tableName);
|
||||
if(genConfig == null){
|
||||
return new GenConfig(tableName);
|
||||
}
|
||||
return genConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
public GenConfig update(GenConfig genConfig) {
|
||||
genConfig.setId(1L);
|
||||
@CachePut(key = "#p0")
|
||||
public GenConfig update(String tableName, GenConfig genConfig) {
|
||||
// 自动设置Api路径,注释掉前需要同步取消前端的注释
|
||||
String separator = File.separator;
|
||||
String[] paths;
|
|
@ -0,0 +1,129 @@
|
|||
package me.zhengjie.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import me.zhengjie.domain.ColumnInfo;
|
||||
import me.zhengjie.domain.vo.TableInfo;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.repository.ColumnInfoRepository;
|
||||
import me.zhengjie.service.GeneratorService;
|
||||
import me.zhengjie.utils.GenUtil;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
@Service
|
||||
@SuppressWarnings("all")
|
||||
public class GeneratorServiceImpl implements GeneratorService {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
private final ColumnInfoRepository columnInfoRepository;
|
||||
|
||||
public GeneratorServiceImpl(ColumnInfoRepository columnInfoRepository) {
|
||||
this.columnInfoRepository = columnInfoRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTables() {
|
||||
// 使用预编译防止sql注入
|
||||
String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " +
|
||||
"where table_schema = (select database()) " +
|
||||
"order by create_time desc";
|
||||
Query query = em.createNativeQuery(sql);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTables(String name, int[] startEnd) {
|
||||
// 使用预编译防止sql注入
|
||||
String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " +
|
||||
"where table_schema = (select database()) " +
|
||||
"and table_name like ? order by create_time desc";
|
||||
Query query = em.createNativeQuery(sql);
|
||||
query.setFirstResult(startEnd[0]);
|
||||
query.setMaxResults(startEnd[1]-startEnd[0]);
|
||||
query.setParameter(1, StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%");
|
||||
List result = query.getResultList();
|
||||
List<TableInfo> tableInfos = new ArrayList<>();
|
||||
for (Object obj : result) {
|
||||
Object[] arr = (Object[]) obj;
|
||||
tableInfos.add(new TableInfo(arr[0],arr[1],arr[2],arr[3], ObjectUtil.isNotEmpty(arr[4])? arr[4] : "-"));
|
||||
}
|
||||
Query query1 = em.createNativeQuery("SELECT COUNT(*) from information_schema.tables where table_schema = (select database())");
|
||||
Object totalElements = query1.getSingleResult();
|
||||
return PageUtil.toPage(tableInfos,totalElements);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ColumnInfo> getColumns(String tableName) {
|
||||
List<ColumnInfo> columnInfos = columnInfoRepository.findByTableNameOrderByIdAsc(tableName);
|
||||
if(CollectionUtil.isNotEmpty(columnInfos)){
|
||||
return columnInfos;
|
||||
} else {
|
||||
columnInfos = query(tableName);
|
||||
return columnInfoRepository.saveAll(columnInfos);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ColumnInfo> query(String tableName){
|
||||
// 使用预编译防止sql注入
|
||||
String sql = "select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " +
|
||||
"where table_name = ? and table_schema = (select database()) order by ordinal_position";
|
||||
Query query = em.createNativeQuery(sql);
|
||||
query.setParameter(1,tableName);
|
||||
List result = query.getResultList();
|
||||
List<ColumnInfo> columnInfos = new ArrayList<>();
|
||||
for (Object obj : result) {
|
||||
Object[] arr = (Object[]) obj;
|
||||
columnInfos.add(
|
||||
new ColumnInfo(
|
||||
tableName,
|
||||
arr[0].toString(),
|
||||
arr[1].equals("NO"),
|
||||
arr[2].toString(),
|
||||
ObjectUtil.isNotNull(arr[3]) ? arr[3].toString() : null,
|
||||
ObjectUtil.isNotNull(arr[4]) ? arr[4].toString() : null,
|
||||
ObjectUtil.isNotNull(arr[5]) ? arr[5].toString() : null)
|
||||
);
|
||||
}
|
||||
return columnInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sync(List<ColumnInfo> columnInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(List<ColumnInfo> columnInfos) {
|
||||
columnInfoRepository.saveAll(columnInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object generator(GenConfig genConfig, List<ColumnInfo> columns) {
|
||||
if(genConfig.getId() == null){
|
||||
throw new BadRequestException("请先配置生成器");
|
||||
}
|
||||
try {
|
||||
// 查询是否存在关联实体字段信息
|
||||
GenUtil.generatorCode(columns, genConfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException("生成失败,请手动处理已生成的文件");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package me.zhengjie.modules.generator.utils;
|
||||
package me.zhengjie.utils;
|
||||
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration.*;
|
||||
|
||||
/**
|
||||
* sql字段转java
|
|
@ -1,12 +1,10 @@
|
|||
package me.zhengjie.modules.generator.utils;
|
||||
package me.zhengjie.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.template.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.modules.generator.domain.vo.ColumnInfo;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import me.zhengjie.domain.GenConfig;
|
||||
import me.zhengjie.domain.ColumnInfo;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -30,9 +28,9 @@ public class GenUtil {
|
|||
|
||||
private static final String BIGDECIMAL = "BigDecimal";
|
||||
|
||||
private static final String PK = "PRI";
|
||||
public static final String PK = "PRI";
|
||||
|
||||
private static final String EXTRA = "auto_increment";
|
||||
public static final String EXTRA = "auto_increment";
|
||||
|
||||
/**
|
||||
* 获取后端代码模板名称
|
||||
|
@ -63,85 +61,159 @@ public class GenUtil {
|
|||
return templateNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
* @param columnInfos 表元数据
|
||||
* @param genConfig 生成代码的参数配置,如包路径,作者
|
||||
*/
|
||||
public static void generatorCode(List<ColumnInfo> columnInfos, GenConfig genConfig, String tableName) throws IOException {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("package",genConfig.getPack());
|
||||
map.put("moduleName",genConfig.getModuleName());
|
||||
map.put("author",genConfig.getAuthor());
|
||||
map.put("date", LocalDate.now().toString());
|
||||
map.put("tableName",tableName);
|
||||
String className = StringUtils.toCapitalizeCamelCase(tableName);
|
||||
String changeClassName = StringUtils.toCamelCase(tableName);
|
||||
|
||||
public static void generatorCode(List<ColumnInfo> columnInfos, GenConfig genConfig) throws IOException {
|
||||
// 存储模版字段数据
|
||||
Map<String,Object> genMap = new HashMap<>();
|
||||
// 包名称
|
||||
genMap.put("package",genConfig.getPack());
|
||||
// 模块名称
|
||||
genMap.put("moduleName",genConfig.getModuleName());
|
||||
// 作者
|
||||
genMap.put("author",genConfig.getAuthor());
|
||||
// 创建日期
|
||||
genMap.put("date", LocalDate.now().toString());
|
||||
// 表名
|
||||
genMap.put("tableName",genConfig.getTableName());
|
||||
// 大写开头的类名
|
||||
String className = StringUtils.toCapitalizeCamelCase(genConfig.getTableName());
|
||||
// 小写开头的类名
|
||||
String changeClassName = StringUtils.toCamelCase(genConfig.getTableName());
|
||||
// 判断是否去除表前缀
|
||||
if (StringUtils.isNotEmpty(genConfig.getPrefix())) {
|
||||
className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(tableName,genConfig.getPrefix()));
|
||||
changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(tableName,genConfig.getPrefix()));
|
||||
className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTableName(),genConfig.getPrefix()));
|
||||
changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTableName(),genConfig.getPrefix()));
|
||||
}
|
||||
map.put("className", className);
|
||||
map.put("upperCaseClassName", className.toUpperCase());
|
||||
map.put("changeClassName", changeClassName);
|
||||
map.put("hasTimestamp",false);
|
||||
map.put("queryHasTimestamp",false);
|
||||
map.put("queryHasBigDecimal",false);
|
||||
map.put("hasBigDecimal",false);
|
||||
map.put("hasQuery",false);
|
||||
map.put("auto",false);
|
||||
|
||||
// 保存类名
|
||||
genMap.put("className", className);
|
||||
// 保存小写开头的类名
|
||||
genMap.put("changeClassName", changeClassName);
|
||||
// 存在 Timestamp 字段
|
||||
genMap.put("hasTimestamp",false);
|
||||
// 查询类中存在 Timestamp 字段
|
||||
genMap.put("queryHasTimestamp",false);
|
||||
// 存在 BigDecimal 字段
|
||||
genMap.put("hasBigDecimal",false);
|
||||
// 查询类中存在 BigDecimal 字段
|
||||
genMap.put("queryHasBigDecimal",false);
|
||||
// 是否需要创建查询
|
||||
genMap.put("hasQuery",false);
|
||||
// 自增主键
|
||||
genMap.put("auto",false);
|
||||
// 存在字典
|
||||
genMap.put("hasDict",false);
|
||||
// 存在日期注解
|
||||
genMap.put("hasDateAnnotation",false);
|
||||
// 保存字段信息
|
||||
List<Map<String,Object>> columns = new ArrayList<>();
|
||||
// 保存查询字段的信息
|
||||
List<Map<String,Object>> queryColumns = new ArrayList<>();
|
||||
// 存储字典信息
|
||||
List<String> dicts = new ArrayList<>();
|
||||
// 存储 DateRange 信息
|
||||
List<Map<String,Object>> dateRanges = new ArrayList<>();
|
||||
// 存储不为空的字段信息
|
||||
List<Map<String,Object>> isNotNullColumns = new ArrayList<>();
|
||||
|
||||
for (ColumnInfo column : columnInfos) {
|
||||
Map<String,Object> listMap = new HashMap<>();
|
||||
listMap.put("columnComment",column.getColumnComment());
|
||||
listMap.put("columnKey",column.getColumnKey());
|
||||
|
||||
String colType = ColUtil.cloToJava(column.getColumnType().toString());
|
||||
// 字段描述
|
||||
listMap.put("remark",column.getRemark());
|
||||
// 字段类型
|
||||
listMap.put("columnKey",column.getKeyType());
|
||||
// 主键类型
|
||||
String colType = ColUtil.cloToJava(column.getColumnType());
|
||||
// 小写开头的字段名
|
||||
String changeColumnName = StringUtils.toCamelCase(column.getColumnName().toString());
|
||||
// 大写开头的字段名
|
||||
String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName().toString());
|
||||
if(PK.equals(column.getColumnKey())){
|
||||
map.put("pkColumnType",colType);
|
||||
map.put("pkChangeColName",changeColumnName);
|
||||
map.put("pkCapitalColName",capitalColumnName);
|
||||
if(PK.equals(column.getKeyType())){
|
||||
// 存储主键类型
|
||||
genMap.put("pkColumnType",colType);
|
||||
// 存储小写开头的字段名
|
||||
genMap.put("pkChangeColName",changeColumnName);
|
||||
// 存储大写开头的字段名
|
||||
genMap.put("pkCapitalColName",capitalColumnName);
|
||||
}
|
||||
// 是否存在 Timestamp 类型的字段
|
||||
if(TIMESTAMP.equals(colType)){
|
||||
map.put("hasTimestamp",true);
|
||||
genMap.put("hasTimestamp",true);
|
||||
}
|
||||
// 是否存在 BigDecimal 类型的字段
|
||||
if(BIGDECIMAL.equals(colType)){
|
||||
map.put("hasBigDecimal",true);
|
||||
genMap.put("hasBigDecimal",true);
|
||||
}
|
||||
// 主键是否自增
|
||||
if(EXTRA.equals(column.getExtra())){
|
||||
map.put("auto",true);
|
||||
genMap.put("auto",true);
|
||||
}
|
||||
// 主键存在字典
|
||||
if(StringUtils.isNotBlank(column.getDictName())){
|
||||
genMap.put("hasDict",true);
|
||||
dicts.add(column.getDictName());
|
||||
}
|
||||
listMap.put("columnType",colType);
|
||||
listMap.put("columnName",column.getColumnName());
|
||||
listMap.put("isNullable",column.getIsNullable());
|
||||
listMap.put("columnShow",column.getColumnShow());
|
||||
listMap.put("changeColumnName",changeColumnName);
|
||||
listMap.put("capitalColumnName",capitalColumnName);
|
||||
|
||||
// 存储字段类型
|
||||
listMap.put("columnType",colType);
|
||||
// 存储字原始段名称
|
||||
listMap.put("columnName",column.getColumnName());
|
||||
// 不为空
|
||||
listMap.put("istNotNull",column.getNotNull());
|
||||
// 字段列表显示
|
||||
listMap.put("columnShow",column.getListShow());
|
||||
// 表单显示
|
||||
listMap.put("formShow",column.getFormShow());
|
||||
// 表单组件类型
|
||||
listMap.put("formType",column.getFormType());
|
||||
// 小写开头的字段名称
|
||||
listMap.put("changeColumnName",changeColumnName);
|
||||
//大写开头的字段名称
|
||||
listMap.put("capitalColumnName",capitalColumnName);
|
||||
// 字典名称
|
||||
listMap.put("dictName",column.getDictName());
|
||||
// 日期注解
|
||||
listMap.put("dateAnnotation",column.getDateAnnotation());
|
||||
if(StringUtils.isNotBlank(column.getDateAnnotation())){
|
||||
genMap.put("hasDateAnnotation",true);
|
||||
}
|
||||
// 添加非空字段信息
|
||||
if(column.getNotNull()){
|
||||
isNotNullColumns.add(listMap);
|
||||
}
|
||||
// 判断是否有查询,如有则把查询的字段set进columnQuery
|
||||
if(!StringUtils.isBlank(column.getColumnQuery())){
|
||||
listMap.put("columnQuery",column.getColumnQuery());
|
||||
map.put("hasQuery",true);
|
||||
if(!StringUtils.isBlank(column.getQueryType())){
|
||||
// 查询类型
|
||||
listMap.put("queryType",column.getQueryType());
|
||||
// 是否存在查询
|
||||
genMap.put("hasQuery",true);
|
||||
if(TIMESTAMP.equals(colType)){
|
||||
map.put("queryHasTimestamp",true);
|
||||
// 查询中存储 Timestamp 类型
|
||||
genMap.put("queryHasTimestamp",true);
|
||||
}
|
||||
if(BIGDECIMAL.equals(colType)){
|
||||
map.put("queryHasBigDecimal",true);
|
||||
// 查询中存储 BigDecimal 类型
|
||||
genMap.put("queryHasBigDecimal",true);
|
||||
}
|
||||
if("DateRange".equalsIgnoreCase(column.getQueryType())){
|
||||
dateRanges.add(listMap);
|
||||
} else {
|
||||
// 添加到查询列表中
|
||||
queryColumns.add(listMap);
|
||||
}
|
||||
queryColumns.add(listMap);
|
||||
}
|
||||
// 添加到字段列表中
|
||||
columns.add(listMap);
|
||||
}
|
||||
map.put("columns",columns);
|
||||
map.put("queryColumns",queryColumns);
|
||||
// 保存字段列表
|
||||
genMap.put("columns",columns);
|
||||
// 保存查询列表
|
||||
genMap.put("queryColumns",queryColumns);
|
||||
// 保存字段列表
|
||||
genMap.put("dicts",dicts);
|
||||
// 保存查询列表
|
||||
genMap.put("dateRanges",dateRanges);
|
||||
// 保存非空字段信息
|
||||
genMap.put("isNotNullColumns",isNotNullColumns);
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
||||
|
||||
// 生成后端代码
|
||||
List<String> templates = getAdminTemplateNames();
|
||||
for (String templateName : templates) {
|
||||
|
@ -156,14 +228,14 @@ public class GenUtil {
|
|||
continue;
|
||||
}
|
||||
// 生成代码
|
||||
genFile(file, template, map);
|
||||
genFile(file, template, genMap);
|
||||
}
|
||||
|
||||
// 生成前端代码
|
||||
templates = getFrontTemplateNames();
|
||||
for (String templateName : templates) {
|
||||
Template template = engine.getTemplate("generator/front/"+templateName+".ftl");
|
||||
String filePath = getFrontFilePath(templateName,genConfig,map.get("changeClassName").toString());
|
||||
String filePath = getFrontFilePath(templateName,genConfig,genMap.get("changeClassName").toString());
|
||||
|
||||
assert filePath != null;
|
||||
File file = new File(filePath);
|
||||
|
@ -173,7 +245,7 @@ public class GenUtil {
|
|||
continue;
|
||||
}
|
||||
// 生成代码
|
||||
genFile(file, template, map);
|
||||
genFile(file, template, genMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@ package me.zhengjie.service.dto;
|
|||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志查询类
|
||||
|
@ -20,9 +20,6 @@ public class LogQueryCriteria {
|
|||
@Query
|
||||
private String logType;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,18 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-generator</artifactId>
|
||||
<version>2.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-common</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- tools 模块包含了 common 和 logging 模块 -->
|
||||
<dependency>
|
||||
|
|
|
@ -3,6 +3,9 @@ package me.zhengjie;
|
|||
import me.zhengjie.utils.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
@ -24,4 +27,11 @@ public class AppRun {
|
|||
public SpringContextHolder springContextHolder() {
|
||||
return new SpringContextHolder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletWebServerFactory webServerFactory() {
|
||||
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
|
||||
fa.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
|
||||
return fa;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class QuartzJobController {
|
|||
|
||||
@Log("导出日志数据")
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/download/log")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public void downloadLog(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.downloadLog(quartzJobService.queryAllLog(criteria), response);
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -18,9 +19,6 @@ public class JobQueryCriteria {
|
|||
@Query
|
||||
private Boolean isSuccess;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,14 @@ public class DictController {
|
|||
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("查询字典")
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -51,8 +52,7 @@ public class JobController {
|
|||
@ApiOperation("查询岗位")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
public ResponseEntity getJobs(JobQueryCriteria criteria,
|
||||
Pageable pageable){
|
||||
public ResponseEntity getJobs(JobQueryCriteria criteria, Pageable pageable){
|
||||
// 数据权限
|
||||
criteria.setDeptIds(dataScope.getDeptIds());
|
||||
return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK);
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
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.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.vo.UserPassVo;
|
||||
|
@ -12,7 +12,7 @@ import me.zhengjie.modules.system.service.DeptService;
|
|||
import me.zhengjie.modules.system.service.RoleService;
|
||||
import me.zhengjie.modules.system.service.dto.RoleSmallDTO;
|
||||
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.modules.system.service.UserService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -25,9 +26,6 @@ public class DeptQueryCriteria{
|
|||
@Query
|
||||
private Long pid;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -22,5 +22,7 @@ public class DictDetailDTO implements Serializable {
|
|||
|
||||
private String sort;
|
||||
|
||||
private DictSmallDTO dict;
|
||||
|
||||
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.NoArgsConstructor;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -28,9 +27,6 @@ public class JobQueryCriteria {
|
|||
@Query(propName = "id", joinName = "dept", type = Query.Type.IN)
|
||||
private Set<Long> deptIds;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公共查询类
|
||||
|
@ -15,9 +16,6 @@ public class MenuQueryCriteria {
|
|||
@Query(blurry = "name,path,component")
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公共查询类
|
||||
|
@ -15,9 +16,6 @@ public class RoleQueryCriteria {
|
|||
@Query(blurry = "name,remark")
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
import me.zhengjie.annotation.Query;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -28,9 +29,6 @@ public class UserQueryCriteria implements Serializable {
|
|||
|
||||
private Long deptId;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @author Zheng Jie
|
||||
* @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> {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -70,4 +70,13 @@ public class ${className}Controller {
|
|||
${changeClassName}Service.delete(${pkChangeColName});
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ public class ${className}DTO implements Serializable {
|
|||
<#if columns??>
|
||||
<#list columns as column>
|
||||
|
||||
<#if column.columnComment != ''>
|
||||
// ${column.columnComment}
|
||||
<#if column.remark != ''>
|
||||
// ${column.remark}
|
||||
</#if>
|
||||
<#if column.columnKey = 'PRI'>
|
||||
<#if !auto && pkColumnType = 'Long'>
|
||||
|
|
|
@ -4,6 +4,14 @@ import lombok.Data;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
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>
|
||||
import java.sql.Timestamp;
|
||||
</#if>
|
||||
|
@ -23,8 +31,8 @@ public class ${className} implements Serializable {
|
|||
<#if columns??>
|
||||
<#list columns as column>
|
||||
|
||||
<#if column.columnComment != ''>
|
||||
// ${column.columnComment}
|
||||
<#if column.remark != ''>
|
||||
// ${column.remark}
|
||||
</#if>
|
||||
<#if column.columnKey = 'PRI'>
|
||||
@Id
|
||||
|
@ -32,7 +40,21 @@ public class ${className} implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
</#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};
|
||||
</#list>
|
||||
</#if>
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.sql.Timestamp;
|
|||
<#if queryHasBigDecimal>
|
||||
import java.math.BigDecimal;
|
||||
</#if>
|
||||
<#if dateRanges??>
|
||||
import java.util.List;
|
||||
</#if>
|
||||
<#if queryColumns??>
|
||||
import me.zhengjie.annotation.Query;
|
||||
</#if>
|
||||
|
@ -20,15 +23,37 @@ public class ${className}QueryCriteria{
|
|||
<#if queryColumns??>
|
||||
<#list queryColumns as column>
|
||||
|
||||
<#if column.columnQuery = '1'>
|
||||
// 模糊
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
</#if>
|
||||
<#if column.columnQuery = '2'>
|
||||
<#if column.queryType = '='>
|
||||
// 精确
|
||||
@Query
|
||||
</#if>
|
||||
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>
|
||||
</#if>
|
||||
}
|
|
@ -43,5 +43,7 @@ public interface ${className}Service {
|
|||
|
||||
void delete(${pkColumnType} ${pkChangeColName});
|
||||
|
||||
void deleteAll(${pkColumnType}[] ids);
|
||||
|
||||
void download(List<${className}DTO> all, HttpServletResponse response) throws IOException;
|
||||
}
|
|
@ -133,6 +133,13 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|||
${changeClassName}Repository.deleteById(${pkChangeColName});
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
public void deleteAll(${pkColumnType}[] ids) {
|
||||
for (${pkColumnType} id : ids) {
|
||||
${changeClassName}Repository.deleteById(${pkChangeColName});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<${className}DTO> all, HttpServletResponse response) throws IOException {
|
||||
|
@ -141,8 +148,8 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
<#list columns as column>
|
||||
<#if column.columnKey != 'PRI'>
|
||||
<#if column.columnComment != ''>
|
||||
map.put("${column.columnComment}", ${changeClassName}.get${column.capitalColumnName}());
|
||||
<#if column.remark != ''>
|
||||
map.put("${column.remark}", ${changeClassName}.get${column.capitalColumnName}());
|
||||
<#else>
|
||||
map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}());
|
||||
</#if>
|
||||
|
|
|
@ -14,6 +14,13 @@ export function del(${pkChangeColName}) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
export function delAll(ids) {
|
||||
return request({
|
||||
url: 'api/${changeClassName}/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
|
|
|
@ -1,13 +1,33 @@
|
|||
<template>
|
||||
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form ref="form" :model="form" <#if isNotNullColumns??>:rules="rules"</#if> size="small" label-width="80px">
|
||||
<#if columns??>
|
||||
<#list columns as column>
|
||||
<#if column.changeColumnName != '${pkChangeColName}'>
|
||||
<el-form-item label="<#if column.columnComment != ''>${column.columnComment}<#else>${column.changeColumnName}</#if>" <#if column.columnKey = 'UNI'>prop="${column.changeColumnName}"</#if>>
|
||||
<#if column.columnType != 'Timestamp'>
|
||||
<#if column.formShow>
|
||||
<el-form-item label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" <#if column.istNotNull>prop="${column.changeColumnName}"</#if>>
|
||||
<#if column.formType = 'Input'>
|
||||
<el-input v-model="form.${column.changeColumnName}" style="width: 370px;"/>
|
||||
<#else >
|
||||
<#elseif column.formType = 'Textarea'>
|
||||
<el-input :rows="3" v-model="form.${column.changeColumnName}" type="textarea" style="width: 370px;"/>
|
||||
<#elseif column.formType = 'Radio'>
|
||||
<#if column.dictName??>
|
||||
<el-radio v-for="item in dicts.${column.dictName}" :key="item.id" v-model="form.${column.changeColumnName}" :label="item.value">{{ item.label }}</el-radio>
|
||||
<#else>
|
||||
未设置字典,请手动设置 Radio
|
||||
</#if>
|
||||
<#elseif column.formType = 'Select'>
|
||||
<#if column.dictName??>
|
||||
<el-select v-model="form.${column.changeColumnName}" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dicts.${column.dictName}"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<#else>
|
||||
未设置字典,请手动设置 Select
|
||||
</#if>
|
||||
<#else>
|
||||
<el-date-picker v-model="form.${column.changeColumnName}" type="datetime" style="width: 370px;"/>
|
||||
</#if>
|
||||
</el-form-item>
|
||||
|
@ -29,7 +49,12 @@ export default {
|
|||
isAdd: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}<#if hasDict>,
|
||||
dicts: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
</#if>
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -42,13 +67,15 @@ export default {
|
|||
</#if>
|
||||
},
|
||||
rules: {
|
||||
<#list columns as column>
|
||||
<#if column.columnKey = 'UNI'>
|
||||
<#if isNotNullColumns??>
|
||||
<#list isNotNullColumns as column>
|
||||
<#if column.istNotNull>
|
||||
${column.changeColumnName}: [
|
||||
{ required: true, message: 'please enter', trigger: 'blur' }
|
||||
]<#if (column_has_next)>,</#if>
|
||||
]<#if column_has_next>,</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -57,10 +84,23 @@ export default {
|
|||
this.resetForm()
|
||||
},
|
||||
doSubmit() {
|
||||
this.loading = true
|
||||
if (this.isAdd) {
|
||||
this.doAdd()
|
||||
} else this.doEdit()
|
||||
<#if isNotNullColumns??>
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
if (this.isAdd) {
|
||||
this.doAdd()
|
||||
} else this.doEdit()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
<#else>
|
||||
this.loading = true
|
||||
if (this.isAdd) {
|
||||
this.doAdd()
|
||||
} else this.doEdit()
|
||||
</#if>
|
||||
},
|
||||
doAdd() {
|
||||
add(this.form).then(res => {
|
||||
|
|
|
@ -9,6 +9,22 @@
|
|||
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
|
||||
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
|
||||
</el-select>
|
||||
<#if dateRanges??>
|
||||
<#list dateRanges as column>
|
||||
<#if column.queryType = 'DateRange'>
|
||||
<el-date-picker
|
||||
v-model="query.${column.changeColumnName}"
|
||||
:default-time="['00:00:00','23:59:59']"
|
||||
type="daterange"
|
||||
range-separator=":"
|
||||
class="el-range-editor--small filter-item"
|
||||
style="height: 30.5px;width: 225px;"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="${column.changeColumnName}Start"
|
||||
end-placeholder="${column.changeColumnName}End"/>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
</#if>
|
||||
<!-- 新增 -->
|
||||
|
@ -31,18 +47,36 @@
|
|||
icon="el-icon-download"
|
||||
@click="download">导出</el-button>
|
||||
</div>
|
||||
<!-- 多选删除 -->
|
||||
<div v-permission="['admin','${changeClassName}:del']" style="display: inline-block;">
|
||||
<el-button
|
||||
:loading="delAllLoading"
|
||||
:disabled="data.length === 0 || $refs.table.selection.length === 0"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="open">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!--表单组件-->
|
||||
<eForm ref="form" :is-add="isAdd"/>
|
||||
<eForm ref="form" :is-add="isAdd" <#if hasDict>:dicts="dict"</#if>/>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
|
||||
<el-table v-loading="loading" ref="table" :data="data" size="small" style="width: 100%;">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<#if columns??>
|
||||
<#list columns as column>
|
||||
<#if column.columnShow = 'true'>
|
||||
<#if column.columnType != 'Timestamp'>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.columnComment != ''>${column.columnComment}<#else>${column.changeColumnName}</#if>"/>
|
||||
<#if column.columnShow>
|
||||
<#if column.dictName??>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<#elseif column.columnType != 'Timestamp'>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>"/>
|
||||
<#else>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.columnComment != ''>${column.columnComment}<#else>${column.changeColumnName}</#if>">
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.${column.changeColumnName}) }}</span>
|
||||
</template>
|
||||
|
@ -83,7 +117,7 @@
|
|||
<script>
|
||||
import checkPermission from '@/utils/permission'
|
||||
import initData from '@/mixins/initData'
|
||||
import { del, download${className} } from '@/api/${changeClassName}'
|
||||
import { del, download${className}, delAll } from '@/api/${changeClassName}'
|
||||
<#if hasTimestamp>
|
||||
import { parseTime, downloadFile } from '@/utils/index'
|
||||
</#if>
|
||||
|
@ -91,14 +125,19 @@ import eForm from './form'
|
|||
export default {
|
||||
components: { eForm },
|
||||
mixins: [initData],
|
||||
<#if hasDict>
|
||||
dicts: [<#if hasDict??><#list dicts as dict>'${dict}'<#if dict_has_next>, </#if></#list></#if>],
|
||||
</#if>
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
delLoading: false, delAllLoading: false,
|
||||
<#if hasQuery>
|
||||
queryTypeOptions: [
|
||||
<#if queryColumns??>
|
||||
<#list queryColumns as column>
|
||||
{ key: '${column.changeColumnName}', display_name: '<#if column.columnComment != ''>${column.columnComment}<#else>${column.changeColumnName}</#if>' }<#if column_has_next>,</#if>
|
||||
<#if column.queryType != 'DateRange'>
|
||||
{ key: '${column.changeColumnName}', display_name: '<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>' }<#if column_has_next>,</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
]
|
||||
|
@ -124,6 +163,16 @@ export default {
|
|||
const type = query.type
|
||||
const value = query.value
|
||||
if (type && value) { this.params[type] = value }
|
||||
<#if dateRanges??>
|
||||
<#list dateRanges as column>
|
||||
<#if column.queryType = 'DateRange'>
|
||||
if (query.${column.changeColumnName}) {
|
||||
this.params['${column.changeColumnName}Start'] = query.${column.changeColumnName}[0]
|
||||
this.params['${column.changeColumnName}End'] = query.${column.changeColumnName}[1]
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</#if>
|
||||
return true
|
||||
},
|
||||
|
@ -171,6 +220,36 @@ export default {
|
|||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
doDelete() {
|
||||
this.delAllLoading = true
|
||||
const data = this.$refs.table.selection
|
||||
const ids = []
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].id)
|
||||
}
|
||||
delAll(ids).then(res => {
|
||||
this.delAllLoading = false
|
||||
this.init()
|
||||
this.dleChangePage(ids.length)
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delAllLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
open() {
|
||||
this.$confirm('你确定删除选中的数据吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doDelete()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class EladminSystemApplicationTests {
|
||||
|
@ -13,5 +16,8 @@ public class EladminSystemApplicationTests {
|
|||
public void contextLoads() {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<mail.version>1.4.7</mail.version>
|
||||
<qiniu.version>[7.2.0, 7.2.99]</qiniu.version>
|
||||
<alipay.version>3.1.0</alipay.version>
|
||||
<configuration.version>1.9</configuration.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -34,19 +33,6 @@
|
|||
<version>${mail.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--模板引擎-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
<version>${configuration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--七牛云存储-->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.*;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain;
|
||||
package me.zhengjie.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain.vo;
|
||||
package me.zhengjie.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.domain.vo;
|
||||
package me.zhengjie.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
|
@ -1,40 +0,0 @@
|
|||
package me.zhengjie.modules.generator.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 列的数据信息
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ColumnInfo {
|
||||
|
||||
// 数据库字段名称
|
||||
private Object columnName;
|
||||
|
||||
// 允许空值
|
||||
private Object isNullable;
|
||||
|
||||
// 数据库字段类型
|
||||
private Object columnType;
|
||||
|
||||
// 数据库字段注释
|
||||
private Object columnComment;
|
||||
|
||||
// 数据库字段键类型
|
||||
private Object columnKey;
|
||||
|
||||
// 额外的参数
|
||||
private Object extra;
|
||||
|
||||
// 查询 1:模糊 2:精确
|
||||
private String columnQuery;
|
||||
|
||||
// 是否在列表显示
|
||||
private String columnShow;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package me.zhengjie.modules.generator.service;
|
||||
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-14
|
||||
*/
|
||||
public interface GenConfigService {
|
||||
|
||||
GenConfig find();
|
||||
|
||||
GenConfig update(GenConfig genConfig);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package me.zhengjie.modules.generator.service;
|
||||
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.modules.generator.domain.vo.ColumnInfo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
public interface GeneratorService {
|
||||
|
||||
/**
|
||||
* 查询数据库元数据
|
||||
* @param name 表名
|
||||
* @param startEnd 分页参数
|
||||
* @return /
|
||||
*/
|
||||
Object getTables(String name, int[] startEnd);
|
||||
|
||||
/**
|
||||
* 得到数据表的元数据
|
||||
* @param name 表名
|
||||
* @return /
|
||||
*/
|
||||
Object getColumns(String name);
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
* @param columnInfos 表字段数据
|
||||
* @param genConfig 代码生成配置
|
||||
* @param tableName 表名
|
||||
*/
|
||||
void generator(List<ColumnInfo> columnInfos, GenConfig genConfig, String tableName);
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
package me.zhengjie.modules.generator.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.generator.domain.GenConfig;
|
||||
import me.zhengjie.modules.generator.domain.vo.ColumnInfo;
|
||||
import me.zhengjie.modules.generator.domain.vo.TableInfo;
|
||||
import me.zhengjie.modules.generator.service.GeneratorService;
|
||||
import me.zhengjie.modules.generator.utils.GenUtil;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
@Service
|
||||
public class GeneratorServiceImpl implements GeneratorService {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public Object getTables(String name, int[] startEnd) {
|
||||
// 使用预编译防止sql注入
|
||||
String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " +
|
||||
"where table_schema = (select database()) " +
|
||||
"and table_name like ? order by create_time desc";
|
||||
Query query = em.createNativeQuery(sql);
|
||||
query.setFirstResult(startEnd[0]);
|
||||
query.setMaxResults(startEnd[1]-startEnd[0]);
|
||||
query.setParameter(1, StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%");
|
||||
List result = query.getResultList();
|
||||
List<TableInfo> tableInfos = new ArrayList<>();
|
||||
for (Object obj : result) {
|
||||
Object[] arr = (Object[]) obj;
|
||||
tableInfos.add(new TableInfo(arr[0],arr[1],arr[2],arr[3], ObjectUtil.isNotEmpty(arr[4])? arr[4] : "-"));
|
||||
}
|
||||
Query query1 = em.createNativeQuery("SELECT COUNT(*) from information_schema.tables where table_schema = (select database())");
|
||||
Object totalElements = query1.getSingleResult();
|
||||
return PageUtil.toPage(tableInfos,totalElements);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public Object getColumns(String name) {
|
||||
// 使用预编译防止sql注入
|
||||
String sql = "select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " +
|
||||
"where table_name = ? and table_schema = (select database()) order by ordinal_position";
|
||||
Query query = em.createNativeQuery(sql);
|
||||
query.setParameter(1, StringUtils.isNotBlank(name) ? name : null);
|
||||
List result = query.getResultList();
|
||||
List<ColumnInfo> columnInfos = new ArrayList<>();
|
||||
for (Object obj : result) {
|
||||
Object[] arr = (Object[]) obj;
|
||||
columnInfos.add(new ColumnInfo(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],null,"true"));
|
||||
}
|
||||
return PageUtil.toPage(columnInfos,columnInfos.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generator(List<ColumnInfo> columnInfos, GenConfig genConfig, String tableName) {
|
||||
if(genConfig.getId() == null){
|
||||
throw new BadRequestException("请先配置生成器");
|
||||
}
|
||||
try {
|
||||
GenUtil.generatorCode(columnInfos,genConfig,tableName);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.AlipayConfig;
|
||||
import me.zhengjie.domain.AlipayConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.EmailConfig;
|
||||
import me.zhengjie.domain.EmailConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.LocalStorage;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.Picture;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.QiniuConfig;
|
||||
import me.zhengjie.domain.QiniuConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.QiniuContent;
|
||||
import me.zhengjie.domain.QiniuContent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package me.zhengjie.modules.tools.repository;
|
||||
package me.zhengjie.repository;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.VerificationCode;
|
||||
import me.zhengjie.domain.VerificationCode;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
|
@ -1,15 +1,15 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.annotation.AnonymousAccess;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.tools.domain.AlipayConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.TradeVo;
|
||||
import me.zhengjie.modules.tools.utils.AliPayStatusEnum;
|
||||
import me.zhengjie.modules.tools.utils.AlipayUtils;
|
||||
import me.zhengjie.modules.tools.service.AlipayService;
|
||||
import me.zhengjie.domain.vo.TradeVo;
|
||||
import me.zhengjie.domain.AlipayConfig;
|
||||
import me.zhengjie.utils.AliPayStatusEnum;
|
||||
import me.zhengjie.utils.AlipayUtils;
|
||||
import me.zhengjie.service.AlipayService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
|
@ -1,11 +1,11 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.tools.domain.EmailConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.modules.tools.service.EmailService;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.EmailConfig;
|
||||
import me.zhengjie.service.EmailService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
|
@ -1,9 +1,9 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.tools.domain.LocalStorage;
|
||||
import me.zhengjie.modules.tools.service.LocalStorageService;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageQueryCriteria;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import me.zhengjie.service.LocalStorageService;
|
||||
import me.zhengjie.service.dto.LocalStorageQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
|
@ -1,11 +1,11 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.tools.domain.Picture;
|
||||
import me.zhengjie.modules.tools.service.PictureService;
|
||||
import me.zhengjie.modules.tools.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.service.PictureService;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.utils.SecurityUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
|
@ -1,13 +1,13 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.tools.domain.QiniuConfig;
|
||||
import me.zhengjie.modules.tools.service.dto.QiniuQueryCriteria;
|
||||
import me.zhengjie.modules.tools.domain.QiniuContent;
|
||||
import me.zhengjie.modules.tools.service.QiNiuService;
|
||||
import me.zhengjie.domain.QiniuConfig;
|
||||
import me.zhengjie.domain.QiniuContent;
|
||||
import me.zhengjie.service.dto.QiniuQueryCriteria;
|
||||
import me.zhengjie.service.QiNiuService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -52,7 +52,7 @@ public class QiniuController {
|
|||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download/list")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException {
|
||||
qiNiuService.downloadList(qiNiuService.queryAll(criteria), response);
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package me.zhengjie.modules.tools.rest;
|
||||
package me.zhengjie.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.modules.tools.domain.VerificationCode;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.modules.tools.service.EmailService;
|
||||
import me.zhengjie.modules.tools.service.VerificationCodeService;
|
||||
import me.zhengjie.domain.VerificationCode;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
import me.zhengjie.service.EmailService;
|
||||
import me.zhengjie.service.VerificationCodeService;
|
||||
import me.zhengjie.utils.ElAdminConstant;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.AlipayConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.TradeVo;
|
||||
import me.zhengjie.domain.vo.TradeVo;
|
||||
import me.zhengjie.domain.AlipayConfig;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.EmailConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.EmailConfig;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
/**
|
|
@ -1,8 +1,8 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.LocalStorage;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageQueryCriteria;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import me.zhengjie.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.service.dto.LocalStorageQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.Picture;
|
||||
import me.zhengjie.modules.tools.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.QiniuConfig;
|
||||
import me.zhengjie.modules.tools.domain.QiniuContent;
|
||||
import me.zhengjie.modules.tools.service.dto.QiniuQueryCriteria;
|
||||
import me.zhengjie.domain.QiniuConfig;
|
||||
import me.zhengjie.domain.QiniuContent;
|
||||
import me.zhengjie.service.dto.QiniuQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package me.zhengjie.modules.tools.service;
|
||||
package me.zhengjie.service;
|
||||
|
||||
import me.zhengjie.modules.tools.domain.VerificationCode;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.VerificationCode;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.service.dto;
|
||||
package me.zhengjie.service.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,7 +1,9 @@
|
|||
package me.zhengjie.modules.tools.service.dto;
|
||||
package me.zhengjie.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
|
@ -15,9 +17,6 @@ public class LocalStorageQueryCriteria{
|
|||
@Query(blurry = "name,suffix,type,operate,size")
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package me.zhengjie.modules.tools.service.dto;
|
||||
package me.zhengjie.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* sm.ms图床
|
||||
|
@ -20,9 +21,6 @@ public class PictureQueryCriteria{
|
|||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String username;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package me.zhengjie.modules.tools.service.dto;
|
||||
package me.zhengjie.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -15,9 +16,6 @@ public class QiniuQueryCriteria{
|
|||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String key;
|
||||
|
||||
@Query(type = Query.Type.GREATER_THAN,propName = "updateTime")
|
||||
private Timestamp startTime;
|
||||
|
||||
@Query(type = Query.Type.LESS_THAN,propName = "updateTime")
|
||||
private Timestamp endTime;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
||||
import me.zhengjie.modules.tools.domain.AlipayConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.TradeVo;
|
||||
import me.zhengjie.domain.vo.TradeVo;
|
||||
import me.zhengjie.domain.AlipayConfig;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.tools.repository.AlipayRepository;
|
||||
import me.zhengjie.modules.tools.service.AlipayService;
|
||||
import me.zhengjie.repository.AlipayRepository;
|
||||
import me.zhengjie.service.AlipayService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
|
@ -1,12 +1,12 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import cn.hutool.extra.mail.Mail;
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import me.zhengjie.modules.tools.domain.EmailConfig;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.EmailConfig;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.tools.repository.EmailRepository;
|
||||
import me.zhengjie.modules.tools.service.EmailService;
|
||||
import me.zhengjie.repository.EmailRepository;
|
||||
import me.zhengjie.service.EmailService;
|
||||
import me.zhengjie.utils.EncryptUtils;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CachePut;
|
|
@ -1,14 +1,14 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import me.zhengjie.modules.tools.domain.LocalStorage;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageQueryCriteria;
|
||||
import me.zhengjie.modules.tools.service.mapper.LocalStorageMapper;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import me.zhengjie.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.service.dto.LocalStorageQueryCriteria;
|
||||
import me.zhengjie.service.mapper.LocalStorageMapper;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.utils.*;
|
||||
import me.zhengjie.modules.tools.repository.LocalStorageRepository;
|
||||
import me.zhengjie.modules.tools.service.LocalStorageService;
|
||||
import me.zhengjie.repository.LocalStorageRepository;
|
||||
import me.zhengjie.service.LocalStorageService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
|
@ -1,14 +1,14 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.modules.tools.domain.Picture;
|
||||
import me.zhengjie.modules.tools.repository.PictureRepository;
|
||||
import me.zhengjie.modules.tools.service.PictureService;
|
||||
import me.zhengjie.modules.tools.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.repository.PictureRepository;
|
||||
import me.zhengjie.service.PictureService;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.utils.*;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.qiniu.common.QiniuException;
|
||||
|
@ -9,14 +9,14 @@ import com.qiniu.storage.UploadManager;
|
|||
import com.qiniu.storage.model.DefaultPutRet;
|
||||
import com.qiniu.storage.model.FileInfo;
|
||||
import com.qiniu.util.Auth;
|
||||
import me.zhengjie.modules.tools.domain.QiniuConfig;
|
||||
import me.zhengjie.modules.tools.domain.QiniuContent;
|
||||
import me.zhengjie.modules.tools.repository.QiniuContentRepository;
|
||||
import me.zhengjie.modules.tools.service.dto.QiniuQueryCriteria;
|
||||
import me.zhengjie.modules.tools.utils.QiNiuUtil;
|
||||
import me.zhengjie.domain.QiniuConfig;
|
||||
import me.zhengjie.domain.QiniuContent;
|
||||
import me.zhengjie.repository.QiniuContentRepository;
|
||||
import me.zhengjie.service.dto.QiniuQueryCriteria;
|
||||
import me.zhengjie.utils.QiNiuUtil;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.tools.repository.QiNiuConfigRepository;
|
||||
import me.zhengjie.modules.tools.service.QiNiuService;
|
||||
import me.zhengjie.repository.QiNiuConfigRepository;
|
||||
import me.zhengjie.service.QiNiuService;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.service.impl;
|
||||
package me.zhengjie.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
|
@ -6,11 +6,11 @@ import cn.hutool.extra.template.Template;
|
|||
import cn.hutool.extra.template.TemplateConfig;
|
||||
import cn.hutool.extra.template.TemplateEngine;
|
||||
import cn.hutool.extra.template.TemplateUtil;
|
||||
import me.zhengjie.modules.tools.domain.VerificationCode;
|
||||
import me.zhengjie.modules.tools.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.vo.EmailVo;
|
||||
import me.zhengjie.domain.VerificationCode;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.tools.repository.VerificationCodeRepository;
|
||||
import me.zhengjie.modules.tools.service.VerificationCodeService;
|
||||
import me.zhengjie.repository.VerificationCodeRepository;
|
||||
import me.zhengjie.service.VerificationCodeService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
|
@ -1,8 +1,8 @@
|
|||
package me.zhengjie.modules.tools.service.mapper;
|
||||
package me.zhengjie.service.mapper;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.tools.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.modules.tools.domain.LocalStorage;
|
||||
import me.zhengjie.service.dto.LocalStorageDTO;
|
||||
import me.zhengjie.domain.LocalStorage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.utils;
|
||||
package me.zhengjie.utils;
|
||||
|
||||
/**
|
||||
* 支付状态
|
|
@ -1,8 +1,8 @@
|
|||
package me.zhengjie.modules.tools.utils;
|
||||
package me.zhengjie.utils;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import me.zhengjie.modules.tools.domain.AlipayConfig;
|
||||
import me.zhengjie.domain.AlipayConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.tools.utils;
|
||||
package me.zhengjie.utils;
|
||||
|
||||
import com.qiniu.storage.Region;
|
||||
import me.zhengjie.utils.FileUtil;
|
3
pom.xml
3
pom.xml
|
@ -15,7 +15,8 @@
|
|||
<module>eladmin-system</module>
|
||||
<module>eladmin-tools</module>
|
||||
<module>eladmin-monitor</module>
|
||||
</modules>
|
||||
<module>eladmin-generator</module>
|
||||
</modules>
|
||||
|
||||
<name>EL-ADMIN后台管理系统</name>
|
||||
<url>http://auauz.net</url>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Target Server Version : 50562
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 31/10/2019 12:24:38
|
||||
Date: 08/11/2019 21:19:49
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
@ -52,7 +52,7 @@ CREATE TABLE `dept` (
|
|||
`enabled` bit(1) NOT NULL,
|
||||
`create_time` datetime NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dept
|
||||
|
@ -75,7 +75,7 @@ CREATE TABLE `dict` (
|
|||
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||||
`create_time` datetime NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dict
|
||||
|
@ -98,7 +98,7 @@ CREATE TABLE `dict_detail` (
|
|||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `FK5tpkputc6d9nboxojdbgnpmyb`(`dict_id`) USING BTREE,
|
||||
CONSTRAINT `FK5tpkputc6d9nboxojdbgnpmyb` FOREIGN KEY (`dict_id`) REFERENCES `dict` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dict_detail
|
||||
|
@ -124,6 +124,11 @@ CREATE TABLE `email_config` (
|
|||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of email_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `email_config` VALUES (1, '**', '**', '**', '465', 'eladmin');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for gen_config
|
||||
-- ----------------------------
|
||||
|
@ -143,7 +148,7 @@ CREATE TABLE `gen_config` (
|
|||
-- ----------------------------
|
||||
-- Records of gen_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `gen_config` VALUES (1, 'Zheng Jie', b'0', 'eladmin-system', 'me.zhengjie.test', 'E:\\workspace\\me\\front\\eladmin-qt\\src\\views\\test1111', 'E:\\workspace\\me\\front\\eladmin-qt\\src\\api', NULL);
|
||||
INSERT INTO `gen_config` VALUES (1, 'Zheng Jie', b'0', 'eladmin-system', 'me.zhengjie.test', 'E:\\workspace\\me\\front\\eladmin-web\\src\\views\\test', 'E:\\workspace\\me\\front\\eladmin-web\\src\\api', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for job
|
||||
|
@ -159,7 +164,7 @@ CREATE TABLE `job` (
|
|||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `FKmvhj0rogastlctflsxf1d6k3i`(`dept_id`) USING BTREE,
|
||||
CONSTRAINT `FKmvhj0rogastlctflsxf1d6k3i` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of job
|
||||
|
@ -185,7 +190,7 @@ CREATE TABLE `local_storage` (
|
|||
`operate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作人',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for log
|
||||
|
@ -205,7 +210,7 @@ CREATE TABLE `log` (
|
|||
`address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`browser` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 17040 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 17373 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for menu
|
||||
|
@ -239,8 +244,8 @@ INSERT INTO `menu` VALUES (3, b'0', '角色管理', 'system/role/index', 1, 3, '
|
|||
INSERT INTO `menu` VALUES (5, b'0', '菜单管理', 'system/menu/index', 1, 5, 'menu', 'menu', b'0', b'0', 'Menu', '2018-12-18 15:17:28', 'menu:list', 1);
|
||||
INSERT INTO `menu` VALUES (6, b'0', '系统监控', NULL, 0, 10, 'monitor', 'monitor', b'0', b'0', NULL, '2018-12-18 15:17:48', NULL, 0);
|
||||
INSERT INTO `menu` VALUES (7, b'0', '操作日志', 'monitor/log/index', 6, 11, 'log', 'logs', b'0', b'0', 'Log', '2018-12-18 15:18:26', NULL, 1);
|
||||
INSERT INTO `menu` VALUES (8, b'0', '系统缓存', 'monitor/redis/index', 6, 13, 'redis', 'redis', b'0', b'0', 'Redis', '2018-12-18 15:19:01', 'redis:list', 1);
|
||||
INSERT INTO `menu` VALUES (9, b'0', 'SQL监控', 'monitor/sql/index', 6, 14, 'sqlMonitor', 'druid', b'0', b'0', 'Sql', '2018-12-18 15:19:34', NULL, 1);
|
||||
INSERT INTO `menu` VALUES (8, b'0', '系统缓存', 'monitor/redis/index', 6, 15, 'redis', 'redis', b'0', b'0', 'Redis', '2018-12-18 15:19:01', 'redis:list', 1);
|
||||
INSERT INTO `menu` VALUES (9, b'0', 'SQL监控', 'monitor/sql/index', 6, 18, 'sqlMonitor', 'druid', b'0', b'0', 'Sql', '2018-12-18 15:19:34', NULL, 1);
|
||||
INSERT INTO `menu` VALUES (10, b'0', '组件管理', NULL, 0, 50, 'zujian', 'components', b'0', b'0', NULL, '2018-12-19 13:38:16', NULL, 0);
|
||||
INSERT INTO `menu` VALUES (11, b'0', '图标库', 'components/IconSelect', 10, 51, 'icon', 'icon', b'0', b'0', 'Icons', '2018-12-19 13:38:49', NULL, 1);
|
||||
INSERT INTO `menu` VALUES (14, b'0', '邮件工具', 'tools/email/index', 36, 24, 'email', 'email', b'0', b'0', 'Email', '2018-12-27 10:13:09', NULL, 1);
|
||||
|
@ -291,7 +296,35 @@ INSERT INTO `menu` VALUES (75, b'0', '任务删除', '', 28, 4, '', '', b'0', b'
|
|||
INSERT INTO `menu` VALUES (77, b'0', '上传文件', '', 18, 2, '', '', b'0', b'0', '', '2019-10-29 13:09:09', 'storage:add', 2);
|
||||
INSERT INTO `menu` VALUES (78, b'0', '文件编辑', '', 18, 3, '', '', b'0', b'0', '', '2019-10-29 13:09:22', 'storage:edit', 2);
|
||||
INSERT INTO `menu` VALUES (79, b'0', '文件删除', '', 18, 4, '', '', b'0', b'0', '', '2019-10-29 13:09:34', 'storage:del', 2);
|
||||
INSERT INTO `menu` VALUES (81, b'0', '服务器监控', 'monitor/server/index', 6, 15, 'system', 'server', b'0', b'0', 'Server', '2019-11-01 16:37:41', 'server:list', 1);
|
||||
INSERT INTO `menu` VALUES (80, b'0', '服务监控', 'monitor/server/index', 6, 14, 'codeConsole', 'server', b'0', b'0', 'ServerMonitor', '2019-11-07 13:06:39', 'server:list', 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for monitor_server
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `monitor_server`;
|
||||
CREATE TABLE `monitor_server` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`cpu_core` int(11) NULL DEFAULT NULL,
|
||||
`cpu_rate` double NULL DEFAULT NULL,
|
||||
`disk_total` double NULL DEFAULT NULL,
|
||||
`disk_used` double NULL DEFAULT NULL,
|
||||
`ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`mem_total` double NULL DEFAULT NULL,
|
||||
`mem_used` double NULL DEFAULT NULL,
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`port` int(11) NULL DEFAULT NULL,
|
||||
`sort` int(11) NULL DEFAULT NULL,
|
||||
`state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`swap_total` double NULL DEFAULT NULL,
|
||||
`swap_used` double NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of monitor_server
|
||||
-- ----------------------------
|
||||
INSERT INTO `monitor_server` VALUES (1, NULL, NULL, NULL, NULL, 'localhost', NULL, NULL, '本地', 8777, 1, '0', NULL, NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for picture
|
||||
-- ----------------------------
|
||||
|
@ -308,7 +341,7 @@ CREATE TABLE `picture` (
|
|||
`width` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片宽度',
|
||||
`md5code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qiniu_config
|
||||
|
@ -339,7 +372,7 @@ CREATE TABLE `qiniu_content` (
|
|||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件url',
|
||||
`suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for quartz_job
|
||||
|
@ -381,7 +414,7 @@ CREATE TABLE `quartz_log` (
|
|||
`params` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`time` bigint(20) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 269 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for role
|
||||
|
@ -396,7 +429,7 @@ CREATE TABLE `role` (
|
|||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`permission` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of role
|
||||
|
@ -497,7 +530,7 @@ INSERT INTO `roles_menus` VALUES (75, 1);
|
|||
INSERT INTO `roles_menus` VALUES (77, 1);
|
||||
INSERT INTO `roles_menus` VALUES (78, 1);
|
||||
INSERT INTO `roles_menus` VALUES (79, 1);
|
||||
INSERT INTO `roles_menus` VALUES (81, 1);
|
||||
INSERT INTO `roles_menus` VALUES (80, 1);
|
||||
INSERT INTO `roles_menus` VALUES (1, 2);
|
||||
INSERT INTO `roles_menus` VALUES (2, 2);
|
||||
INSERT INTO `roles_menus` VALUES (3, 2);
|
||||
|
@ -556,7 +589,7 @@ CREATE TABLE `user` (
|
|||
CONSTRAINT `FK5rwmryny6jthaaxkogownknqp` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `FKfftoc2abhot8f2wu6cl9a5iky` FOREIGN KEY (`job_id`) REFERENCES `job` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `FKpq2dhypk2qgt68nauh2by22jb` FOREIGN KEY (`avatar_id`) REFERENCES `user_avatar` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
|
@ -624,33 +657,6 @@ CREATE TABLE `visits` (
|
|||
`week_day` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `UK_11aksgq87euk9bcyeesfs4vtp`(`date`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 111 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of visits
|
||||
-- ----------------------------
|
||||
INSERT INTO `visits` VALUES (108, '2019-10-29 21:45:49', '2019-10-29', 1, 1, 'Tue');
|
||||
INSERT INTO `visits` VALUES (109, '2019-10-30 08:58:54', '2019-10-30', 2, 11, 'Wed');
|
||||
INSERT INTO `visits` VALUES (110, '2019-10-31 09:04:18', '2019-10-31', 2, 8, 'Thu');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `monitor_server`;
|
||||
CREATE TABLE `monitor_server` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
|
||||
`ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'IP地址',
|
||||
`port` int(11) NULL DEFAULT NULL COMMENT '访问端口',
|
||||
`state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态',
|
||||
`cpu_rate` float NULL DEFAULT NULL COMMENT 'CPU使用率',
|
||||
`cpu_core` int(11) NULL DEFAULT NULL COMMENT 'CPU内核数',
|
||||
`mem_total` float NULL DEFAULT NULL COMMENT '内存总数',
|
||||
`mem_used` float NULL DEFAULT NULL COMMENT '内存使用量',
|
||||
`disk_total` float NULL DEFAULT NULL COMMENT '磁盘总量',
|
||||
`disk_used` float NULL DEFAULT NULL COMMENT '磁盘使用量',
|
||||
`swap_total` float NULL DEFAULT NULL COMMENT '交换区总量',
|
||||
`swap_used` float NULL DEFAULT NULL COMMENT '交换区使用量',
|
||||
`sort` int(11) NULL DEFAULT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '服务器监控' ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 118 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
Loading…
Reference in New Issue