mirror of https://github.com/elunez/eladmin
English Translation phase 1
parent
55911bdc40
commit
7cc4fb427b
|
@ -11,10 +11,10 @@
|
|||
</properties>
|
||||
|
||||
<artifactId>eladmin-common</artifactId>
|
||||
<name>公共模块</name>
|
||||
<name>Common Module</name>
|
||||
|
||||
<dependencies>
|
||||
<!--工具包-->
|
||||
<!-- Toolkit -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
|
|
|
@ -28,60 +28,60 @@ import java.lang.annotation.Target;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Query {
|
||||
|
||||
// Dong ZhaoYang 2017/8/7 基本对象的属性名
|
||||
// Dong ZhaoYang 2017/8/7 Property name of the basic object
|
||||
String propName() default "";
|
||||
// Dong ZhaoYang 2017/8/7 查询方式
|
||||
// Dong ZhaoYang 2017/8/7 Query type
|
||||
Type type() default Type.EQUAL;
|
||||
|
||||
/**
|
||||
* 连接查询的属性名,如User类中的dept
|
||||
* Property name for join query, e.g., dept in User class
|
||||
*/
|
||||
String joinName() default "";
|
||||
|
||||
/**
|
||||
* 默认左连接
|
||||
* Default left join
|
||||
*/
|
||||
Join join() default Join.LEFT;
|
||||
|
||||
/**
|
||||
* 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如@Query(blurry = "email,username")
|
||||
* Multi-field fuzzy search, only supports String type fields, separated by commas, e.g., @Query(blurry = "email,username")
|
||||
*/
|
||||
String blurry() default "";
|
||||
|
||||
enum Type {
|
||||
// jie 2019/6/4 相等
|
||||
// jie 2019/6/4 Equal
|
||||
EQUAL
|
||||
// Dong ZhaoYang 2017/8/7 大于等于
|
||||
// Dong ZhaoYang 2017/8/7 Greater than or equal to
|
||||
, GREATER_THAN
|
||||
// Dong ZhaoYang 2017/8/7 小于等于
|
||||
// Dong ZhaoYang 2017/8/7 Less than or equal to
|
||||
, LESS_THAN
|
||||
// Dong ZhaoYang 2017/8/7 中模糊查询
|
||||
// Dong ZhaoYang 2017/8/7 Inner fuzzy query
|
||||
, INNER_LIKE
|
||||
// Dong ZhaoYang 2017/8/7 左模糊查询
|
||||
// Dong ZhaoYang 2017/8/7 Left fuzzy query
|
||||
, LEFT_LIKE
|
||||
// Dong ZhaoYang 2017/8/7 右模糊查询
|
||||
// Dong ZhaoYang 2017/8/7 Right fuzzy query
|
||||
, RIGHT_LIKE
|
||||
// Dong ZhaoYang 2017/8/7 小于
|
||||
// Dong ZhaoYang 2017/8/7 Less than
|
||||
, LESS_THAN_NQ
|
||||
// jie 2019/6/4 包含
|
||||
// jie 2019/6/4 Contains
|
||||
, IN
|
||||
// 不包含
|
||||
// Not contains
|
||||
, NOT_IN
|
||||
// 不等于
|
||||
// Not equal
|
||||
,NOT_EQUAL
|
||||
// between
|
||||
,BETWEEN
|
||||
// 不为空
|
||||
// Not null
|
||||
,NOT_NULL
|
||||
// 为空
|
||||
// Is null
|
||||
,IS_NULL,
|
||||
// Aborn Jiang 2022/06/01, 对应SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
|
||||
// Aborn Jiang 2022/06/01, Corresponds to SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
|
||||
FIND_IN_SET
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询
|
||||
* Suitable for simple join queries. For complex cases, please customize this annotation or use SQL queries.
|
||||
*/
|
||||
enum Join {
|
||||
/** jie 2019-6-4 13:18:30 */
|
||||
|
@ -89,4 +89,3 @@ public @interface Query {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
/**
|
||||
* Annotation for mapping HTTP {@code PATCH} requests onto specific handler
|
||||
* methods.
|
||||
* * 支持匿名访问 PatchMapping
|
||||
* * Supports anonymous access PatchMapping
|
||||
*
|
||||
* @author liaojinlong
|
||||
* @see AnonymousGetMapping
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
/**
|
||||
* Annotation for mapping HTTP {@code PUT} requests onto specific handler
|
||||
* methods.
|
||||
* * 支持匿名访问 PutMapping
|
||||
* * Supports anonymous access PutMapping
|
||||
*
|
||||
* @author liaojinlong
|
||||
* @see AnonymousGetMapping
|
||||
|
|
|
@ -75,15 +75,15 @@ public class LimitAspect {
|
|||
RedisScript<Long> redisScript = new DefaultRedisScript<>(luaScript, Long.class);
|
||||
Long count = redisTemplate.execute(redisScript, keys, limit.count(), limit.period());
|
||||
if (ObjUtil.isNotNull(count) && count.intValue() <= limit.count()) {
|
||||
logger.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name());
|
||||
logger.info("The {}th access to the key {}, description [{}] interface", count, keys, limit.name());
|
||||
return joinPoint.proceed();
|
||||
} else {
|
||||
throw new BadRequestException("访问次数受限制");
|
||||
throw new BadRequestException("Access count is restricted");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 限流脚本
|
||||
* Rate limiting script
|
||||
*/
|
||||
private String buildLuaScript() {
|
||||
return "local c" +
|
||||
|
|
|
@ -11,23 +11,23 @@ import java.sql.Timestamp;
|
|||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019年10月24日20:48:53
|
||||
* @date 2019-10-24 20:48:53
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class BaseDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@ApiModelProperty(value = "Creator")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
@ApiModelProperty(value = "Updater")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@ApiModelProperty(value = "Creation Time: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@ApiModelProperty(value = "Update Time: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp updateTime;
|
||||
|
||||
|
|
|
@ -24,28 +24,28 @@ import java.util.List;
|
|||
public interface BaseMapper<D, E> {
|
||||
|
||||
/**
|
||||
* DTO转Entity
|
||||
* DTO to Entity
|
||||
* @param dto /
|
||||
* @return /
|
||||
*/
|
||||
E toEntity(D dto);
|
||||
|
||||
/**
|
||||
* Entity转DTO
|
||||
* Entity to DTO
|
||||
* @param entity /
|
||||
* @return /
|
||||
*/
|
||||
D toDto(E entity);
|
||||
|
||||
/**
|
||||
* DTO集合转Entity集合
|
||||
* DTO List to Entity List
|
||||
* @param dtoList /
|
||||
* @return /
|
||||
*/
|
||||
List <E> toEntity(List<D> dtoList);
|
||||
|
||||
/**
|
||||
* Entity集合转DTO集合
|
||||
* Entity List to DTO List
|
||||
* @param entityList /
|
||||
* @return /
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @description : 设置审计
|
||||
* @description : Set audit
|
||||
* @author : Dong ZhaoYang
|
||||
* @date : 2019/10/28
|
||||
*/
|
||||
|
@ -29,17 +29,17 @@ import java.util.Optional;
|
|||
public class AuditorConfig implements AuditorAware<String> {
|
||||
|
||||
/**
|
||||
* 返回操作员标志信息
|
||||
* Return operator identification information
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> getCurrentAuditor() {
|
||||
try {
|
||||
// 这里应根据实际业务情况获取具体信息
|
||||
// Here you should obtain specific information according to actual business situation
|
||||
return Optional.of(SecurityUtils.getCurrentUsername());
|
||||
}catch (Exception ignored){}
|
||||
// 用户定时任务,或者无Token调用的情况
|
||||
// For scheduled tasks or cases where Token is not used
|
||||
return Optional.of("System");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,23 +29,23 @@ import java.io.IOException;
|
|||
public class RemoveDruidAdConfig {
|
||||
|
||||
/**
|
||||
* 方法名: removeDruidAdFilterRegistrationBean
|
||||
* 方法描述 除去页面底部的广告
|
||||
* Method name: removeDruidAdFilterRegistrationBean
|
||||
* Method description: Remove the advertisement at the bottom of the page
|
||||
* @param properties com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties
|
||||
* @return org.springframework.boot.web.servlet.FilterRegistrationBean
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean removeDruidAdFilterRegistrationBean(DruidStatProperties properties) {
|
||||
|
||||
// 获取web监控页面的参数
|
||||
// Get the parameters of the web monitoring page
|
||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||
// 提取common.js的配置路径
|
||||
// Extract the configuration path of common.js
|
||||
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||
|
||||
final String filePath = "support/http/resources/js/common.js";
|
||||
|
||||
//创建filter进行过滤
|
||||
// Create filter for filtering
|
||||
Filter filter = new Filter() {
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||
|
@ -55,9 +55,9 @@ public class RemoveDruidAdConfig {
|
|||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||
if (httpRequest.getRequestURI().endsWith("js/common.js")) {
|
||||
// 获取common.js
|
||||
// Get common.js
|
||||
String text = Utils.readFromResource(filePath);
|
||||
// 正则替换banner, 除去底部的广告信息
|
||||
// Use regex to replace banner, remove advertisement information at the bottom
|
||||
text = text.replaceAll("<a.*?druid_banner\"></a><br/>", "");
|
||||
text = text.replaceAll("powered by.*?shrek.wang</a>", "");
|
||||
httpResponse.setContentType("application/javascript");
|
||||
|
|
|
@ -23,7 +23,7 @@ import javax.crypto.spec.IvParameterSpec;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* Encryption
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ public class EncryptUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 对称加密
|
||||
* Symmetric encryption
|
||||
*/
|
||||
public static String desEncrypt(String source) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
|
@ -53,7 +53,7 @@ public class EncryptUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 对称解密
|
||||
* Symmetric decryption
|
||||
*/
|
||||
public static String desDecrypt(String source) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
|
@ -83,7 +83,7 @@ public class EncryptUtils {
|
|||
private static byte[] hex2byte(byte[] b) {
|
||||
int size = 2;
|
||||
if ((b.length % size) != 0) {
|
||||
throw new IllegalArgumentException("长度不是偶数");
|
||||
throw new IllegalArgumentException("Length is not even");
|
||||
}
|
||||
byte[] b2 = new byte[b.length / 2];
|
||||
for (int n = 0; n < b.length; n += size) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
public class EncryptUtilsTest {
|
||||
|
||||
/**
|
||||
* 对称加密
|
||||
* Symmetric encryption
|
||||
*/
|
||||
@Test
|
||||
public void testDesEncrypt() {
|
||||
|
@ -20,7 +20,7 @@ public class EncryptUtilsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 对称解密
|
||||
* Symmetric decryption
|
||||
*/
|
||||
@Test
|
||||
public void testDesDecrypt() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>eladmin-generator</artifactId>
|
||||
<name>代码生成模块</name>
|
||||
<name>Code Generation Module</name>
|
||||
|
||||
<properties>
|
||||
<configuration.version>1.10</configuration.version>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<version>2.7</version>
|
||||
</dependency>
|
||||
|
||||
<!--模板引擎-->
|
||||
<!-- Template Engine -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
|
|
|
@ -24,7 +24,7 @@ import javax.persistence.*;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 列的数据信息
|
||||
* Column Data Information
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-02
|
||||
*/
|
||||
|
@ -41,43 +41,43 @@ public class ColumnInfo implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "表名")
|
||||
@ApiModelProperty(value = "Table Name")
|
||||
private String tableName;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段名称")
|
||||
@ApiModelProperty(value = "Database Column Name")
|
||||
private String columnName;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段类型")
|
||||
@ApiModelProperty(value = "Database Column Type")
|
||||
private String columnType;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段键类型")
|
||||
@ApiModelProperty(value = "Database Column Key Type")
|
||||
private String keyType;
|
||||
|
||||
@ApiModelProperty(value = "字段额外的参数")
|
||||
@ApiModelProperty(value = "Extra Parameters for Column")
|
||||
private String extra;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段描述")
|
||||
@ApiModelProperty(value = "Database Column Description")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "是否必填")
|
||||
@ApiModelProperty(value = "Required")
|
||||
private Boolean notNull;
|
||||
|
||||
@ApiModelProperty(value = "是否在列表显示")
|
||||
@ApiModelProperty(value = "Show in List")
|
||||
private Boolean listShow;
|
||||
|
||||
@ApiModelProperty(value = "是否表单显示")
|
||||
@ApiModelProperty(value = "Show in Form")
|
||||
private Boolean formShow;
|
||||
|
||||
@ApiModelProperty(value = "表单类型")
|
||||
@ApiModelProperty(value = "Form Type")
|
||||
private String formType;
|
||||
|
||||
@ApiModelProperty(value = "查询 1:模糊 2:精确")
|
||||
@ApiModelProperty(value = "Query Type 1:Fuzzy 2:Exact")
|
||||
private String queryType;
|
||||
|
||||
@ApiModelProperty(value = "字典名称")
|
||||
@ApiModelProperty(value = "Dictionary Name")
|
||||
private String dictName;
|
||||
|
||||
@ApiModelProperty(value = "日期注解")
|
||||
@ApiModelProperty(value = "Date Annotation")
|
||||
private String dateAnnotation;
|
||||
|
||||
public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import javax.validation.constraints.NotBlank;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 代码生成配置
|
||||
* Code Generation Configuration
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-03
|
||||
*/
|
||||
|
@ -46,33 +46,33 @@ public class GenConfig implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "表名")
|
||||
@ApiModelProperty(value = "Table Name")
|
||||
private String tableName;
|
||||
|
||||
@ApiModelProperty(value = "接口名称")
|
||||
@ApiModelProperty(value = "API Alias")
|
||||
private String apiAlias;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "包路径")
|
||||
@ApiModelProperty(value = "Package Path")
|
||||
private String pack;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "模块名")
|
||||
@ApiModelProperty(value = "Module Name")
|
||||
private String moduleName;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "前端文件路径")
|
||||
@ApiModelProperty(value = "Frontend File Path")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "前端文件路径")
|
||||
@ApiModelProperty(value = "Frontend API Path")
|
||||
private String apiPath;
|
||||
|
||||
@ApiModelProperty(value = "作者")
|
||||
@ApiModelProperty(value = "Author")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "表前缀")
|
||||
@ApiModelProperty(value = "Table Prefix")
|
||||
private String prefix;
|
||||
|
||||
@ApiModelProperty(value = "是否覆盖")
|
||||
@ApiModelProperty(value = "Overwrite")
|
||||
private Boolean cover = false;
|
||||
}
|
||||
|
|
|
@ -32,19 +32,19 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/genConfig")
|
||||
@Api(tags = "系统:代码生成器配置管理")
|
||||
@Api(tags = "System: Code Generator Configuration Management")
|
||||
public class GenConfigController {
|
||||
|
||||
private final GenConfigService genConfigService;
|
||||
|
||||
@ApiOperation("查询")
|
||||
@ApiOperation("Query")
|
||||
@GetMapping(value = "/{tableName}")
|
||||
public ResponseEntity<GenConfig> queryGenConfig(@PathVariable String tableName){
|
||||
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
@ApiOperation("Update")
|
||||
public ResponseEntity<Object> updateGenConfig(@Validated @RequestBody GenConfig genConfig){
|
||||
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -24,17 +24,17 @@ import me.zhengjie.domain.GenConfig;
|
|||
public interface GenConfigService {
|
||||
|
||||
/**
|
||||
* 查询表配置
|
||||
* @param tableName 表名
|
||||
* @return 表配置
|
||||
* Query table configuration
|
||||
* @param tableName Table name
|
||||
* @return Table configuration
|
||||
*/
|
||||
GenConfig find(String tableName);
|
||||
|
||||
/**
|
||||
* 更新表配置
|
||||
* @param tableName 表名
|
||||
* @param genConfig 表配置
|
||||
* @return 表配置
|
||||
* Update table configuration
|
||||
* @param tableName Table name
|
||||
* @param genConfig Table configuration
|
||||
* @return Table configuration
|
||||
*/
|
||||
GenConfig update(String tableName, GenConfig genConfig);
|
||||
}
|
||||
|
|
|
@ -31,66 +31,66 @@ import java.util.List;
|
|||
public interface GeneratorService {
|
||||
|
||||
/**
|
||||
* 查询数据库元数据
|
||||
* @param name 表名
|
||||
* @param startEnd 分页参数
|
||||
* Query database metadata
|
||||
* @param name Table name
|
||||
* @param startEnd Pagination parameters
|
||||
* @return /
|
||||
*/
|
||||
PageResult<TableInfo> getTables(String name, int[] startEnd);
|
||||
|
||||
/**
|
||||
* 得到数据表的元数据
|
||||
* @param name 表名
|
||||
* Get table metadata
|
||||
* @param name Table name
|
||||
* @return /
|
||||
*/
|
||||
List<ColumnInfo> getColumns(String name);
|
||||
|
||||
/**
|
||||
* 同步表数据
|
||||
* @param columnInfos /
|
||||
* @param columnInfoList /
|
||||
* Synchronize table data
|
||||
* @param columnInfos
|
||||
* @param columnInfoList
|
||||
*/
|
||||
void sync(List<ColumnInfo> columnInfos, List<ColumnInfo> columnInfoList);
|
||||
|
||||
/**
|
||||
* 保持数据
|
||||
* @param columnInfos /
|
||||
* Save data
|
||||
* @param columnInfos
|
||||
*/
|
||||
void save(List<ColumnInfo> columnInfos);
|
||||
|
||||
/**
|
||||
* 获取所有table
|
||||
* Get all tables
|
||||
* @return /
|
||||
*/
|
||||
Object getTables();
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
* @param genConfig 配置信息
|
||||
* @param columns 字段信息
|
||||
* Code generation
|
||||
* @param genConfig Configuration information
|
||||
* @param columns Field information
|
||||
*/
|
||||
void generator(GenConfig genConfig, List<ColumnInfo> columns);
|
||||
|
||||
/**
|
||||
* 预览
|
||||
* @param genConfig 配置信息
|
||||
* @param columns 字段信息
|
||||
* Preview
|
||||
* @param genConfig Configuration information
|
||||
* @param columns Field information
|
||||
* @return /
|
||||
*/
|
||||
ResponseEntity<Object> preview(GenConfig genConfig, List<ColumnInfo> columns);
|
||||
|
||||
/**
|
||||
* 打包下载
|
||||
* @param genConfig 配置信息
|
||||
* @param columns 字段信息
|
||||
* @param request /
|
||||
* @param response /
|
||||
* Download as package
|
||||
* @param genConfig Configuration information
|
||||
* @param columns Field information
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
void download(GenConfig genConfig, List<ColumnInfo> columns, HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 查询数据库的表字段数据数据
|
||||
* @param table /
|
||||
* Query database table field data
|
||||
* @param table
|
||||
* @return /
|
||||
*/
|
||||
List<ColumnInfo> query(String table);
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* sql字段转java
|
||||
* Convert SQL fields to Java
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-03
|
||||
|
@ -29,9 +29,9 @@ public class ColUtil {
|
|||
private static final Logger log = LoggerFactory.getLogger(ColUtil.class);
|
||||
|
||||
/**
|
||||
* 转换mysql数据类型为java数据类型
|
||||
* Convert MySQL data type to Java data type
|
||||
*
|
||||
* @param type 数据库字段类型
|
||||
* @param type Database column type
|
||||
* @return String
|
||||
*/
|
||||
static String cloToJava(String type) {
|
||||
|
@ -41,7 +41,7 @@ public class ColUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
* Get configuration information
|
||||
*/
|
||||
public static PropertiesConfiguration getConfig() {
|
||||
try {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>eladmin-logging</artifactId>
|
||||
<name>日志模块</name>
|
||||
<name>Logging Module</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -49,15 +49,15 @@ public class LogAspect {
|
|||
}
|
||||
|
||||
/**
|
||||
* 配置切入点
|
||||
* Configure pointcut
|
||||
*/
|
||||
@Pointcut("@annotation(me.zhengjie.annotation.Log)")
|
||||
public void logPointcut() {
|
||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||
// This method has no method body. It mainly allows other methods in the same class to use this pointcut.
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||
* Configure around advice, used on the pointcut registered on method logPointcut()
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ public class LogAspect {
|
|||
}
|
||||
|
||||
/**
|
||||
* 配置异常通知
|
||||
* Configure exception advice
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
* @param e exception
|
||||
|
@ -89,7 +89,7 @@ public class LogAspect {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取用户名
|
||||
* Get the current username
|
||||
* @return /
|
||||
*/
|
||||
public String getUsername() {
|
||||
|
|
|
@ -42,39 +42,39 @@ public class SysLog implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "操作用户")
|
||||
@ApiModelProperty(value = "Operator User")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "方法名")
|
||||
@ApiModelProperty(value = "Method Name")
|
||||
private String method;
|
||||
|
||||
@ApiModelProperty(value = "参数")
|
||||
@ApiModelProperty(value = "Parameters")
|
||||
private String params;
|
||||
|
||||
@ApiModelProperty(value = "日志类型")
|
||||
@ApiModelProperty(value = "Log Type")
|
||||
private String logType;
|
||||
|
||||
@ApiModelProperty(value = "请求ip")
|
||||
@ApiModelProperty(value = "Request IP")
|
||||
private String requestIp;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
@ApiModelProperty(value = "Address")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "浏览器")
|
||||
@ApiModelProperty(value = "Browser")
|
||||
private String browser;
|
||||
|
||||
@ApiModelProperty(value = "请求耗时")
|
||||
@ApiModelProperty(value = "Request Duration")
|
||||
private Long time;
|
||||
|
||||
@ApiModelProperty(value = "异常详细")
|
||||
@ApiModelProperty(value = "Exception Details")
|
||||
private byte[] exceptionDetail;
|
||||
|
||||
/** 创建日期 */
|
||||
/** Creation Date */
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建日期:yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "Creation Date: yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp createTime;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.springframework.stereotype.Repository;
|
|||
public interface LogRepository extends JpaRepository<SysLog,Long>, JpaSpecificationExecutor<SysLog> {
|
||||
|
||||
/**
|
||||
* 根据日志类型删除信息
|
||||
* @param logType 日志类型
|
||||
* Delete information by log type
|
||||
* @param logType Log type
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true)
|
||||
|
|
|
@ -39,13 +39,13 @@ import java.io.IOException;
|
|||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/logs")
|
||||
@Api(tags = "系统:日志管理")
|
||||
@Api(tags = "System: Log Management")
|
||||
public class SysLogController {
|
||||
|
||||
private final SysLogService sysLogService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@Log("Export Data")
|
||||
@ApiOperation("Export Data")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void exportLog(HttpServletResponse response, SysLogQueryCriteria criteria) throws IOException {
|
||||
|
@ -53,8 +53,8 @@ public class SysLogController {
|
|||
sysLogService.download(sysLogService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@Log("导出错误数据")
|
||||
@ApiOperation("导出错误数据")
|
||||
@Log("Export Error Data")
|
||||
@ApiOperation("Export Error Data")
|
||||
@GetMapping(value = "/error/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void exportErrorLog(HttpServletResponse response, SysLogQueryCriteria criteria) throws IOException {
|
||||
|
@ -62,7 +62,7 @@ public class SysLogController {
|
|||
sysLogService.download(sysLogService.queryAll(criteria), response);
|
||||
}
|
||||
@GetMapping
|
||||
@ApiOperation("日志查询")
|
||||
@ApiOperation("Log Query")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> queryLog(SysLogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("INFO");
|
||||
|
@ -70,7 +70,7 @@ public class SysLogController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "/user")
|
||||
@ApiOperation("用户日志查询")
|
||||
@ApiOperation("User Log Query")
|
||||
public ResponseEntity<PageResult<SysLogSmallDto>> queryUserLog(SysLogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("INFO");
|
||||
criteria.setUsername(SecurityUtils.getCurrentUsername());
|
||||
|
@ -78,7 +78,7 @@ public class SysLogController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "/error")
|
||||
@ApiOperation("错误日志查询")
|
||||
@ApiOperation("Error Log Query")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLog(SysLogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("ERROR");
|
||||
|
@ -86,14 +86,14 @@ public class SysLogController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "/error/{id}")
|
||||
@ApiOperation("日志异常详情查询")
|
||||
@ApiOperation("Log Exception Detail Query")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLogDetail(@PathVariable Long id){
|
||||
return new ResponseEntity<>(sysLogService.findByErrDetail(id), HttpStatus.OK);
|
||||
}
|
||||
@DeleteMapping(value = "/del/error")
|
||||
@Log("删除所有ERROR日志")
|
||||
@ApiOperation("删除所有ERROR日志")
|
||||
@Log("Delete All ERROR Logs")
|
||||
@ApiOperation("Delete All ERROR Logs")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> delAllErrorLog(){
|
||||
sysLogService.delAllByError();
|
||||
|
@ -101,8 +101,8 @@ public class SysLogController {
|
|||
}
|
||||
|
||||
@DeleteMapping(value = "/del/info")
|
||||
@Log("删除所有INFO日志")
|
||||
@ApiOperation("删除所有INFO日志")
|
||||
@Log("Delete All INFO Logs")
|
||||
@ApiOperation("Delete All INFO Logs")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> delAllInfoLog(){
|
||||
sysLogService.delAllByInfo();
|
||||
|
|
|
@ -34,61 +34,61 @@ import java.util.List;
|
|||
public interface SysLogService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param criteria 查询条件
|
||||
* @param pageable 分页参数
|
||||
* Paginated query
|
||||
* @param criteria Query criteria
|
||||
* @param pageable Pagination parameters
|
||||
* @return /
|
||||
*/
|
||||
Object queryAll(SysLogQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @param criteria 查询条件
|
||||
* Query all data
|
||||
* @param criteria Query criteria
|
||||
* @return /
|
||||
*/
|
||||
List<SysLog> queryAll(SysLogQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询用户日志
|
||||
* @param criteria 查询条件
|
||||
* @param pageable 分页参数
|
||||
* @return -
|
||||
* Query user logs
|
||||
* @param criteria Query criteria
|
||||
* @param pageable Pagination parameters
|
||||
* @return /
|
||||
*/
|
||||
PageResult<SysLogSmallDto> queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 保存日志数据
|
||||
* @param username 用户
|
||||
* @param browser 浏览器
|
||||
* @param ip 请求IP
|
||||
* Save log data
|
||||
* @param username User
|
||||
* @param browser Browser
|
||||
* @param ip Request IP
|
||||
* @param joinPoint /
|
||||
* @param sysLog 日志实体
|
||||
* @param sysLog Log entity
|
||||
*/
|
||||
@Async
|
||||
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 查询异常详情
|
||||
* @param id 日志ID
|
||||
* Query exception details
|
||||
* @param id Log ID
|
||||
* @return Object
|
||||
*/
|
||||
Object findByErrDetail(Long id);
|
||||
|
||||
/**
|
||||
* 导出日志
|
||||
* @param sysLogs 待导出的数据
|
||||
* Export logs
|
||||
* @param sysLogs Data to export
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<SysLog> sysLogs, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 删除所有错误日志
|
||||
* Delete all error logs
|
||||
*/
|
||||
void delAllByError();
|
||||
|
||||
/**
|
||||
* 删除所有INFO日志
|
||||
* Delete all INFO logs
|
||||
*/
|
||||
void delAllByInfo();
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>eladmin-system</artifactId>
|
||||
<name>核心模块</name>
|
||||
<name>Core Module</name>
|
||||
|
||||
<properties>
|
||||
<jjwt.version>0.11.5</jjwt.version>
|
||||
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
|
||||
<!-- oshi monitoring requires specifying the jna version, see https://github.com/oshi/oshi/issues/1040 -->
|
||||
<jna.version>5.8.0</jna.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 代码生成模块 -->
|
||||
<!-- Code Generation Module -->
|
||||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-generator</artifactId>
|
||||
|
@ -30,7 +30,7 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- tools 模块包含了 common 和 logging 模块 -->
|
||||
<!-- The tools module includes the common and logging modules -->
|
||||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-tools</artifactId>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<version>${jjwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- linux的管理 -->
|
||||
<!-- Linux management -->
|
||||
<dependency>
|
||||
<groupId>ch.ethz.ganymed</groupId>
|
||||
<artifactId>ganymed-ssh2</artifactId>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<version>0.1.55</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<!-- Obtain system information -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
|
@ -85,14 +85,14 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- 打包 -->
|
||||
<!-- Packaging -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<!-- 跳过单元测试 -->
|
||||
<!-- Skip unit tests -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 开启审计功能 -> @EnableJpaAuditing
|
||||
* Enable auditing functionality -> @EnableJpaAuditing
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018/11/15 9:20:19
|
||||
|
@ -49,8 +49,8 @@ public class AppRun {
|
|||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication springApplication = new SpringApplication(AppRun.class);
|
||||
// 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/eladmin/app.pid
|
||||
// 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/eladmin/app.pid`
|
||||
// Monitor the application's PID. You can specify the PID path at startup: --spring.pid.file=/home/eladmin/app.pid
|
||||
// Or add the file path in application.yml for easy kill: kill `cat /home/eladmin/app.pid`
|
||||
springApplication.addListeners(new ApplicationPidFileWriter());
|
||||
springApplication.run(args);
|
||||
log.info("---------------------------------------------");
|
||||
|
@ -65,7 +65,7 @@ public class AppRun {
|
|||
}
|
||||
|
||||
/**
|
||||
* 访问首页提示
|
||||
* Homepage access prompt
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
|
|
|
@ -39,29 +39,29 @@ import java.util.Set;
|
|||
* @date 2019-08-24
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "运维:服务器管理")
|
||||
@Api(tags = "Ops: Server Management")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/serverDeploy")
|
||||
public class ServerDeployController {
|
||||
|
||||
private final ServerDeployService serverDeployService;
|
||||
|
||||
@ApiOperation("导出服务器数据")
|
||||
@ApiOperation("Export server data")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
public void exportServerDeploy(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws IOException {
|
||||
serverDeployService.download(serverDeployService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询服务器")
|
||||
@ApiOperation(value = "Query server")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
public ResponseEntity<PageResult<ServerDeployDto>> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增服务器")
|
||||
@ApiOperation(value = "新增服务器")
|
||||
@Log("Add server")
|
||||
@ApiOperation(value = "Add server")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> createServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
|
@ -69,8 +69,8 @@ public class ServerDeployController {
|
|||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改服务器")
|
||||
@ApiOperation(value = "修改服务器")
|
||||
@Log("Update server")
|
||||
@ApiOperation(value = "Update server")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:edit')")
|
||||
public ResponseEntity<Object> updateServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
|
@ -78,8 +78,8 @@ public class ServerDeployController {
|
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除服务器")
|
||||
@ApiOperation(value = "删除Server")
|
||||
@Log("Delete server")
|
||||
@ApiOperation(value = "Delete Server")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:del')")
|
||||
public ResponseEntity<Object> deleteServerDeploy(@RequestBody Set<Long> ids){
|
||||
|
@ -87,8 +87,8 @@ public class ServerDeployController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("测试连接服务器")
|
||||
@ApiOperation(value = "测试连接服务器")
|
||||
@Log("Test server connection")
|
||||
@ApiOperation(value = "Test server connection")
|
||||
@PostMapping("/testConnect")
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @description 程序启动后处理数据
|
||||
* @description Process data after program startup
|
||||
* @date 2025-01-13
|
||||
**/
|
||||
@Slf4j
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
server:
|
||||
port: 8000
|
||||
http2:
|
||||
# 启用 HTTP/2 支持,提升传输效率
|
||||
# Enable HTTP/2 support to improve transmission efficiency
|
||||
enabled: true
|
||||
compression:
|
||||
# 启用 GZIP 压缩,减少传输数据量
|
||||
# Enable GZIP compression to reduce data transmission
|
||||
enabled: true
|
||||
# 需要压缩的 MIME 类型
|
||||
# MIME types to compress
|
||||
mime-types: text/html, text/xml, text/plain, application/json
|
||||
# 最小压缩响应大小(字节)
|
||||
# Minimum response size for compression (bytes)
|
||||
|
||||
spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
# 激活的环境,如果需要 quartz 分布式支持,需要修改 active: dev,quartz
|
||||
# Active environment. If you need quartz distributed support, change active: dev,quartz
|
||||
active: dev
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
# pid:
|
||||
# file: /自行指定位置/eladmin.pid
|
||||
# file: /specify/location/eladmin.pid
|
||||
|
||||
#配置 Jpa
|
||||
# JPA configuration
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
|
@ -33,45 +33,45 @@ spring:
|
|||
dialect: org.hibernate.dialect.MySQL8Dialect
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
# Database index
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
# Connection timeout
|
||||
timeout: 5000
|
||||
# 连接池配置
|
||||
# Connection pool configuration
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数
|
||||
# Maximum number of connections in the pool
|
||||
max-active: 30
|
||||
# 连接池最大阻塞等待时间(毫秒),负值表示没有限制
|
||||
# Maximum blocking wait time in the pool (ms), negative means no limit
|
||||
max-wait: -1
|
||||
# 连接池中的最大空闲连接数
|
||||
# Maximum idle connections in the pool
|
||||
max-idle: 20
|
||||
# 连接池中的最小空闲连接数
|
||||
# Minimum idle connections in the pool
|
||||
min-idle: 1
|
||||
|
||||
task:
|
||||
pool:
|
||||
# 核心线程池大小
|
||||
# Core thread pool size
|
||||
core-pool-size: 10
|
||||
# 最大线程数
|
||||
# Maximum number of threads
|
||||
max-pool-size: 30
|
||||
# 活跃时间
|
||||
# Keep alive time
|
||||
keep-alive-seconds: 60
|
||||
# 队列容量
|
||||
# Queue capacity
|
||||
queue-capacity: 50
|
||||
|
||||
#七牛云
|
||||
# Qiniu Cloud
|
||||
qiniu:
|
||||
# 文件大小 /M
|
||||
# File size /M
|
||||
max-size: 15
|
||||
|
||||
#邮箱验证码有效时间/秒
|
||||
# Email verification code validity time/seconds
|
||||
code:
|
||||
expiration: 300
|
||||
|
||||
#密码加密传输,前端公钥加密,后端私钥解密
|
||||
# Password encrypted transmission, frontend public key encryption, backend private key decryption
|
||||
rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
|
@ -1,29 +1,29 @@
|
|||
# 应用的拦截模块
|
||||
# Application interception module
|
||||
modulelist=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
|
||||
# 自定义日志打印
|
||||
# Custom log printing
|
||||
logMessageFormat=me.zhengjie.config.CustomP6SpyLogger
|
||||
|
||||
# 日志输出到控制台
|
||||
# Log output to console
|
||||
appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
|
||||
# 日期格式
|
||||
# Date format
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
# 实际驱动可多个
|
||||
# Multiple actual drivers possible
|
||||
driverlist=com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 是否开启慢SQL记录
|
||||
# Enable slow SQL logging
|
||||
outagedetection=true
|
||||
|
||||
# 慢SQL记录标准 2 秒
|
||||
# Slow SQL logging standard: 2 seconds
|
||||
outagedetectioninterval=2
|
||||
|
||||
# 是否过滤 Log
|
||||
# Whether to filter Log
|
||||
filter=true
|
||||
|
||||
# 过滤 Log 时所排除的 sql 关键字,以逗号分隔
|
||||
# SQL keywords to exclude when filtering Log, separated by commas
|
||||
exclude=SELECT 1,INSERT INTO sys_log
|
||||
|
||||
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
# Configure Log exceptions, removable result sets include error, info, batch, debug, statement, commit, rollback, result, resultset.
|
||||
excludecategories=info,debug,result,commit,resultset
|
|
@ -19,8 +19,8 @@
|
|||
margin-top: 20px;
|
||||
border: 1px solid #eee;">
|
||||
<div style="padding: 10px;padding-bottom: 0px;">
|
||||
<p style="margin-bottom: 10px;padding-bottom: 0px;">尊敬的用户,您好:</p>
|
||||
<p style="text-indent: 2em; margin-bottom: 10px;">您正在申请邮箱验证,您的验证码为:</p>
|
||||
<p style="margin-bottom: 10px;padding-bottom: 0px;">Dear user, hello:</p>
|
||||
<p style="text-indent: 2em; margin-bottom: 10px;">You are applying for email verification, your verification code is:</p>
|
||||
<p style="text-align: center;
|
||||
font-family: Times New Roman;
|
||||
font-size: 22px;
|
||||
|
@ -39,7 +39,7 @@
|
|||
font-size: 12px;
|
||||
padding: 20px 0px;
|
||||
font-family: Microsoft YaHei;">
|
||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> 后台管理系统 All Rights Reserved.
|
||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> Backend Management System All Rights Reserved.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
padding: 20px;
|
||||
border: 1px solid #eee;">
|
||||
<div>
|
||||
<p style="margin-bottom: 10px;">任务信息:</p>
|
||||
<p style="margin-bottom: 10px;">Task Information:</p>
|
||||
<table style="border-collapse: collapse;">
|
||||
<tr>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">任务名称</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Bean名称</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">执行方法</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">参数内容</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Cron表达式</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">描述内容</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Task Name</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Bean Name</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Execution Method</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Parameter Content</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Cron Expression</th>
|
||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: .65em;border: 1px solid#777;">${task.jobName}</td>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<p style="margin-bottom: 10px;">异常信息:</p>
|
||||
<p style="margin-bottom: 10px;">Exception Information:</p>
|
||||
<pre style="position: relative;
|
||||
padding: 15px;
|
||||
line-height: 20px;
|
||||
|
@ -60,7 +60,7 @@
|
|||
font-size: 12px;
|
||||
padding: 20px 0px;
|
||||
font-family: Microsoft YaHei;">
|
||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> 后台管理系统 All Rights Reserved.
|
||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> Backend Management System All Rights Reserved.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>eladmin-tools</artifactId>
|
||||
<name>工具模块</name>
|
||||
<name>Tools Module</name>
|
||||
|
||||
<properties>
|
||||
<mail.version>1.4.7</mail.version>
|
||||
|
@ -17,28 +17,28 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 同时需要common模块和logging模块只需要引入logging模块即可 -->
|
||||
<!-- If you need both the common module and the logging module at the same time, just import the logging module. -->
|
||||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-logging</artifactId>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
|
||||
<!--邮件依赖-->
|
||||
<!-- Email dependency -->
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>${mail.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--七牛云存储-->
|
||||
<!-- Qiniu Cloud Storage -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>${qiniu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--支付宝依赖-->
|
||||
<!-- Alipay dependency -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
|
|
|
@ -40,22 +40,22 @@ public class LocalStorage extends BaseEntity implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "真实文件名")
|
||||
@ApiModelProperty(value = "Real file name")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "文件名")
|
||||
@ApiModelProperty(value = "File name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "后缀")
|
||||
@ApiModelProperty(value = "Suffix")
|
||||
private String suffix;
|
||||
|
||||
@ApiModelProperty(value = "路径")
|
||||
@ApiModelProperty(value = "Path")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
@ApiModelProperty(value = "Type")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "大小")
|
||||
@ApiModelProperty(value = "Size")
|
||||
private String size;
|
||||
|
||||
public LocalStorage(String realName,String name, String suffix, String path, String type, String size) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import javax.validation.constraints.NotBlank;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 七牛云对象存储配置类
|
||||
* Qiniu Cloud Object Storage Configuration Class
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-31
|
||||
*/
|
||||
|
@ -37,33 +37,33 @@ public class QiniuConfig implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "accessKey")
|
||||
@ApiModelProperty(value = "Access Key")
|
||||
private String accessKey;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "secretKey")
|
||||
@ApiModelProperty(value = "Secret Key")
|
||||
private String secretKey;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "存储空间名称作为唯一的 Bucket 识别符")
|
||||
@ApiModelProperty(value = "Storage space name used as the unique Bucket identifier")
|
||||
private String bucket;
|
||||
|
||||
/**
|
||||
* Zone表示与机房的对应关系
|
||||
* 华东 Zone.zone0()
|
||||
* 华北 Zone.zone1()
|
||||
* 华南 Zone.zone2()
|
||||
* 北美 Zone.zoneNa0()
|
||||
* 东南亚 Zone.zoneAs0()
|
||||
* Zone represents the correspondence between data center and region
|
||||
* East China Zone.zone0()
|
||||
* North China Zone.zone1()
|
||||
* South China Zone.zone2()
|
||||
* North America Zone.zoneNa0()
|
||||
* Southeast Asia Zone.zoneAs0()
|
||||
*/
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "Zone表示与机房的对应关系")
|
||||
@ApiModelProperty(value = "Zone represents the correspondence between data center and region")
|
||||
private String zone;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "外链域名,可自定义,需在七牛云绑定")
|
||||
@ApiModelProperty(value = "External domain, customizable, needs to be bound in Qiniu Cloud")
|
||||
private String host;
|
||||
|
||||
@ApiModelProperty(value = "空间类型:公开/私有")
|
||||
private String type = "公开";
|
||||
@ApiModelProperty(value = "Space type: public/private")
|
||||
private String type = "public";
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* 上传成功后,存储结果
|
||||
* Storage result after successful upload
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-31
|
||||
*/
|
||||
|
@ -39,26 +39,26 @@ public class QiniuContent implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@Column(name = "name")
|
||||
@ApiModelProperty(value = "文件名")
|
||||
@ApiModelProperty(value = "File name")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "空间名")
|
||||
@ApiModelProperty(value = "Bucket name")
|
||||
private String bucket;
|
||||
|
||||
@ApiModelProperty(value = "大小")
|
||||
@ApiModelProperty(value = "Size")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty(value = "文件地址")
|
||||
@ApiModelProperty(value = "File address")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
@ApiModelProperty(value = "File type")
|
||||
private String suffix;
|
||||
|
||||
@ApiModelProperty(value = "空间类型:公开/私有")
|
||||
private String type = "公开";
|
||||
@ApiModelProperty(value = "Space type: public/private")
|
||||
private String type = "public";
|
||||
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "创建或更新时间")
|
||||
@ApiModelProperty(value = "Creation or update time")
|
||||
@Column(name = "update_time")
|
||||
private Timestamp updateTime;
|
||||
}
|
||||
|
|
|
@ -28,14 +28,14 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
* @author 郑杰
|
||||
* Send Email
|
||||
* @author Zheng Jie
|
||||
* @date 2018/09/28 6:55:53
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("api/email")
|
||||
@Api(tags = "工具:邮件管理")
|
||||
@Api(tags = "Tools: Email Management")
|
||||
public class EmailController {
|
||||
|
||||
private final EmailService emailService;
|
||||
|
@ -45,17 +45,17 @@ public class EmailController {
|
|||
return new ResponseEntity<>(emailService.find(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("配置邮件")
|
||||
@Log("Configure email")
|
||||
@PutMapping
|
||||
@ApiOperation("配置邮件")
|
||||
@ApiOperation("Configure email")
|
||||
public ResponseEntity<Object> updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception {
|
||||
emailService.config(emailConfig,emailService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("发送邮件")
|
||||
@Log("Send email")
|
||||
@PostMapping
|
||||
@ApiOperation("发送邮件")
|
||||
@ApiOperation("Send email")
|
||||
public ResponseEntity<Object> sendEmail(@Validated @RequestBody EmailVo emailVo){
|
||||
emailService.send(emailVo,emailService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
|
|
@ -41,20 +41,20 @@ import java.io.IOException;
|
|||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "工具:本地存储管理")
|
||||
@Api(tags = "Tools: Local Storage Management")
|
||||
@RequestMapping("/api/localStorage")
|
||||
public class LocalStorageController {
|
||||
|
||||
private final LocalStorageService localStorageService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询文件")
|
||||
@ApiOperation("Query files")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public ResponseEntity<PageResult<LocalStorageDto>> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@ApiOperation("Export data")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
|
@ -62,37 +62,37 @@ public class LocalStorageController {
|
|||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("上传文件")
|
||||
@ApiOperation("Upload file")
|
||||
@PreAuthorize("@el.check('storage:add')")
|
||||
public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){
|
||||
localStorageService.create(name, file);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@ApiOperation("上传图片")
|
||||
@ApiOperation("Upload image")
|
||||
@PostMapping("/pictures")
|
||||
public ResponseEntity<LocalStorage> uploadPicture(@RequestParam MultipartFile file){
|
||||
// 判断文件是否为图片
|
||||
// Determine whether the file is an image
|
||||
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
|
||||
throw new BadRequestException("只能上传图片");
|
||||
throw new BadRequestException("Only images can be uploaded");
|
||||
}
|
||||
LocalStorage localStorage = localStorageService.create(null, file);
|
||||
return new ResponseEntity<>(localStorage, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改文件")
|
||||
@ApiOperation("修改文件")
|
||||
@Log("Update file")
|
||||
@ApiOperation("Update file")
|
||||
@PreAuthorize("@el.check('storage:edit')")
|
||||
public ResponseEntity<Object> updateFile(@Validated @RequestBody LocalStorage resources){
|
||||
localStorageService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除文件")
|
||||
@Log("Delete file")
|
||||
@DeleteMapping
|
||||
@ApiOperation("多选删除")
|
||||
@ApiOperation("Batch delete")
|
||||
public ResponseEntity<Object> deleteFile(@RequestBody Long[] ids) {
|
||||
localStorageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
|
40
pom.xml
40
pom.xml
|
@ -16,7 +16,7 @@
|
|||
<module>sport</module>
|
||||
</modules>
|
||||
|
||||
<name>ELADMIN 后台管理</name>
|
||||
<name>ELADMIN Admin Backend</name>
|
||||
<url>https://eladmin.vip</url>
|
||||
|
||||
<parent>
|
||||
|
@ -37,7 +37,7 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--Spring boot 核心-->
|
||||
<!--Spring boot core-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
|
@ -49,12 +49,12 @@
|
|||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot Web容器-->
|
||||
<!--Spring boot Web container-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<!-- 去掉Jackson依赖,用fastjson -->
|
||||
<!-- Remove Jackson dependency, use fastjson -->
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
|
@ -62,20 +62,20 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 测试-->
|
||||
<!--Spring boot test-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 安全框架-->
|
||||
<!--Spring boot security framework-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring boot 缓存 -->
|
||||
<!-- spring boot cache -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
|
@ -94,7 +94,7 @@
|
|||
<version>3.17.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--spring boot 集成redis所需common-pool2-->
|
||||
<!--spring boot integration with redis requires common-pool2-->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
@ -106,20 +106,20 @@
|
|||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--监控sql日志-->
|
||||
<!--SQL log monitoring-->
|
||||
<dependency>
|
||||
<groupId>p6spy</groupId>
|
||||
<artifactId>p6spy</artifactId>
|
||||
<version>3.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI 相关 -->
|
||||
<!-- Swagger UI related -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<exclusions>
|
||||
<!-- 去掉 swagger-annotations 依赖,避免冲突 -->
|
||||
<!-- Remove swagger-annotations dependency to avoid conflicts -->
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
|
@ -127,14 +127,14 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 添加swagger-annotations依赖 -->
|
||||
<!-- Add swagger-annotations dependency -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.22</version>
|
||||
</dependency>
|
||||
|
||||
<!--Mysql依赖包-->
|
||||
<!--Mysql dependency package-->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
|
@ -142,28 +142,28 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- druid数据源驱动 -->
|
||||
<!-- druid data source driver -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- IP地址解析库 -->
|
||||
<!-- IP address parsing library -->
|
||||
<dependency>
|
||||
<groupId>net.dreamlu</groupId>
|
||||
<artifactId>mica-ip2region</artifactId>
|
||||
<version>2.7.18.9</version>
|
||||
</dependency>
|
||||
|
||||
<!--lombok插件-->
|
||||
<!--lombok plugin-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<!-- excel tool -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
|
@ -193,7 +193,7 @@
|
|||
<version>${fastjson2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Java图形验证码 -->
|
||||
<!-- Java graphical captcha -->
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
|
@ -206,7 +206,7 @@
|
|||
<version>1.13.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--mapStruct依赖-->
|
||||
<!--mapStruct dependency-->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
|
@ -233,7 +233,7 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 打包时跳过测试 -->
|
||||
<!-- Skip tests during packaging -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
|
@ -1,64 +1,64 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<!-- Toolbar -->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">名称</label>
|
||||
<el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">创建时间</label>
|
||||
<el-input v-model="query.createTime" clearable placeholder="创建时间" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">是否启用</label>
|
||||
<el-input v-model="query.enabled" clearable placeholder="是否启用" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<!-- Search -->
|
||||
<label class="el-form-item-label">Name</label>
|
||||
<el-input v-model="query.name" clearable placeholder="Name" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">Creation Time</label>
|
||||
<el-input v-model="query.createTime" clearable placeholder="Creation Time" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">Enabled</label>
|
||||
<el-input v-model="query.enabled" clearable placeholder="Enabled" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<!-- If you want to add more buttons to the toolbar, you can use slots. slot = 'left' or 'right' -->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<!-- Form component -->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="id">
|
||||
<el-input v-model="form.id" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-form-item label="Name" prop="name">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-form-item label="Description">
|
||||
<el-input v-model="form.description" :rows="3" type="textarea" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-form-item label="Creation Time">
|
||||
<el-date-picker v-model="form.createTime" type="datetime" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间">
|
||||
<el-form-item label="Update Time">
|
||||
<el-date-picker v-model="form.updateTime" type="datetime" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标">
|
||||
<el-form-item label="Icon">
|
||||
<el-input v-model="form.icon" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-form-item label="Sort">
|
||||
<el-input v-model="form.sort" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用">
|
||||
未设置字典,请手动设置 Radio
|
||||
<el-form-item label="Enabled">
|
||||
Dictionary not set, please manually set Radio
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
<el-button type="text" @click="crud.cancelCU">Cancel</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">Confirm</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<!-- Table rendering -->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="id" label="id" />
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="description" label="描述" />
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column prop="updateTime" label="更新时间" />
|
||||
<el-table-column prop="icon" label="图标" />
|
||||
<el-table-column prop="sort" label="排序" />
|
||||
<el-table-column prop="enabled" label="是否启用" />
|
||||
<el-table-column v-if="checkPer(['admin','sport:edit','sport:del'])" label="操作" width="150px" align="center">
|
||||
<el-table-column prop="name" label="Name" />
|
||||
<el-table-column prop="description" label="Description" />
|
||||
<el-table-column prop="createTime" label="Creation Time" />
|
||||
<el-table-column prop="updateTime" label="Update Time" />
|
||||
<el-table-column prop="icon" label="Icon" />
|
||||
<el-table-column prop="sort" label="Sort" />
|
||||
<el-table-column prop="enabled" label="Enabled" />
|
||||
<el-table-column v-if="checkPer(['admin','sport:edit','sport:del'])" label="Operation" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
|
@ -67,7 +67,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<!-- Pagination component -->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -87,7 +87,7 @@ export default {
|
|||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: 'sport', url: 'api/sport', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSport }})
|
||||
return CRUD({ title: 'Sport', url: 'api/sport', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSport }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -98,18 +98,18 @@ export default {
|
|||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '名称不能为空', trigger: 'blur' }
|
||||
{ required: true, message: 'Name cannot be empty', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'name', display_name: '名称' },
|
||||
{ key: 'createTime', display_name: '创建时间' },
|
||||
{ key: 'enabled', display_name: '是否启用' }
|
||||
{ key: 'name', display_name: 'Name' },
|
||||
{ key: 'createTime', display_name: 'Creation Time' },
|
||||
{ key: 'enabled', display_name: 'Enabled' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
// Hook: executed before getting table data, return false to prevent data from being retrieved
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -46,45 +46,45 @@ public class Club implements Serializable {
|
|||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "名称")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "描述")
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
@ApiModelProperty(value = "Update time", hidden = true)
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`icon`")
|
||||
@ApiModelProperty(value = "图标")
|
||||
@ApiModelProperty(value = "Icon")
|
||||
private String icon;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
@ApiModelProperty(value = "Sort")
|
||||
private Integer sort;
|
||||
|
||||
@Column(name = "`enabled`")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
@ApiModelProperty(value = "Enabled")
|
||||
private Boolean enabled;
|
||||
|
||||
@Column(name = "`location`")
|
||||
@ApiModelProperty(value = "位置")
|
||||
@ApiModelProperty(value = "Location")
|
||||
private String location;
|
||||
|
||||
@Column(name = "`longitude`")
|
||||
@ApiModelProperty(value = "经度")
|
||||
@ApiModelProperty(value = "Longitude")
|
||||
private Double longitude;
|
||||
|
||||
@Column(name = "`latitude`")
|
||||
@ApiModelProperty(value = "纬度")
|
||||
@ApiModelProperty(value = "Latitude")
|
||||
private Double latitude;
|
||||
|
||||
public void copy(Club source){
|
||||
|
|
|
@ -54,17 +54,17 @@ public class Court implements Serializable {
|
|||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
@ApiModelProperty(value = "Update time", hidden = true)
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`amount`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "数量")
|
||||
@ApiModelProperty(value = "Amount")
|
||||
private Integer amount;
|
||||
|
||||
public void copy(Court source){
|
||||
|
|
|
@ -47,37 +47,37 @@ public class Player implements Serializable {
|
|||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "名称")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "描述")
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "`latitude`")
|
||||
@ApiModelProperty(value = "纬度")
|
||||
@ApiModelProperty(value = "Latitude")
|
||||
private Double latitude;
|
||||
|
||||
@Column(name = "`longitude`")
|
||||
@ApiModelProperty(value = "经度")
|
||||
@ApiModelProperty(value = "Longitude")
|
||||
private Double longitude;
|
||||
|
||||
@Column(name = "`profile_image`")
|
||||
@ApiModelProperty(value = "图片")
|
||||
@ApiModelProperty(value = "Image")
|
||||
private String profileImage;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
@ApiModelProperty(value = "Update time", hidden = true)
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`rate_score`")
|
||||
@ApiModelProperty(value = "评分")
|
||||
@ApiModelProperty(value = "Score")
|
||||
private Double rateScore;
|
||||
|
||||
@Column(name = "`user_id`",nullable = false)
|
||||
|
|
|
@ -47,33 +47,33 @@ public class Sport implements Serializable {
|
|||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "名称")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "描述")
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
@ApiModelProperty(value = "Update time", hidden = true)
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`icon`")
|
||||
@ApiModelProperty(value = "图标")
|
||||
@ApiModelProperty(value = "Icon")
|
||||
private String icon;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
@ApiModelProperty(value = "Sort")
|
||||
private Integer sort;
|
||||
|
||||
@Column(name = "`enabled`")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
@ApiModelProperty(value = "Enabled")
|
||||
private Boolean enabled;
|
||||
|
||||
public void copy(Sport source){
|
||||
|
|
Loading…
Reference in New Issue