Merge branch 'master' into deploy

# Conflicts:
#	README.md
#	eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java
pull/875/head
Zheng Jie 2023-07-04 22:38:56 +08:00
commit ba16a830ac
89 changed files with 356 additions and 302 deletions

View File

@ -176,7 +176,7 @@ recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright 2019-2020 Zheng Jie
Copyright 2019-2023 Zheng Jie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -74,7 +74,9 @@ public @interface Query {
// 不为空
,NOT_NULL
// 为空
,IS_NULL
,IS_NULL,
// Aborn Jiang 2022/06/01, 对应SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
FIND_IN_SET
}
/**

View File

@ -0,0 +1,16 @@
package me.zhengjie.utils;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.List;
@Getter
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class PageResult<T> {
private final List<T> content;
private final long totalElements;
}

View File

@ -28,11 +28,11 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
/**
* List
*/
public static List toPage(int page, int size , List list) {
public static <T> List<T> paging(int page, int size , List<T> list) {
int fromIndex = page * size;
int toIndex = page * size + size;
if(fromIndex > list.size()){
return new ArrayList();
return Collections.emptyList();
} else if(toIndex >= list.size()) {
return list.subList(fromIndex,list.size());
} else {
@ -43,21 +43,21 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
/**
* Page redis
*/
public static Map<String,Object> toPage(Page page) {
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",page.getContent());
map.put("totalElements",page.getTotalElements());
return map;
public static <T> PageResult<T> toPage(Page<T> page) {
return new PageResult<>(page.getContent(), page.getTotalElements());
}
/**
*
*/
public static Map<String,Object> toPage(Object object, Object totalElements) {
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",object);
map.put("totalElements",totalElements);
return map;
public static <T> PageResult<T> toPage(List<T> list, long totalElements) {
return new PageResult<>(list, totalElements);
}
/**
*
*/
public static <T> PageResult<T> noData () {
return new PageResult<>(null, 0);
}
}

View File

@ -166,6 +166,10 @@ public class QueryHelp {
(Comparable) between.get(0), (Comparable) between.get(1)));
}
break;
case FIND_IN_SET:
list.add(cb.greaterThan(cb.function("FIND_IN_SET", Integer.class,
cb.literal(val.toString()), root.get(attributeName)), 0));
break;
default: break;
}
}

View File

@ -19,13 +19,11 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -36,9 +34,8 @@ import java.util.concurrent.TimeUnit;
@SuppressWarnings({"unchecked", "all"})
public class RedisUtils {
private static final Logger log = LoggerFactory.getLogger(RedisUtils.class);
private RedisTemplate<Object, Object> redisTemplate;
@Value("${jwt.online-key}")
private String onlineKey;
public RedisUtils(RedisTemplate<Object, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
@ -51,7 +48,7 @@ public class RedisUtils {
*
*
* @param key
* @param time ()
* @param time () :
*/
public boolean expire(String key, long time) {
try {
@ -69,7 +66,7 @@ public class RedisUtils {
*
*
* @param key
* @param time ()
* @param time () :
* @param timeUnit
*/
public boolean expire(String key, long time, TimeUnit timeUnit) {
@ -197,6 +194,21 @@ public class RedisUtils {
}
}
/**
* key
* @param pattern
*/
public void scanDel(String pattern){
ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
try (Cursor<byte[]> cursor = redisTemplate.executeWithStickyConnection(
(RedisCallback<Cursor<byte[]>>) connection -> (Cursor<byte[]>) new ConvertingCursor<>(
connection.scan(options), redisTemplate.getKeySerializer()::deserialize))) {
while (cursor.hasNext()) {
redisTemplate.delete(cursor.next());
}
}
}
// ============================String=============================
/**
@ -244,7 +256,7 @@ public class RedisUtils {
*
* @param key
* @param value
* @param time () time0 time0
* @param time () time0 time0 :
* @return true false
*/
public boolean set(String key, Object value, long time) {
@ -266,7 +278,7 @@ public class RedisUtils {
*
* @param key
* @param value
* @param time
* @param time :
* @param timeUnit
* @return true false
*/
@ -326,11 +338,11 @@ public class RedisUtils {
}
/**
* HashSet
* HashSet
*
* @param key
* @param map
* @param time ()
* @param time () :hash,
* @return true false
*/
public boolean hmset(String key, Map<String, Object> map, long time) {
@ -484,7 +496,7 @@ public class RedisUtils {
* set
*
* @param key
* @param time ()
* @param time () :
* @param values
* @return
*/
@ -605,7 +617,7 @@ public class RedisUtils {
*
* @param key
* @param value
* @param time ()
* @param time () :
* @return
*/
public boolean lSet(String key, Object value, long time) {
@ -643,7 +655,7 @@ public class RedisUtils {
*
* @param key
* @param value
* @param time ()
* @param time () :
* @return
*/
public boolean lSet(String key, List<Object> value, long time) {

View File

@ -39,7 +39,7 @@ public class GenConfigController {
@ApiOperation("查询")
@GetMapping(value = "/{tableName}")
public ResponseEntity<Object> queryGenConfig(@PathVariable String tableName){
public ResponseEntity<GenConfig> queryGenConfig(@PathVariable String tableName){
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
}

View File

@ -19,9 +19,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.ColumnInfo;
import me.zhengjie.domain.vo.TableInfo;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.service.GenConfigService;
import me.zhengjie.service.GeneratorService;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.PageUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
@ -55,16 +57,16 @@ public class GeneratorController {
@ApiOperation("查询数据库数据")
@GetMapping(value = "/tables")
public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name,
@RequestParam(defaultValue = "0")Integer page,
@RequestParam(defaultValue = "10")Integer size){
public ResponseEntity<PageResult<TableInfo>> queryTables(@RequestParam(defaultValue = "") String name,
@RequestParam(defaultValue = "0")Integer page,
@RequestParam(defaultValue = "10")Integer size){
int[] startEnd = PageUtil.transToStartEnd(page, size);
return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK);
}
@ApiOperation("查询字段数据")
@GetMapping(value = "/columns")
public ResponseEntity<Object> queryColumns(@RequestParam String tableName){
public ResponseEntity<PageResult<ColumnInfo>> queryColumns(@RequestParam String tableName){
List<ColumnInfo> columnInfos = generatorService.getColumns(tableName);
return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK);
}

View File

@ -17,6 +17,8 @@ package me.zhengjie.service;
import me.zhengjie.domain.GenConfig;
import me.zhengjie.domain.ColumnInfo;
import me.zhengjie.domain.vo.TableInfo;
import me.zhengjie.utils.PageResult;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import javax.servlet.http.HttpServletRequest;
@ -35,7 +37,7 @@ public interface GeneratorService {
* @param startEnd
* @return /
*/
Object getTables(String name, int[] startEnd);
PageResult<TableInfo> getTables(String name, int[] startEnd);
/**
*

View File

@ -25,10 +25,7 @@ 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.FileUtil;
import me.zhengjie.utils.GenUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.StringUtils;
import me.zhengjie.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@ -41,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -71,7 +69,7 @@ public class GeneratorServiceImpl implements GeneratorService {
}
@Override
public Object getTables(String name, int[] startEnd) {
public PageResult<TableInfo> 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()) " +
@ -90,8 +88,8 @@ public class GeneratorServiceImpl implements GeneratorService {
"where table_schema = (select database()) and table_name like :table";
Query queryCount = em.createNativeQuery(countSql);
queryCount.setParameter("table", StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%");
Object totalElements = queryCount.getSingleResult();
return PageUtil.toPage(tableInfos, totalElements);
BigInteger totalElements = (BigInteger) queryCount.getSingleResult();
return PageUtil.toPage(tableInfos, totalElements.longValue());
}
@Override

View File

@ -87,7 +87,7 @@ public class GenUtil {
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
for (String templateName : templates) {
Map<String, Object> map = new HashMap<>(1);
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl");
Template template = engine.getTemplate("admin/" + templateName + ".ftl");
map.put("content", template.render(genMap));
map.put("name", templateName);
genList.add(map);
@ -96,7 +96,7 @@ public class GenUtil {
templates = getFrontTemplateNames();
for (String templateName : templates) {
Map<String, Object> map = new HashMap<>(1);
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl");
Template template = engine.getTemplate("front/" + templateName + ".ftl");
map.put(templateName, template.render(genMap));
map.put("content", template.render(genMap));
map.put("name", templateName);
@ -114,7 +114,7 @@ public class GenUtil {
// 生成后端代码
List<String> templates = getAdminTemplateNames();
for (String templateName : templates) {
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl");
Template template = engine.getTemplate("admin/" + templateName + ".ftl");
String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), tempPath + "eladmin" + File.separator);
assert filePath != null;
File file = new File(filePath);
@ -128,7 +128,7 @@ public class GenUtil {
// 生成前端代码
templates = getFrontTemplateNames();
for (String templateName : templates) {
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl");
Template template = engine.getTemplate("front/" + templateName + ".ftl");
String path = tempPath + "eladmin-web" + File.separator;
String apiPath = path + "src" + File.separator + "api" + File.separator;
String srcPath = path + "src" + File.separator + "views" + File.separator + genMap.get("changeClassName").toString() + File.separator;
@ -151,7 +151,7 @@ public class GenUtil {
// 生成后端代码
List<String> templates = getAdminTemplateNames();
for (String templateName : templates) {
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl");
Template template = engine.getTemplate("admin/" + templateName + ".ftl");
String rootPath = System.getProperty("user.dir");
String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), rootPath);
@ -169,7 +169,7 @@ public class GenUtil {
// 生成前端代码
templates = getFrontTemplateNames();
for (String templateName : templates) {
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl");
Template template = engine.getTemplate("front/" + templateName + ".ftl");
String filePath = getFrontFilePath(templateName, genConfig.getApiPath(), genConfig.getPath(), genMap.get("changeClassName").toString());
assert filePath != null;

View File

@ -1,4 +1,4 @@
#数据库类型转Java类型
# Database type to Java type
tinyint=Integer
smallint=Integer
mediumint=Integer

View File

@ -29,6 +29,8 @@ import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import me.zhengjie.utils.PageResult;
import ${package}.service.dto.${className}Dto;
/**
* @website https://eladmin.vip
@ -55,7 +57,7 @@ public class ${className}Controller {
@Log("查询${apiAlias}")
@ApiOperation("查询${apiAlias}")
@PreAuthorize("@el.check('${changeClassName}:list')")
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<${className}Dto>> query${className}(${className}QueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -64,7 +66,8 @@ public class ${className}Controller {
@ApiOperation("新增${apiAlias}")
@PreAuthorize("@el.check('${changeClassName}:add')")
public ResponseEntity<Object> create${className}(@Validated @RequestBody ${className} resources){
return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED);
${changeClassName}Service.create(resources);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping

View File

@ -23,6 +23,7 @@ import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import me.zhengjie.utils.PageResult;
/**
* @website https://eladmin.vip
@ -38,7 +39,7 @@ public interface ${className}Service {
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(${className}QueryCriteria criteria, Pageable pageable);
PageResult<${className}Dto> queryAll(${className}QueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
@ -57,9 +58,8 @@ public interface ${className}Service {
/**
* 创建
* @param resources /
* @return ${className}Dto
*/
${className}Dto create(${className} resources);
void create(${className} resources);
/**
* 编辑

View File

@ -52,6 +52,7 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import me.zhengjie.utils.PageResult;
/**
* @website https://eladmin.vip
@ -67,7 +68,7 @@ public class ${className}ServiceImpl implements ${className}Service {
private final ${className}Mapper ${changeClassName}Mapper;
@Override
public Map<String,Object> queryAll(${className}QueryCriteria criteria, Pageable pageable){
public PageResult<${className}Dto> queryAll(${className}QueryCriteria criteria, Pageable pageable){
Page<${className}> page = ${changeClassName}Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(${changeClassName}Mapper::toDto));
}
@ -87,7 +88,7 @@ public class ${className}ServiceImpl implements ${className}Service {
@Override
@Transactional(rollbackFor = Exception.class)
public ${className}Dto create(${className} resources) {
public void create(${className} resources) {
<#if !auto && pkColumnType = 'Long'>
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
resources.set${pkCapitalColName}(snowflake.nextId());
@ -104,7 +105,7 @@ public class ${className}ServiceImpl implements ${className}Service {
</#if>
</#list>
</#if>
return ${changeClassName}Mapper.toDto(${changeClassName}Repository.save(resources));
${changeClassName}Repository.save(resources);
}
@Override

View File

@ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.service.SysLogService;
import me.zhengjie.service.dto.SysLogQueryCriteria;
import me.zhengjie.service.dto.SysLogSmallDto;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@ -69,7 +71,7 @@ public class SysLogController {
@GetMapping(value = "/user")
@ApiOperation("用户日志查询")
public ResponseEntity<Object> queryUserLog(SysLogQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<SysLogSmallDto>> queryUserLog(SysLogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("INFO");
criteria.setUsername(SecurityUtils.getCurrentUsername());
return new ResponseEntity<>(sysLogService.queryAllByUser(criteria,pageable), HttpStatus.OK);

View File

@ -17,6 +17,8 @@ package me.zhengjie.service;
import me.zhengjie.domain.SysLog;
import me.zhengjie.service.dto.SysLogQueryCriteria;
import me.zhengjie.service.dto.SysLogSmallDto;
import me.zhengjie.utils.PageResult;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
@ -52,7 +54,7 @@ public interface SysLogService {
* @param pageable
* @return -
*/
Object queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable);
PageResult<SysLogSmallDto> queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -24,6 +24,7 @@ import me.zhengjie.domain.SysLog;
import me.zhengjie.repository.LogRepository;
import me.zhengjie.service.SysLogService;
import me.zhengjie.service.dto.SysLogQueryCriteria;
import me.zhengjie.service.dto.SysLogSmallDto;
import me.zhengjie.service.mapstruct.LogErrorMapper;
import me.zhengjie.service.mapstruct.LogSmallMapper;
import me.zhengjie.utils.*;
@ -60,7 +61,7 @@ public class SysLogServiceImpl implements SysLogService {
if (status.equals(criteria.getLogType())) {
return PageUtil.toPage(page.map(logErrorMapper::toDto));
}
return page;
return PageUtil.toPage(page);
}
@Override
@ -69,7 +70,7 @@ public class SysLogServiceImpl implements SysLogService {
}
@Override
public Object queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable) {
public PageResult<SysLogSmallDto> queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable) {
Page<SysLog> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
return PageUtil.toPage(page.map(logSmallMapper::toDto));
}

View File

@ -21,8 +21,6 @@ import me.zhengjie.utils.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;
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.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.http.HttpStatus;

View File

@ -1,16 +0,0 @@
package me.zhengjie.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.annotation.Configuration;
/**
* @author bearBoy80
*/
@Configuration(proxyBeanMethods = false)
public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "[]{}");
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright 2019-2023 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.annotation.Configuration;
/**
* @author bearBoy80
*/
@Configuration(proxyBeanMethods = false)
public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "[]{}");
}
}

View File

@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.mnt.domain.App;
import me.zhengjie.modules.mnt.service.AppService;
import me.zhengjie.modules.mnt.service.dto.AppDto;
import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -54,7 +56,7 @@ public class AppController {
@ApiOperation(value = "查询应用")
@GetMapping
@PreAuthorize("@el.check('app:list')")
public ResponseEntity<Object> queryApp(AppQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<AppDto>> queryApp(AppQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(appService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -26,6 +26,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
import me.zhengjie.modules.mnt.util.SqlUtils;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -62,7 +63,7 @@ public class DatabaseController {
@ApiOperation(value = "查询数据库")
@GetMapping
@PreAuthorize("@el.check('database:list')")
public ResponseEntity<Object> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<DatabaseDto>> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(databaseService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -23,8 +23,10 @@ import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.mnt.domain.Deploy;
import me.zhengjie.modules.mnt.domain.DeployHistory;
import me.zhengjie.modules.mnt.service.DeployService;
import me.zhengjie.modules.mnt.service.dto.DeployDto;
import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -65,7 +67,7 @@ public class DeployController {
@ApiOperation(value = "查询部署")
@GetMapping
@PreAuthorize("@el.check('deploy:list')")
public ResponseEntity<Object> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<DeployDto>> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(deployService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -20,7 +20,9 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.mnt.service.DeployHistoryService;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -52,7 +54,7 @@ public class DeployHistoryController {
@ApiOperation(value = "查询部署历史")
@GetMapping
@PreAuthorize("@el.check('deployHistory:list')")
public ResponseEntity<Object> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<DeployHistoryDto>> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(deployhistoryService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.mnt.domain.ServerDeploy;
import me.zhengjie.modules.mnt.service.ServerDeployService;
import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -54,7 +56,7 @@ public class ServerDeployController {
@ApiOperation(value = "查询服务器")
@GetMapping
@PreAuthorize("@el.check('serverDeploy:list')")
public ResponseEntity<Object> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<ServerDeployDto>> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import me.zhengjie.modules.mnt.domain.App;
import me.zhengjie.modules.mnt.service.dto.AppDto;
import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -37,7 +38,7 @@ public interface AppService {
* @param pageable
* @return /
*/
Object queryAll(AppQueryCriteria criteria, Pageable pageable);
PageResult<AppDto> queryAll(AppQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import me.zhengjie.modules.mnt.domain.Database;
import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -37,7 +38,7 @@ public interface DatabaseService {
* @param pageable
* @return /
*/
Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable);
PageResult<DatabaseDto> queryAll(DatabaseQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import me.zhengjie.modules.mnt.domain.DeployHistory;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -36,7 +37,7 @@ public interface DeployHistoryService {
* @param pageable
* @return /
*/
Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable);
PageResult<DeployHistoryDto> queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -19,6 +19,7 @@ import me.zhengjie.modules.mnt.domain.Deploy;
import me.zhengjie.modules.mnt.domain.DeployHistory;
import me.zhengjie.modules.mnt.service.dto.DeployDto;
import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -38,7 +39,7 @@ public interface DeployService {
* @param pageable
* @return /
*/
Object queryAll(DeployQueryCriteria criteria, Pageable pageable);
PageResult<DeployDto> queryAll(DeployQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service;
import me.zhengjie.modules.mnt.domain.ServerDeploy;
import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -37,7 +38,7 @@ public interface ServerDeployService {
* @param pageable
* @return /
*/
Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable);
PageResult<ServerDeployDto> queryAll(ServerDeployQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.AppService;
import me.zhengjie.modules.mnt.service.dto.AppDto;
import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
import me.zhengjie.modules.mnt.service.mapstruct.AppMapper;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -47,7 +44,7 @@ public class AppServiceImpl implements AppService {
private final AppMapper appMapper;
@Override
public Object queryAll(AppQueryCriteria criteria, Pageable pageable){
public PageResult<AppDto> queryAll(AppQueryCriteria criteria, Pageable pageable){
Page<App> page = appRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(appMapper::toDto));
}

View File

@ -25,10 +25,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
import me.zhengjie.modules.mnt.service.mapstruct.DatabaseMapper;
import me.zhengjie.modules.mnt.util.SqlUtils;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -50,7 +47,7 @@ public class DatabaseServiceImpl implements DatabaseService {
private final DatabaseMapper databaseMapper;
@Override
public Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable){
public PageResult<DatabaseDto> queryAll(DatabaseQueryCriteria criteria, Pageable pageable){
Page<Database> page = databaseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(databaseMapper::toDto));
}

View File

@ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.DeployHistoryService;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
import me.zhengjie.modules.mnt.service.mapstruct.DeployHistoryMapper;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -47,7 +44,7 @@ public class DeployHistoryServiceImpl implements DeployHistoryService {
private final DeployHistoryMapper deployhistoryMapper;
@Override
public Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable){
public PageResult<DeployHistoryDto> queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable){
Page<DeployHistory> page = deployhistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(deployhistoryMapper::toDto));
}

View File

@ -68,7 +68,7 @@ public class DeployServiceImpl implements DeployService {
@Override
public Object queryAll(DeployQueryCriteria criteria, Pageable pageable) {
public PageResult<DeployDto> queryAll(DeployQueryCriteria criteria, Pageable pageable) {
Page<Deploy> page = deployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return PageUtil.toPage(page.map(deployMapper::toDto));
}

View File

@ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
import me.zhengjie.modules.mnt.service.mapstruct.ServerDeployMapper;
import me.zhengjie.modules.mnt.util.ExecuteShellUtil;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -47,7 +44,7 @@ public class ServerDeployServiceImpl implements ServerDeployService {
private final ServerDeployMapper serverDeployMapper;
@Override
public Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable){
public PageResult<ServerDeployDto> queryAll(ServerDeployQueryCriteria criteria, Pageable pageable){
Page<ServerDeploy> page = serverDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(serverDeployMapper::toDto));
}

View File

@ -22,8 +22,10 @@ import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.Log;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.quartz.domain.QuartzJob;
import me.zhengjie.modules.quartz.domain.QuartzLog;
import me.zhengjie.modules.quartz.service.QuartzJobService;
import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.SpringContextHolder;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@ -52,7 +54,7 @@ public class QuartzJobController {
@ApiOperation("查询定时任务")
@GetMapping
@PreAuthorize("@el.check('timing:list')")
public ResponseEntity<Object> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<QuartzJob>> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK);
}
@ -73,7 +75,7 @@ public class QuartzJobController {
@ApiOperation("查询任务执行日志")
@GetMapping(value = "/logs")
@PreAuthorize("@el.check('timing:list')")
public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<QuartzLog>> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
}

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.quartz.service;
import me.zhengjie.modules.quartz.domain.QuartzJob;
import me.zhengjie.modules.quartz.domain.QuartzLog;
import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -36,7 +37,7 @@ public interface QuartzJobService {
* @param pageable
* @return /
*/
Object queryAll(JobQueryCriteria criteria, Pageable pageable);
PageResult<QuartzJob> queryAll(JobQueryCriteria criteria, Pageable pageable);
/**
*
@ -51,7 +52,7 @@ public interface QuartzJobService {
* @param pageable
* @return /
*/
Object queryAllLog(JobQueryCriteria criteria, Pageable pageable);
PageResult<QuartzLog> queryAllLog(JobQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -50,12 +50,12 @@ public class QuartzJobServiceImpl implements QuartzJobService {
private final RedisUtils redisUtils;
@Override
public Object queryAll(JobQueryCriteria criteria, Pageable pageable){
public PageResult<QuartzJob> queryAll(JobQueryCriteria criteria, Pageable pageable){
return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
}
@Override
public Object queryAllLog(JobQueryCriteria criteria, Pageable pageable){
public PageResult<QuartzLog> queryAllLog(JobQueryCriteria criteria, Pageable pageable){
return PageUtil.toPage(quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
}

View File

@ -124,7 +124,7 @@ public class ExecutionJob extends QuartzJobBean {
data.put("task", quartzJob);
data.put("msg", msg);
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
Template template = engine.getTemplate("email/taskAlarm.ftl");
Template template = engine.getTemplate("taskAlarm.ftl");
emailVo.setContent(template.render(data));
List<String> emails = Arrays.asList(quartzJob.getEmail().split("[,]"));
emailVo.setTos(emails);

View File

@ -39,7 +39,7 @@ public class LoginProperties {
private LoginCode loginCode;
public static final String cacheKey = "USER-LOGIN-DATA";
public static final String cacheKey = "user-login-cache:";
public boolean isSingleLogin() {
return singleLogin;

View File

@ -44,6 +44,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -105,23 +106,24 @@ public class AuthorizationController {
// SecurityContextHolder.getContext().setAuthentication(authentication);
String token = tokenProvider.createToken(authentication);
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息
onlineUserService.save(jwtUserDto, token, request);
// 返回 token 与 用户信息
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
put("token", properties.getTokenStartWith() + token);
put("user", jwtUserDto);
}};
if (loginProperties.isSingleLogin()) {
//踢掉之前已经登录的token
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
// 踢掉之前已经登录的token
onlineUserService.kickOutForUsername(authUser.getUsername());
}
// 保存在线信息
onlineUserService.save(jwtUserDto, token, request);
// 返回登录信息
return ResponseEntity.ok(authInfo);
}
@ApiOperation("获取用户信息")
@GetMapping(value = "/info")
public ResponseEntity<Object> getUserInfo() {
public ResponseEntity<UserDetails> getUserInfo() {
return ResponseEntity.ok(SecurityUtils.getCurrentUser());
}

View File

@ -15,11 +15,13 @@
*/
package me.zhengjie.modules.security.rest;
import cn.hutool.db.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.modules.security.service.dto.OnlineUserDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -43,15 +45,15 @@ public class OnlineController {
@ApiOperation("查询在线用户")
@GetMapping
@PreAuthorize("@el.check()")
public ResponseEntity<Object> queryOnlineUser(String filter, Pageable pageable){
return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
public ResponseEntity<PageResult<OnlineUserDto>> queryOnlineUser(String username, Pageable pageable){
return new ResponseEntity<>(onlineUserService.getAll(username, pageable),HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check()")
public void exportOnlineUser(HttpServletResponse response, String filter) throws IOException {
onlineUserService.download(onlineUserService.getAll(filter), response);
public void exportOnlineUser(HttpServletResponse response, String username) throws IOException {
onlineUserService.download(onlineUserService.getAll(username), response);
}
@ApiOperation("踢出用户")

View File

@ -70,7 +70,8 @@ public class TokenFilter extends GenericFilterBean {
OnlineUserDto onlineUserDto = null;
boolean cleanUserCache = false;
try {
onlineUserDto = onlineUserService.getOne(properties.getOnlineKey() + token);
String loginKey = tokenProvider.loginKey(token);
onlineUserDto = onlineUserService.getOne(loginKey);
} catch (ExpiredJwtException e) {
log.error(e.getMessage());
cleanUserCache = true;

View File

@ -18,6 +18,7 @@ package me.zhengjie.modules.security.security;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.DigestUtil;
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
@ -120,4 +121,15 @@ public class TokenProvider implements InitializingBean {
}
return null;
}
/**
* RedisKey
* @param token /
* @return key
*/
public String loginKey(String token) {
Claims claims = getClaims(token);
String md5Token = DigestUtil.md5Hex(token);
return properties.getOnlineKey() + claims.getSubject() + "-" + md5Token;
}
}

View File

@ -15,7 +15,10 @@
*/
package me.zhengjie.modules.security.service;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.security.security.TokenProvider;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.security.config.bean.SecurityProperties;
import me.zhengjie.modules.security.service.dto.JwtUserDto;
import me.zhengjie.modules.security.service.dto.OnlineUserDto;
@ -27,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* @author Zheng Jie
@ -34,16 +38,13 @@ import java.util.*;
*/
@Service
@Slf4j
@AllArgsConstructor
public class OnlineUserService {
private final SecurityProperties properties;
private final TokenProvider tokenProvider;
private final RedisUtils redisUtils;
public OnlineUserService(SecurityProperties properties, RedisUtils redisUtils) {
this.properties = properties;
this.redisUtils = redisUtils;
}
/**
* 线
* @param jwtUserDto /
@ -61,62 +62,49 @@ public class OnlineUserService {
} catch (Exception e) {
log.error(e.getMessage(),e);
}
redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds()/1000);
String loginKey = tokenProvider.loginKey(token);
redisUtils.set(loginKey, onlineUserDto, properties.getTokenValidityInSeconds(), TimeUnit.MILLISECONDS);
}
/**
*
* @param filter /
* @param username /
* @param pageable /
* @return /
*/
public Map<String,Object> getAll(String filter, Pageable pageable){
List<OnlineUserDto> onlineUserDtos = getAll(filter);
public PageResult<OnlineUserDto> getAll(String username, Pageable pageable){
List<OnlineUserDto> onlineUserDtos = getAll(username);
return PageUtil.toPage(
PageUtil.toPage(pageable.getPageNumber(),pageable.getPageSize(), onlineUserDtos),
PageUtil.paging(pageable.getPageNumber(),pageable.getPageSize(), onlineUserDtos),
onlineUserDtos.size()
);
}
/**
*
* @param filter /
* @param username /
* @return /
*/
public List<OnlineUserDto> getAll(String filter){
List<String> keys = redisUtils.scan(properties.getOnlineKey() + "*");
public List<OnlineUserDto> getAll(String username){
String loginKey = properties.getOnlineKey() +
(StringUtils.isBlank(username) ? "" : "*" + username);
List<String> keys = redisUtils.scan(loginKey + "*");
Collections.reverse(keys);
List<OnlineUserDto> onlineUserDtos = new ArrayList<>();
for (String key : keys) {
OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key);
if(StringUtils.isNotBlank(filter)){
if(onlineUserDto.toString().contains(filter)){
onlineUserDtos.add(onlineUserDto);
}
} else {
onlineUserDtos.add(onlineUserDto);
}
onlineUserDtos.add((OnlineUserDto) redisUtils.get(key));
}
onlineUserDtos.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime()));
return onlineUserDtos;
}
/**
*
* @param key /
*/
public void kickOut(String key){
key = properties.getOnlineKey() + key;
redisUtils.del(key);
}
/**
* 退
* @param token /
*/
public void logout(String token) {
String key = properties.getOnlineKey() + token;
redisUtils.del(key);
String loginKey = tokenProvider.loginKey(token);
redisUtils.del(loginKey);
}
/**
@ -149,43 +137,13 @@ public class OnlineUserService {
return (OnlineUserDto)redisUtils.get(key);
}
/**
* 线
* @param userName
*/
public void checkLoginOnUser(String userName, String igoreToken){
List<OnlineUserDto> onlineUserDtos = getAll(userName);
if(onlineUserDtos ==null || onlineUserDtos.isEmpty()){
return;
}
for(OnlineUserDto onlineUserDto : onlineUserDtos){
if(onlineUserDto.getUserName().equals(userName)){
try {
String token =EncryptUtils.desDecrypt(onlineUserDto.getKey());
if(StringUtils.isNotBlank(igoreToken)&&!igoreToken.equals(token)){
this.kickOut(token);
}else if(StringUtils.isBlank(igoreToken)){
this.kickOut(token);
}
} catch (Exception e) {
log.error("checkUser is error",e);
}
}
}
}
/**
* 退
* @param username /
*/
@Async
public void kickOutForUsername(String username) throws Exception {
List<OnlineUserDto> onlineUsers = getAll(username);
for (OnlineUserDto onlineUser : onlineUsers) {
if (onlineUser.getUserName().equals(username)) {
String token =EncryptUtils.desDecrypt(onlineUser.getKey());
kickOut(token);
}
}
public void kickOutForUsername(String username) {
String loginKey = properties.getOnlineKey() + username + "*";
redisUtils.scanDel(loginKey);
}
}

View File

@ -46,7 +46,7 @@ public class UserCacheManager {
public JwtUserDto getUserCache(String userName) {
if (StringUtils.isNotEmpty(userName)) {
// 获取数据
Object obj = redisUtils.hget(LoginProperties.cacheKey, userName);
Object obj = redisUtils.get(LoginProperties.cacheKey + userName);
if(obj != null){
return (JwtUserDto)obj;
}
@ -63,7 +63,7 @@ public class UserCacheManager {
if (StringUtils.isNotEmpty(userName)) {
// 添加数据, 避免数据同时过期
long time = idleTime + RandomUtil.randomInt(900, 1800);
redisUtils.hset(LoginProperties.cacheKey, userName, user, time);
redisUtils.set(LoginProperties.cacheKey + userName, user, time);
}
}
@ -76,7 +76,7 @@ public class UserCacheManager {
public void cleanUserCache(String userName) {
if (StringUtils.isNotEmpty(userName)) {
// 清除数据
redisUtils.hdel(LoginProperties.cacheKey, userName);
redisUtils.del(LoginProperties.cacheKey + userName);
}
}
}

View File

@ -25,6 +25,7 @@ import me.zhengjie.modules.system.domain.Dept;
import me.zhengjie.modules.system.service.DeptService;
import me.zhengjie.modules.system.service.dto.DeptDto;
import me.zhengjie.modules.system.service.dto.DeptQueryCriteria;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.PageUtil;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -57,22 +58,22 @@ public class DeptController {
@ApiOperation("查询部门")
@GetMapping
@PreAuthorize("@el.check('user:list','dept:list')")
public ResponseEntity<Object> queryDept(DeptQueryCriteria criteria) throws Exception {
List<DeptDto> deptDtos = deptService.queryAll(criteria, true);
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
public ResponseEntity<PageResult<DeptDto>> queryDept(DeptQueryCriteria criteria) throws Exception {
List<DeptDto> depts = deptService.queryAll(criteria, true);
return new ResponseEntity<>(PageUtil.toPage(depts, depts.size()),HttpStatus.OK);
}
@ApiOperation("查询部门:根据ID获取同级与上级数据")
@PostMapping("/superior")
@PreAuthorize("@el.check('user:list','dept:list')")
public ResponseEntity<Object> getDeptSuperior(@RequestBody List<Long> ids) {
Set<DeptDto> deptDtos = new LinkedHashSet<>();
Set<DeptDto> deptSet = new LinkedHashSet<>();
for (Long id : ids) {
DeptDto deptDto = deptService.findById(id);
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
deptDtos.addAll(depts);
deptSet.addAll(depts);
}
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptDtos)),HttpStatus.OK);
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK);
}
@Log("新增部门")

View File

@ -22,7 +22,10 @@ import me.zhengjie.annotation.Log;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.service.DictService;
import me.zhengjie.modules.system.service.dto.DictDto;
import me.zhengjie.modules.system.service.dto.DictQueryCriteria;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.PageUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -31,6 +34,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Set;
/**
@ -56,14 +60,14 @@ public class DictController {
@ApiOperation("查询字典")
@GetMapping(value = "/all")
@PreAuthorize("@el.check('dict:list')")
public ResponseEntity<Object> queryAllDict(){
public ResponseEntity<List<DictDto>> queryAllDict(){
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
}
@ApiOperation("查询字典")
@GetMapping
@PreAuthorize("@el.check('dict:list')")
public ResponseEntity<Object> queryDict(DictQueryCriteria resources, Pageable pageable){
public ResponseEntity<PageResult<DictDto>> queryDict(DictQueryCriteria resources, Pageable pageable){
return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK);
}

View File

@ -24,6 +24,7 @@ import me.zhengjie.modules.system.domain.DictDetail;
import me.zhengjie.modules.system.service.DictDetailService;
import me.zhengjie.modules.system.service.dto.DictDetailDto;
import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
@ -51,8 +52,8 @@ public class DictDetailController {
@ApiOperation("查询字典详情")
@GetMapping
public ResponseEntity<Object> queryDictDetail(DictDetailQueryCriteria criteria,
@PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){
public ResponseEntity<PageResult<DictDetailDto>> queryDictDetail(DictDetailQueryCriteria criteria,
@PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){
return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -22,7 +22,9 @@ import me.zhengjie.annotation.Log;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.Job;
import me.zhengjie.modules.system.service.JobService;
import me.zhengjie.modules.system.service.dto.JobDto;
import me.zhengjie.modules.system.service.dto.JobQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -56,7 +58,7 @@ public class JobController {
@ApiOperation("查询岗位")
@GetMapping
@PreAuthorize("@el.check('job:list','user:list')")
public ResponseEntity<Object> queryJob(JobQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<JobDto>> queryJob(JobQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK);
}

View File

@ -22,10 +22,12 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.system.domain.Menu;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.vo.MenuVo;
import me.zhengjie.modules.system.service.MenuService;
import me.zhengjie.modules.system.service.dto.MenuDto;
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
import me.zhengjie.modules.system.service.mapstruct.MenuMapper;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.http.HttpStatus;
@ -61,16 +63,16 @@ public class MenuController {
@GetMapping(value = "/build")
@ApiOperation("获取前端所需菜单")
public ResponseEntity<Object> buildMenus(){
public ResponseEntity<List<MenuVo>> buildMenus(){
List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId());
List<MenuDto> menuDtos = menuService.buildTree(menuDtoList);
return new ResponseEntity<>(menuService.buildMenus(menuDtos),HttpStatus.OK);
List<MenuDto> menus = menuService.buildTree(menuDtoList);
return new ResponseEntity<>(menuService.buildMenus(menus),HttpStatus.OK);
}
@ApiOperation("返回全部的菜单")
@GetMapping(value = "/lazy")
@PreAuthorize("@el.check('menu:list','roles:list')")
public ResponseEntity<Object> queryAllMenu(@RequestParam Long pid){
public ResponseEntity<List<MenuDto>> queryAllMenu(@RequestParam Long pid){
return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK);
}
@ -89,7 +91,7 @@ public class MenuController {
@GetMapping
@ApiOperation("查询菜单")
@PreAuthorize("@el.check('menu:list')")
public ResponseEntity<Object> queryMenu(MenuQueryCriteria criteria) throws Exception {
public ResponseEntity<PageResult<MenuDto>> queryMenu(MenuQueryCriteria criteria) throws Exception {
List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK);
}
@ -97,7 +99,7 @@ public class MenuController {
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
@PostMapping("/superior")
@PreAuthorize("@el.check('menu:list')")
public ResponseEntity<Object> getMenuSuperior(@RequestBody List<Long> ids) {
public ResponseEntity<List<MenuDto>> getMenuSuperior(@RequestBody List<Long> ids) {
Set<MenuDto> menuDtos = new LinkedHashSet<>();
if(CollectionUtil.isNotEmpty(ids)){
for (Long id : ids) {

View File

@ -26,6 +26,7 @@ import me.zhengjie.modules.system.service.RoleService;
import me.zhengjie.modules.system.service.dto.RoleDto;
import me.zhengjie.modules.system.service.dto.RoleQueryCriteria;
import me.zhengjie.modules.system.service.dto.RoleSmallDto;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@ -57,7 +58,7 @@ public class RoleController {
@ApiOperation("获取单个role")
@GetMapping(value = "/{id}")
@PreAuthorize("@el.check('roles:list')")
public ResponseEntity<Object> findRoleById(@PathVariable Long id){
public ResponseEntity<RoleDto> findRoleById(@PathVariable Long id){
return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
}
@ -71,14 +72,14 @@ public class RoleController {
@ApiOperation("返回全部的角色")
@GetMapping(value = "/all")
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
public ResponseEntity<Object> queryAllRole(){
public ResponseEntity<List<RoleDto>> queryAllRole(){
return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK);
}
@ApiOperation("查询角色")
@GetMapping
@PreAuthorize("@el.check('roles:list')")
public ResponseEntity<Object> queryRole(RoleQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<RoleDto>> queryRole(RoleQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -20,6 +20,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.utils.PageResult;
import me.zhengjie.config.RsaProperties;
import me.zhengjie.modules.system.domain.Dept;
import me.zhengjie.modules.system.service.DataService;
@ -77,7 +78,7 @@ public class UserController {
@ApiOperation("查询用户")
@GetMapping
@PreAuthorize("@el.check('user:list')")
public ResponseEntity<Object> queryUser(UserQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<UserDto>> queryUser(UserQueryCriteria criteria, Pageable pageable){
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
criteria.getDeptIds().add(criteria.getDeptId());
// 先查找是否存在子节点
@ -99,7 +100,7 @@ public class UserController {
criteria.getDeptIds().addAll(dataScopes);
return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK);
}
return new ResponseEntity<>(PageUtil.toPage(null,0),HttpStatus.OK);
return new ResponseEntity<>(PageUtil.noData(),HttpStatus.OK);
}
@Log("新增用户")

View File

@ -111,8 +111,8 @@ public interface DeptService {
/**
*
* @param deptList
* @return
* @param deptList /
* @return /
*/
List<Long> getDeptChildren(List<Dept> deptList);

View File

@ -15,12 +15,12 @@
*/
package me.zhengjie.modules.system.service;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.DictDetail;
import me.zhengjie.modules.system.service.dto.DictDetailDto;
import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Zheng Jie
@ -52,7 +52,7 @@ public interface DictDetailService {
* @param pageable
* @return /
*/
Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable);
PageResult<DictDetailDto> queryAll(DictDetailQueryCriteria criteria, Pageable pageable);
/**
*
@ -60,4 +60,4 @@ public interface DictDetailService {
* @return /
*/
List<DictDetailDto> getDictByName(String name);
}
}

View File

@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.system.service;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.service.dto.DictDto;
import me.zhengjie.modules.system.service.dto.DictQueryCriteria;
@ -22,7 +23,6 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -37,7 +37,7 @@ public interface DictService {
* @param pageable
* @return /
*/
Map<String,Object> queryAll(DictQueryCriteria criteria, Pageable pageable);
PageResult<DictDto> queryAll(DictQueryCriteria criteria, Pageable pageable);
/**
*
@ -72,4 +72,4 @@ public interface DictService {
* @throws IOException /
*/
void download(List<DictDto> queryAll, HttpServletResponse response) throws IOException;
}
}

View File

@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.system.service;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.Job;
import me.zhengjie.modules.system.service.dto.JobDto;
import me.zhengjie.modules.system.service.dto.JobQueryCriteria;
@ -22,7 +23,6 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -63,7 +63,7 @@ public interface JobService {
* @param pageable
* @return /
*/
Map<String,Object> queryAll(JobQueryCriteria criteria, Pageable pageable);
PageResult<JobDto> queryAll(JobQueryCriteria criteria, Pageable pageable);
/**
*
@ -85,4 +85,4 @@ public interface JobService {
* @param ids /
*/
void verification(Set<Long> ids);
}
}

View File

@ -16,6 +16,7 @@
package me.zhengjie.modules.system.service;
import me.zhengjie.modules.system.domain.Menu;
import me.zhengjie.modules.system.domain.vo.MenuVo;
import me.zhengjie.modules.system.service.dto.MenuDto;
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
@ -78,7 +79,7 @@ public interface MenuService {
* @param menuDtos /
* @return /
*/
Object buildMenus(List<MenuDto> menuDtos);
List<MenuVo> buildMenus(List<MenuDto> menuDtos);
/**
* ID

View File

@ -21,6 +21,7 @@ import me.zhengjie.modules.system.service.dto.RoleDto;
import me.zhengjie.modules.system.service.dto.RoleQueryCriteria;
import me.zhengjie.modules.system.service.dto.RoleSmallDto;
import me.zhengjie.modules.system.service.dto.UserDto;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -97,7 +98,7 @@ public interface RoleService {
* @param pageable
* @return /
*/
Object queryAll(RoleQueryCriteria criteria, Pageable pageable);
PageResult<RoleDto> queryAll(RoleQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.system.service;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.service.dto.UserDto;
import me.zhengjie.modules.system.service.dto.UserLoginDto;
@ -100,7 +101,7 @@ public interface UserService {
* @param pageable
* @return /
*/
Object queryAll(UserQueryCriteria criteria, Pageable pageable);
PageResult<UserDto> queryAll(UserQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -65,7 +65,7 @@ public class DataServiceImpl implements DataService {
deptIds.addAll(getCustomize(deptIds, role));
break;
default:
return new ArrayList<>(deptIds);
return new ArrayList<>();
}
}
return new ArrayList<>(deptIds);

View File

@ -16,6 +16,7 @@
package me.zhengjie.modules.system.service.impl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.domain.DictDetail;
import me.zhengjie.modules.system.repository.DictRepository;
@ -32,7 +33,6 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* @author Zheng Jie
@ -49,7 +49,7 @@ public class DictDetailServiceImpl implements DictDetailService {
private final RedisUtils redisUtils;
@Override
public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
public PageResult<DictDetailDto> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
Page<DictDetail> page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(dictDetailMapper::toDto));
}
@ -92,4 +92,4 @@ public class DictDetailServiceImpl implements DictDetailService {
Dict dict = dictRepository.findById(dictDetail.getDict().getId()).orElseGet(Dict::new);
redisUtils.del(CacheKey.DICT_NAME + dict.getName());
}
}
}

View File

@ -17,6 +17,7 @@ package me.zhengjie.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.utils.PageResult;
import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.service.dto.DictDetailDto;
import me.zhengjie.modules.system.service.dto.DictQueryCriteria;
@ -48,7 +49,7 @@ public class DictServiceImpl implements DictService {
private final RedisUtils redisUtils;
@Override
public Map<String, Object> queryAll(DictQueryCriteria dict, Pageable pageable){
public PageResult<DictDto> queryAll(DictQueryCriteria dict, Pageable pageable){
Page<Dict> page = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb), pageable);
return PageUtil.toPage(page.map(dictMapper::toDto));
}
@ -118,4 +119,4 @@ public class DictServiceImpl implements DictService {
public void delCaches(Dict dict){
redisUtils.del(CacheKey.DICT_NAME + dict.getName());
}
}
}

View File

@ -16,6 +16,7 @@
package me.zhengjie.modules.system.service.impl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.utils.PageResult;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.exception.EntityExistException;
import me.zhengjie.modules.system.domain.Job;
@ -52,7 +53,7 @@ public class JobServiceImpl implements JobService {
private final UserRepository userRepository;
@Override
public Map<String,Object> queryAll(JobQueryCriteria criteria, Pageable pageable) {
public PageResult<JobDto> queryAll(JobQueryCriteria criteria, Pageable pageable) {
Page<Job> page = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(jobMapper::toDto).getContent(),page.getTotalElements());
}
@ -122,4 +123,4 @@ public class JobServiceImpl implements JobService {
throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
}
}
}
}

View File

@ -74,7 +74,7 @@ public class RoleServiceImpl implements RoleService {
}
@Override
public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) {
public PageResult<RoleDto> queryAll(RoleQueryCriteria criteria, Pageable pageable) {
Page<Role> page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return PageUtil.toPage(page.map(roleMapper::toDto));
}

View File

@ -16,6 +16,7 @@
package me.zhengjie.modules.system.service.impl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.utils.PageResult;
import me.zhengjie.config.FileProperties;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.security.service.OnlineUserService;
@ -61,7 +62,7 @@ public class UserServiceImpl implements UserService {
private final UserLoginMapper userLoginMapper;
@Override
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
public PageResult<UserDto> queryAll(UserQueryCriteria criteria, Pageable pageable) {
Page<User> page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return PageUtil.toPage(page.map(userMapper::toDto));
}

View File

@ -51,7 +51,7 @@ public class VerifyServiceImpl implements VerifyService {
String redisKey = key + email;
// 如果不存在有效的验证码,就创建一个新的
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
Template template = engine.getTemplate("email/email.ftl");
Template template = engine.getTemplate("email.ftl");
Object oldCode = redisUtils.get(redisKey);
if(oldCode == null){
String code = RandomUtil.randomNumbers (6);

View File

@ -56,7 +56,7 @@ login:
# Redis用户登录缓存配置
user-cache:
# 存活时间/秒
idle-time: 7200
idle-time: 21600
# 验证码
login-code:
# 验证码类型配置 查看 LoginProperties 类
@ -84,9 +84,9 @@ jwt:
# 令牌过期时间 此处单位/毫秒 默认4小时可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
token-validity-in-seconds: 14400000
# 在线用户key
online-key: online-token-
online-key: "online-token:"
# 验证码
code-key: code-key-
code-key: "captcha-code:"
# token 续期检查时间范围默认30分钟单位毫秒在token即将过期的一段时间内用户操作了则给用户的token续期
detect: 1800000
# 续期时间范围默认1小时单位毫秒

View File

@ -58,7 +58,7 @@ login:
# Redis用户登录缓存配置
user-cache:
# 存活时间/秒
idle-time: 7200
idle-time: 21600
# 验证码
login-code:
# 验证码类型配置 查看 LoginProperties 类
@ -86,9 +86,9 @@ jwt:
# 令牌过期时间 此处单位/毫秒 默认2小时可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
token-validity-in-seconds: 7200000
# 在线用户key
online-key: online-token-
online-key: "online-token:"
# 验证码
code-key: code-key-
code-key: "captcha-code:"
# token 续期检查时间范围默认30分钟单位默认毫秒在token即将过期的一段时间内用户操作了则给用户的token续期
detect: 1800000
# 续期时间范围,默认 1小时这里单位毫秒

View File

@ -41,7 +41,7 @@ public class EmailController {
private final EmailService emailService;
@GetMapping
public ResponseEntity<Object> queryEmailConfig(){
public ResponseEntity<EmailConfig> queryEmailConfig(){
return new ResponseEntity<>(emailService.find(),HttpStatus.OK);
}

View File

@ -20,8 +20,10 @@ import me.zhengjie.annotation.Log;
import me.zhengjie.domain.LocalStorage;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.service.LocalStorageService;
import me.zhengjie.service.dto.LocalStorageDto;
import me.zhengjie.service.dto.LocalStorageQueryCriteria;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -48,7 +50,7 @@ public class LocalStorageController {
@GetMapping
@ApiOperation("查询文件")
@PreAuthorize("@el.check('storage:list')")
public ResponseEntity<Object> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<LocalStorageDto>> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -69,7 +71,7 @@ public class LocalStorageController {
@ApiOperation("上传图片")
@PostMapping("/pictures")
public ResponseEntity<Object> uploadPicture(@RequestParam MultipartFile file){
public ResponseEntity<LocalStorage> uploadPicture(@RequestParam MultipartFile file){
// 判断文件是否为图片
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){

View File

@ -24,6 +24,7 @@ import me.zhengjie.domain.QiniuConfig;
import me.zhengjie.domain.QiniuContent;
import me.zhengjie.service.dto.QiniuQueryCriteria;
import me.zhengjie.service.QiNiuService;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -50,7 +51,7 @@ public class QiniuController {
private final QiNiuService qiNiuService;
@GetMapping(value = "/config")
public ResponseEntity<Object> queryQiNiuConfig(){
public ResponseEntity<QiniuConfig> queryQiNiuConfig(){
return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK);
}
@ -71,7 +72,7 @@ public class QiniuController {
@ApiOperation("查询文件")
@GetMapping
public ResponseEntity<Object> queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){
public ResponseEntity<PageResult<QiniuContent>> queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK);
}

View File

@ -43,7 +43,6 @@ public interface EmailService {
*
* @param emailVo
* @param emailConfig
* @throws Exception /
*/
void send(EmailVo emailVo, EmailConfig emailConfig);
}

View File

@ -18,6 +18,7 @@ package me.zhengjie.service;
import me.zhengjie.domain.LocalStorage;
import me.zhengjie.service.dto.LocalStorageDto;
import me.zhengjie.service.dto.LocalStorageQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@ -36,7 +37,7 @@ public interface LocalStorageService {
* @param pageable
* @return /
*/
Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable);
PageResult<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -18,6 +18,7 @@ package me.zhengjie.service;
import me.zhengjie.domain.QiniuConfig;
import me.zhengjie.domain.QiniuContent;
import me.zhengjie.service.dto.QiniuQueryCriteria;
import me.zhengjie.utils.PageResult;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
@ -50,7 +51,7 @@ public interface QiNiuService {
* @param pageable
* @return /
*/
Object queryAll(QiniuQueryCriteria criteria, Pageable pageable);
PageResult<QiniuContent> queryAll(QiniuQueryCriteria criteria, Pageable pageable);
/**
*

View File

@ -52,7 +52,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
private final FileProperties properties;
@Override
public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){
public PageResult<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){
Page<LocalStorage> page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(localStorageMapper::toDto));
}

View File

@ -29,14 +29,10 @@ 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.utils.*;
import me.zhengjie.exception.BadRequestException;
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;
import me.zhengjie.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
@ -84,7 +80,7 @@ public class QiNiuServiceImpl implements QiNiuService {
}
@Override
public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){
public PageResult<QiniuContent> queryAll(QiniuQueryCriteria criteria, Pageable pageable){
return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
}

View File

@ -51,7 +51,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--Spring boot 测试-->

View File

@ -23,7 +23,7 @@ SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `code_column_config`;
CREATE TABLE `code_column_config` (
`column_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`table_name` varchar(255) DEFAULT NULL,
`table_name` varchar(180) DEFAULT NULL,
`column_name` varchar(255) DEFAULT NULL,
`column_type` varchar(255) DEFAULT NULL,
`dict_name` varchar(255) DEFAULT NULL,
@ -35,10 +35,9 @@ CREATE TABLE `code_column_config` (
`not_null` bit(1) DEFAULT NULL,
`query_type` varchar(255) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`date_annotation` varchar(255) DEFAULT NULL,
PRIMARY KEY (`column_id`) USING BTREE,
KEY `idx_table_name` (`table_name`)
) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成字段信息存储';
) ENGINE=InnoDB AUTO_INCREMENT=191 ROW_FORMAT=COMPACT COMMENT='代码生成字段信息存储';
-- ----------------------------
-- Table structure for code_gen_config
@ -55,9 +54,10 @@ CREATE TABLE `code_gen_config` (
`api_path` varchar(255) DEFAULT NULL COMMENT '前端Api文件路径',
`prefix` varchar(255) DEFAULT NULL COMMENT '表前缀',
`api_alias` varchar(255) DEFAULT NULL COMMENT '接口名称',
`date_annotation` varchar(255) DEFAULT NULL,
PRIMARY KEY (`config_id`) USING BTREE,
KEY `idx_table_name` (`table_name`(100))
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成器配置';
) ENGINE=InnoDB AUTO_INCREMENT=7 ROW_FORMAT=COMPACT COMMENT='代码生成器配置';
-- ----------------------------
-- Table structure for mnt_app
@ -77,7 +77,7 @@ CREATE TABLE `mnt_app` (
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='应用管理';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='应用管理';
-- ----------------------------
-- Records of mnt_app
@ -100,7 +100,7 @@ CREATE TABLE `mnt_database` (
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`db_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='数据库管理';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='数据库管理';
-- ----------------------------
-- Records of mnt_database
@ -121,7 +121,7 @@ CREATE TABLE `mnt_deploy` (
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`deploy_id`) USING BTREE,
KEY `FK6sy157pseoxx4fmcqr1vnvvhy` (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部署管理';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='部署管理';
-- ----------------------------
-- Records of mnt_deploy
@ -141,7 +141,7 @@ CREATE TABLE `mnt_deploy_history` (
`ip` varchar(20) NOT NULL COMMENT '服务器IP',
`deploy_id` bigint(20) DEFAULT NULL COMMENT '部署编号',
PRIMARY KEY (`history_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部署历史管理';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='部署历史管理';
-- ----------------------------
-- Records of mnt_deploy_history
@ -158,7 +158,7 @@ CREATE TABLE `mnt_deploy_server` (
`server_id` bigint(20) NOT NULL COMMENT '服务ID',
PRIMARY KEY (`deploy_id`,`server_id`) USING BTREE,
KEY `FKeaaha7jew9a02b3bk9ghols53` (`server_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='应用与服务器关联';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='应用与服务器关联';
-- ----------------------------
-- Records of mnt_deploy_server
@ -183,7 +183,7 @@ CREATE TABLE `mnt_server` (
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`server_id`) USING BTREE,
KEY `idx_ip` (`ip`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='服务器管理';
) ENGINE=InnoDB AUTO_INCREMENT=2 ROW_FORMAT=COMPACT COMMENT='服务器管理';
-- ----------------------------
-- Table structure for sys_dept
@ -203,7 +203,7 @@ CREATE TABLE `sys_dept` (
PRIMARY KEY (`dept_id`) USING BTREE,
KEY `inx_pid` (`pid`),
KEY `inx_enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门';
) ENGINE=InnoDB AUTO_INCREMENT=18 ROW_FORMAT=COMPACT COMMENT='部门';
-- ----------------------------
-- Records of sys_dept
@ -231,7 +231,7 @@ CREATE TABLE `sys_dict` (
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`dict_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='数据字典';
) ENGINE=InnoDB AUTO_INCREMENT=6 ROW_FORMAT=COMPACT COMMENT='数据字典';
-- ----------------------------
-- Records of sys_dict
@ -258,7 +258,7 @@ CREATE TABLE `sys_dict_detail` (
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`detail_id`) USING BTREE,
KEY `FK5tpkputc6d9nboxojdbgnpmyb` (`dict_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='数据字典详情';
) ENGINE=InnoDB AUTO_INCREMENT=7 ROW_FORMAT=COMPACT COMMENT='数据字典详情';
-- ----------------------------
-- Records of sys_dict_detail
@ -278,7 +278,7 @@ COMMIT;
DROP TABLE IF EXISTS `sys_job`;
CREATE TABLE `sys_job` (
`job_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT NULL COMMENT '岗位名称',
`name` varchar(180) NOT NULL COMMENT '岗位名称',
`enabled` bit(1) NOT NULL COMMENT '岗位状态',
`job_sort` int(5) DEFAULT NULL COMMENT '排序',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建者',
@ -288,7 +288,7 @@ CREATE TABLE `sys_job` (
PRIMARY KEY (`job_id`) USING BTREE,
UNIQUE KEY `uniq_name` (`name`),
KEY `inx_enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='岗位';
) ENGINE=InnoDB AUTO_INCREMENT=13 ROW_FORMAT=COMPACT COMMENT='岗位';
-- ----------------------------
-- Records of sys_job
@ -307,7 +307,7 @@ DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`description` varchar(255) DEFAULT NULL,
`log_type` varchar(255) DEFAULT NULL,
`log_type` varchar(10) DEFAULT NULL,
`method` varchar(255) DEFAULT NULL,
`params` text DEFAULT NULL,
`request_ip` varchar(255) DEFAULT NULL,
@ -320,7 +320,7 @@ CREATE TABLE `sys_log` (
PRIMARY KEY (`log_id`) USING BTREE,
KEY `log_create_time_index` (`create_time`),
KEY `inx_log_type` (`log_type`)
) ENGINE=InnoDB AUTO_INCREMENT=3537 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志';
) ENGINE=InnoDB AUTO_INCREMENT=3537 ROW_FORMAT=COMPACT COMMENT='系统日志';
-- ----------------------------
-- Table structure for sys_menu
@ -331,8 +331,8 @@ CREATE TABLE `sys_menu` (
`pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID',
`sub_count` int(5) DEFAULT 0 COMMENT '子菜单数目',
`type` int(11) DEFAULT NULL COMMENT '菜单类型',
`title` varchar(255) DEFAULT NULL COMMENT '菜单标题',
`name` varchar(255) DEFAULT NULL COMMENT '组件名称',
`title` varchar(100) DEFAULT NULL COMMENT '菜单标题',
`name` varchar(100) DEFAULT NULL COMMENT '组件名称',
`component` varchar(255) DEFAULT NULL COMMENT '组件',
`menu_sort` int(5) DEFAULT NULL COMMENT '排序',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
@ -349,7 +349,7 @@ CREATE TABLE `sys_menu` (
UNIQUE KEY `uniq_title` (`title`),
UNIQUE KEY `uniq_name` (`name`),
KEY `inx_pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单';
) ENGINE=InnoDB AUTO_INCREMENT=118 ROW_FORMAT=COMPACT COMMENT='系统菜单';
-- ----------------------------
-- Records of sys_menu
@ -456,7 +456,7 @@ CREATE TABLE `sys_quartz_job` (
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`job_id`) USING BTREE,
KEY `inx_is_pause` (`is_pause`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务';
) ENGINE=InnoDB AUTO_INCREMENT=7 ROW_FORMAT=COMPACT COMMENT='定时任务';
-- ----------------------------
-- Records of sys_quartz_job
@ -484,7 +484,7 @@ CREATE TABLE `sys_quartz_log` (
`params` varchar(255) DEFAULT NULL,
`time` bigint(20) DEFAULT NULL,
PRIMARY KEY (`log_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=151 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
) ENGINE=InnoDB AUTO_INCREMENT=151 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
-- ----------------------------
-- Table structure for sys_role
@ -492,8 +492,8 @@ CREATE TABLE `sys_quartz_log` (
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT NULL COMMENT '名称',
`level` int(255) DEFAULT NULL COMMENT '角色级别',
`name` varchar(100) NOT NULL COMMENT '名称',
`level` int(50) DEFAULT NULL COMMENT '角色级别',
`description` varchar(255) DEFAULT NULL COMMENT '描述',
`data_scope` varchar(255) DEFAULT NULL COMMENT '数据权限',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建者',
@ -503,7 +503,7 @@ CREATE TABLE `sys_role` (
PRIMARY KEY (`role_id`) USING BTREE,
UNIQUE KEY `uniq_name` (`name`),
KEY `role_name_index` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表';
) ENGINE=InnoDB AUTO_INCREMENT=3 ROW_FORMAT=COMPACT COMMENT='角色表';
-- ----------------------------
-- Records of sys_role
@ -522,7 +522,7 @@ CREATE TABLE `sys_roles_depts` (
`dept_id` bigint(20) NOT NULL,
PRIMARY KEY (`role_id`,`dept_id`) USING BTREE,
KEY `FK7qg6itn5ajdoa9h9o78v9ksur` (`dept_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色部门关联';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='角色部门关联';
-- ----------------------------
-- Table structure for sys_roles_menus
@ -533,7 +533,7 @@ CREATE TABLE `sys_roles_menus` (
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
PRIMARY KEY (`menu_id`,`role_id`) USING BTREE,
KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色菜单关联';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='角色菜单关联';
-- ----------------------------
-- Records of sys_roles_menus
@ -649,11 +649,11 @@ DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门名称',
`username` varchar(255) DEFAULT NULL COMMENT '用户名',
`username` varchar(180) DEFAULT NULL COMMENT '用户名',
`nick_name` varchar(255) DEFAULT NULL COMMENT '昵称',
`gender` varchar(2) DEFAULT NULL COMMENT '性别',
`phone` varchar(255) DEFAULT NULL COMMENT '手机号码',
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
`email` varchar(180) DEFAULT NULL COMMENT '邮箱',
`avatar_name` varchar(255) DEFAULT NULL COMMENT '头像地址',
`avatar_path` varchar(255) DEFAULT NULL COMMENT '头像真实路径',
`password` varchar(255) DEFAULT NULL COMMENT '密码',
@ -670,9 +670,8 @@ CREATE TABLE `sys_user` (
UNIQUE KEY `uniq_username` (`username`),
UNIQUE KEY `uniq_email` (`email`),
KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`) USING BTREE,
KEY `FKpq2dhypk2qgt68nauh2by22jb` (`avatar_name`) USING BTREE,
KEY `inx_enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户';
) ENGINE=InnoDB AUTO_INCREMENT=3 ROW_FORMAT=COMPACT COMMENT='系统用户';
-- ----------------------------
-- Records of sys_user
@ -709,7 +708,7 @@ CREATE TABLE `sys_users_roles` (
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
PRIMARY KEY (`user_id`,`role_id`) USING BTREE,
KEY `FKq4eq273l04bpu4efj0jd0jb98` (`role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户角色关联';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='用户角色关联';
-- ----------------------------
-- Records of sys_users_roles
@ -736,7 +735,7 @@ CREATE TABLE `tool_alipay_config` (
`sign_type` varchar(255) DEFAULT NULL COMMENT '签名方式',
`sys_service_provider_id` varchar(255) DEFAULT NULL COMMENT '商户号',
PRIMARY KEY (`config_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='支付宝配置类';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='支付宝配置类';
-- ----------------------------
-- Records of tool_alipay_config
@ -757,7 +756,7 @@ CREATE TABLE `tool_email_config` (
`port` varchar(255) DEFAULT NULL COMMENT '端口',
`user` varchar(255) DEFAULT NULL COMMENT '发件者用户名',
PRIMARY KEY (`config_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='邮箱配置';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='邮箱配置';
-- ----------------------------
-- Table structure for tool_local_storage
@ -776,7 +775,7 @@ CREATE TABLE `tool_local_storage` (
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`storage_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='本地存储';
) ENGINE=InnoDB AUTO_INCREMENT=10 ROW_FORMAT=COMPACT COMMENT='本地存储';
-- ----------------------------
-- Records of tool_local_storage
@ -797,7 +796,7 @@ CREATE TABLE `tool_qiniu_config` (
`type` varchar(255) DEFAULT NULL COMMENT '空间类型',
`zone` varchar(255) DEFAULT NULL COMMENT '机房',
PRIMARY KEY (`config_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云配置';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='七牛云配置';
-- ----------------------------
-- Table structure for tool_qiniu_content
@ -806,7 +805,7 @@ DROP TABLE IF EXISTS `tool_qiniu_content`;
CREATE TABLE `tool_qiniu_content` (
`content_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`bucket` varchar(255) DEFAULT NULL COMMENT 'Bucket 识别符',
`name` varchar(255) DEFAULT NULL COMMENT '文件名称',
`name` varchar(180) DEFAULT NULL COMMENT '文件名称',
`size` varchar(255) DEFAULT NULL COMMENT '文件大小',
`type` varchar(255) DEFAULT NULL COMMENT '文件类型:私有或公开',
`url` varchar(255) DEFAULT NULL COMMENT '文件url',
@ -814,7 +813,7 @@ CREATE TABLE `tool_qiniu_content` (
`update_time` datetime DEFAULT NULL COMMENT '上传或同步的时间',
PRIMARY KEY (`content_id`) USING BTREE,
UNIQUE KEY `uniq_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
) ENGINE=InnoDB ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
-- ----------------------------
-- Records of tool_qiniu_content
@ -822,4 +821,4 @@ CREATE TABLE `tool_qiniu_content` (
BEGIN;
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 1;