mirror of https://github.com/elunez/eladmin
Merge branch 'master' of github.com:elunez/eladmin into refactor-deptService-deduplication
commit
e34550fea3
|
@ -3,3 +3,4 @@
|
|||
*.iml
|
||||
*/target/*
|
||||
*/*.iml
|
||||
/.gradle/
|
||||
|
|
19
README.md
19
README.md
|
@ -13,6 +13,8 @@
|
|||
|
||||
**开发文档:** [https://el-admin.vip](https://el-admin.vip)
|
||||
|
||||
**备用文档:** [https://doc.el-admin.xin](https://doc.el-admin.xin)
|
||||
|
||||
**体验地址:** [https://el-admin.xin](https://el-admin.xin)
|
||||
|
||||
**账号密码:** `admin / 123456`
|
||||
|
@ -48,7 +50,6 @@
|
|||
- 定时任务:整合Quartz做定时任务,加入任务日志,任务运行情况一目了然
|
||||
- 代码生成:高灵活度生成前后端代码,减少大量重复的工作任务
|
||||
- 邮件工具:配合富文本,发送html格式的邮件
|
||||
- 免费图床:使用sm.ms图床,用作公共图片上传使用,该图床不怎么稳定,不太建议使用
|
||||
- 七牛云存储:可同步七牛云存储的数据到系统,无需登录七牛云直接操作云数据
|
||||
- 支付宝支付:整合了支付宝支付并且提供了测试账号,可自行测试
|
||||
- 服务监控:监控服务器的负载情况
|
||||
|
@ -89,20 +90,20 @@
|
|||
#### 系统预览
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://img.el-admin.xin/20200605172248.png"/></td>
|
||||
<td><img src="https://img.el-admin.xin/20200605172339.png"/></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/image.png" alt="image.png" border="0" /></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/image1fdb6befae2368c8.png" alt="image1fdb6befae2368c8.png" border="0" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://img.el-admin.xin/20200605172432.png"/></td>
|
||||
<td><img src="https://img.el-admin.xin/20200605172455.png"/></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/image80b090dc27faea86.png" alt="image80b090dc27faea86.png" border="0" /></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/imagec7e0a6b8701cd890.png" alt="imagec7e0a6b8701cd890.png" border="0" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://img.el-admin.xin/20200605172536.png"/></td>
|
||||
<td><img src="https://img.el-admin.xin/20200605172558.png"/></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/imageff0d9e4ab8d3674c.png" alt="imageff0d9e4ab8d3674c.png" border="0" /></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/image923ef574ace41404.png" alt="image923ef574ace41404.png" border="0" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://img.el-admin.xin/20200605172645.png"/></td>
|
||||
<td><img src="https://img.el-admin.xin/20200605172715.png"/></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/imagef37b559927af1a10.png" alt="imagef37b559927af1a10.png" border="0" /></td>
|
||||
<td><img src="https://img.el-admin.vip/images/2020/09/05/imageabafc6a7f0522967.png" alt="imageabafc6a7f0522967.png" border="0" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
|
|
|
@ -41,8 +41,6 @@ public class ElAdminConstant {
|
|||
* 常用接口
|
||||
*/
|
||||
public static class Url {
|
||||
// 免费图床
|
||||
public static final String SM_MS_URL = "https://sm.ms/api";
|
||||
// IP归属地查询
|
||||
public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true";
|
||||
}
|
||||
|
|
|
@ -43,7 +43,9 @@ import java.util.Map;
|
|||
* @date 2018-12-27
|
||||
*/
|
||||
public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
||||
|
||||
/**
|
||||
* 系统临时目录
|
||||
* <br>
|
||||
|
@ -75,6 +77,13 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
*/
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
public static final String IMAGE = "图片";
|
||||
public static final String TXT = "文档";
|
||||
public static final String MUSIC = "音乐";
|
||||
public static final String VIDEO = "视频";
|
||||
public static final String OTHER = "其他";
|
||||
|
||||
|
||||
/**
|
||||
* MultipartFile转File
|
||||
*/
|
||||
|
@ -217,15 +226,15 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg";
|
||||
String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg";
|
||||
if (image.contains(type)) {
|
||||
return "图片";
|
||||
return IMAGE;
|
||||
} else if (documents.contains(type)) {
|
||||
return "文档";
|
||||
return TXT;
|
||||
} else if (music.contains(type)) {
|
||||
return "音乐";
|
||||
return MUSIC;
|
||||
} else if (video.contains(type)) {
|
||||
return "视频";
|
||||
return VIDEO;
|
||||
} else {
|
||||
return "其他";
|
||||
return OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-common</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--模板引擎-->
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-common</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-generator</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-tools</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring boot websocket -->
|
||||
|
|
|
@ -20,13 +20,15 @@ import com.alibaba.druid.pool.DruidDataSource;
|
|||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author /
|
||||
|
@ -36,20 +38,6 @@ public class SqlUtils {
|
|||
|
||||
public static final String COLON = ":";
|
||||
|
||||
private static volatile Map<String, DruidDataSource> map = new HashMap<>();
|
||||
|
||||
private static String getKey(String jdbcUrl, String username, String password) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!StringUtils.isEmpty(username)) {
|
||||
sb.append(username);
|
||||
}
|
||||
if (!StringUtils.isEmpty(password)) {
|
||||
sb.append(COLON).append(password);
|
||||
}
|
||||
sb.append(COLON).append(jdbcUrl.trim());
|
||||
|
||||
return SecureUtil.md5(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据源
|
||||
|
@ -60,55 +48,44 @@ public class SqlUtils {
|
|||
* @return DataSource
|
||||
*/
|
||||
private static DataSource getDataSource(String jdbcUrl, String userName, String password) {
|
||||
String key = getKey(jdbcUrl, userName, password);
|
||||
if (!map.containsKey(key) || null == map.get(key)) {
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
|
||||
String className;
|
||||
try {
|
||||
className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Get class name error: =" + jdbcUrl);
|
||||
}
|
||||
if (StringUtils.isEmpty(className)) {
|
||||
DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl);
|
||||
if (null == dataTypeEnum) {
|
||||
throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl);
|
||||
}
|
||||
druidDataSource.setDriverClassName(dataTypeEnum.getDriver());
|
||||
} else {
|
||||
druidDataSource.setDriverClassName(className);
|
||||
}
|
||||
|
||||
|
||||
druidDataSource.setUrl(jdbcUrl);
|
||||
druidDataSource.setUsername(userName);
|
||||
druidDataSource.setPassword(password);
|
||||
// 配置获取连接等待超时的时间
|
||||
druidDataSource.setMaxWait(3000);
|
||||
// 配置初始化大小、最小、最大
|
||||
druidDataSource.setInitialSize(1);
|
||||
druidDataSource.setMinIdle(1);
|
||||
druidDataSource.setMaxActive(1);
|
||||
|
||||
// 配置间隔多久才进行一次检测需要关闭的空闲连接,单位是毫秒
|
||||
druidDataSource.setTimeBetweenEvictionRunsMillis(50000);
|
||||
// 配置一旦重试多次失败后等待多久再继续重试连接,单位是毫秒
|
||||
druidDataSource.setTimeBetweenConnectErrorMillis(18000);
|
||||
// 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
druidDataSource.setMinEvictableIdleTimeMillis(300000);
|
||||
// 这个特性能解决 MySQL 服务器8小时关闭连接的问题
|
||||
druidDataSource.setMaxEvictableIdleTimeMillis(25200000);
|
||||
|
||||
try {
|
||||
druidDataSource.init();
|
||||
} catch (SQLException e) {
|
||||
log.error("Exception during pool initialization", e);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
map.put(key, druidDataSource);
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
String className;
|
||||
try {
|
||||
className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Get class name error: =" + jdbcUrl);
|
||||
}
|
||||
return map.get(key);
|
||||
if (StringUtils.isEmpty(className)) {
|
||||
DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl);
|
||||
if (null == dataTypeEnum) {
|
||||
throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl);
|
||||
}
|
||||
druidDataSource.setDriverClassName(dataTypeEnum.getDriver());
|
||||
} else {
|
||||
druidDataSource.setDriverClassName(className);
|
||||
}
|
||||
|
||||
|
||||
druidDataSource.setUrl(jdbcUrl);
|
||||
druidDataSource.setUsername(userName);
|
||||
druidDataSource.setPassword(password);
|
||||
// 配置获取连接等待超时的时间
|
||||
druidDataSource.setMaxWait(3000);
|
||||
// 配置初始化大小、最小、最大
|
||||
druidDataSource.setInitialSize(1);
|
||||
druidDataSource.setMinIdle(1);
|
||||
druidDataSource.setMaxActive(1);
|
||||
|
||||
// 如果链接出现异常则直接判定为失败而不是一直重试
|
||||
druidDataSource.setBreakAfterAcquireFailure(true);
|
||||
try {
|
||||
druidDataSource.init();
|
||||
} catch (SQLException e) {
|
||||
log.error("Exception during pool initialization", e);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
return druidDataSource;
|
||||
}
|
||||
|
||||
private static Connection getConnection(String jdbcUrl, String userName, String password) {
|
||||
|
@ -187,14 +164,14 @@ public class SqlUtils {
|
|||
* @param sqlList /
|
||||
*/
|
||||
public static void batchExecute(Connection connection, List<String> sqlList) throws SQLException {
|
||||
Statement st = connection.createStatement();
|
||||
for (String sql : sqlList) {
|
||||
if (sql.endsWith(";")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
st.addBatch(sql);
|
||||
Statement st = connection.createStatement();
|
||||
for (String sql : sqlList) {
|
||||
if (sql.endsWith(";")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
st.executeBatch();
|
||||
st.addBatch(sql);
|
||||
}
|
||||
st.executeBatch();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping;
|
|||
import me.zhengjie.annotation.rest.AnonymousPostMapping;
|
||||
import me.zhengjie.config.RsaProperties;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.security.config.bean.LoginCodeEnum;
|
||||
import me.zhengjie.modules.security.config.bean.LoginProperties;
|
||||
import me.zhengjie.modules.security.config.bean.SecurityProperties;
|
||||
import me.zhengjie.modules.security.security.TokenProvider;
|
||||
|
@ -119,8 +120,13 @@ public class AuthorizationController {
|
|||
// 获取运算的结果
|
||||
Captcha captcha = loginProperties.getCaptcha();
|
||||
String uuid = properties.getCodeKey() + IdUtil.simpleUUID();
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型
|
||||
String captchaValue = captcha.text();
|
||||
if (captcha.getCharType() - 1 == LoginCodeEnum.arithmetic.ordinal() && captchaValue.contains(".")) {
|
||||
captchaValue = captchaValue.split("\\.")[0];
|
||||
}
|
||||
// 保存
|
||||
redisUtils.set(uuid, captcha.text(), loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
|
||||
redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
|
||||
// 验证码信息
|
||||
Map<String, Object> imgResult = new HashMap<String, Object>(2) {{
|
||||
put("img", captcha.toBase64());
|
||||
|
|
|
@ -96,7 +96,6 @@ public class DeptServiceImpl implements DeptService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'pid:' + #p0")
|
||||
public List<Dept> findByPid(long pid) {
|
||||
return deptRepository.findByPid(pid);
|
||||
}
|
||||
|
@ -113,7 +112,6 @@ public class DeptServiceImpl implements DeptService {
|
|||
// 计算子节点数目
|
||||
resources.setSubCount(0);
|
||||
// 清理缓存
|
||||
redisUtils.del("dept::pid:" + (resources.getPid() == null ? 0 : resources.getPid()));
|
||||
updateSubCnt(resources.getPid());
|
||||
}
|
||||
|
||||
|
@ -134,7 +132,7 @@ public class DeptServiceImpl implements DeptService {
|
|||
updateSubCnt(oldPid);
|
||||
updateSubCnt(newPid);
|
||||
// 清理缓存
|
||||
delCaches(resources.getId(), oldPid, newPid);
|
||||
delCaches(resources.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,7 +140,7 @@ public class DeptServiceImpl implements DeptService {
|
|||
public void delete(Set<DeptDto> deptDtos) {
|
||||
for (DeptDto deptDto : deptDtos) {
|
||||
// 清理缓存
|
||||
delCaches(deptDto.getId(), deptDto.getPid(), null);
|
||||
delCaches(deptDto.getId());
|
||||
deptRepository.deleteById(deptDto.getId());
|
||||
updateSubCnt(deptDto.getPid());
|
||||
}
|
||||
|
@ -273,15 +271,11 @@ public class DeptServiceImpl implements DeptService {
|
|||
/**
|
||||
* 清理缓存
|
||||
* @param id /
|
||||
* @param oldPid /
|
||||
* @param newPid /
|
||||
*/
|
||||
public void delCaches(Long id, Long oldPid, Long newPid){
|
||||
public void delCaches(Long id){
|
||||
List<User> users = userRepository.findByDeptRoleId(id);
|
||||
// 删除数据权限
|
||||
redisUtils.delByKeys("data::user:",users.stream().map(User::getId).collect(Collectors.toSet()));
|
||||
redisUtils.del("dept::id:" + id);
|
||||
redisUtils.del("dept::pid:" + (oldPid == null ? 0 : oldPid));
|
||||
redisUtils.del("dept::pid:" + (newPid == null ? 0 : newPid));
|
||||
}
|
||||
}
|
|
@ -93,6 +93,6 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||
|
||||
public void delCaches(DictDetail dictDetail){
|
||||
Dict dict = dictRepository.findById(dictDetail.getDict().getId()).orElseGet(Dict::new);
|
||||
redisUtils.del("dept::name:" + dict.getName());
|
||||
redisUtils.del("dict::name:" + dict.getName());
|
||||
}
|
||||
}
|
|
@ -115,6 +115,6 @@ public class DictServiceImpl implements DictService {
|
|||
}
|
||||
|
||||
public void delCaches(Dict dict){
|
||||
redisUtils.del("dept::name:" + dict.getName());
|
||||
redisUtils.del("dict::name:" + dict.getName());
|
||||
}
|
||||
}
|
|
@ -128,7 +128,6 @@ public class MenuServiceImpl implements MenuService {
|
|||
resources.setSubCount(0);
|
||||
// 更新父节点菜单数目
|
||||
updateSubCnt(resources.getPid());
|
||||
redisUtils.del("menu::pid:" + (resources.getPid() == null ? 0 : resources.getPid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,7 +182,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
updateSubCnt(oldPid);
|
||||
updateSubCnt(newPid);
|
||||
// 清理缓存
|
||||
delCaches(resources.getId(), oldPid, newPid);
|
||||
delCaches(resources.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -204,7 +203,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
public void delete(Set<Menu> menuSet) {
|
||||
for (Menu menu : menuSet) {
|
||||
// 清理缓存
|
||||
delCaches(menu.getId(), menu.getPid(), null);
|
||||
delCaches(menu.getId());
|
||||
roleService.untiedMenu(menu.getId());
|
||||
menuRepository.deleteById(menu.getId());
|
||||
updateSubCnt(menu.getPid());
|
||||
|
@ -212,7 +211,6 @@ public class MenuServiceImpl implements MenuService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'pid:' + #p0")
|
||||
public List<MenuDto> getMenus(Long pid) {
|
||||
List<Menu> menus;
|
||||
if(pid != null && !pid.equals(0L)){
|
||||
|
@ -341,19 +339,14 @@ public class MenuServiceImpl implements MenuService {
|
|||
/**
|
||||
* 清理缓存
|
||||
* @param id 菜单ID
|
||||
* @param oldPid 旧的菜单父级ID
|
||||
* @param newPid 新的菜单父级ID
|
||||
*/
|
||||
public void delCaches(Long id, Long oldPid, Long newPid){
|
||||
public void delCaches(Long id){
|
||||
List<User> users = userRepository.findByMenuId(id);
|
||||
redisUtils.del("menu::id:" +id);
|
||||
redisUtils.delByKeys("menu::user:",users.stream().map(User::getId).collect(Collectors.toSet()));
|
||||
redisUtils.del("menu::pid:" + (oldPid == null ? 0 : oldPid));
|
||||
redisUtils.del("menu::pid:" + (newPid == null ? 0 : newPid));
|
||||
// 清除 Role 缓存
|
||||
List<Role> roles = roleService.findInMenuId(new ArrayList<Long>(){{
|
||||
add(id);
|
||||
add(newPid == null ? 0 : newPid);
|
||||
}});
|
||||
redisUtils.delByKeys("role::id:",roles.stream().map(Role::getId).collect(Collectors.toSet()));
|
||||
}
|
||||
|
|
|
@ -219,6 +219,5 @@ public class RoleServiceImpl implements RoleService {
|
|||
redisUtils.delByKeys(CacheKey.ROLE_AUTH, userIds);
|
||||
redisUtils.del(CacheKey.ROLE_ID + id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ spring:
|
|||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:eladmin}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
|
|
@ -4,9 +4,9 @@ spring:
|
|||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:eladmin}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
|
|
@ -23,10 +23,10 @@ spring:
|
|||
|
||||
redis:
|
||||
#数据库索引
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
|
@ -53,7 +53,3 @@ code:
|
|||
#密码加密传输,前端公钥加密,后端私钥解密
|
||||
rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
||||
|
||||
# sm.ms 图床的 token
|
||||
smms:
|
||||
token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ${className}QueryCriteria{
|
|||
<#list betweens as column>
|
||||
/** BETWEEN */
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<${column.columnType}> createTime;
|
||||
private List<${column.columnType}> ${column.changeColumnName};
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
|
@ -129,7 +129,7 @@ export default {
|
|||
dicts: [<#if hasDict??><#list dicts as dict>'${dict}'<#if dict_has_next>, </#if></#list></#if>],
|
||||
</#if>
|
||||
cruds() {
|
||||
return CRUD({ title: '${apiAlias}', url: 'api/${changeClassName}', sort: '${pkChangeColName},desc', crudMethod: { ...crud${className} }})
|
||||
return CRUD({ title: '${apiAlias}', url: 'api/${changeClassName}', idField: '${pkChangeColName}', sort: '${pkChangeColName},desc', crudMethod: { ...crud${className} }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
<dependency>
|
||||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin-logging</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--邮件依赖-->
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 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.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* sm.ms图床
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "tool_picture")
|
||||
public class Picture implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "picture_id")
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "文件名")
|
||||
private String filename;
|
||||
|
||||
@ApiModelProperty(value = "图片url")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "图片大小")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty(value = "图片高")
|
||||
private String height;
|
||||
|
||||
@ApiModelProperty(value = "图片宽")
|
||||
private String width;
|
||||
|
||||
@Column(name = "delete_url")
|
||||
@ApiModelProperty(value = "用于删除的url")
|
||||
private String delete;
|
||||
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String username;
|
||||
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Timestamp createTime;
|
||||
|
||||
/** 用于检测文件是否重复 */
|
||||
private String md5Code;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Picture{" +
|
||||
"filename='" + filename + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 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.repository;
|
||||
|
||||
import me.zhengjie.domain.Picture;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
public interface PictureRepository extends JpaRepository<Picture,Long>, JpaSpecificationExecutor<Picture> {
|
||||
|
||||
/**
|
||||
* 根据 Mds 值查询文件
|
||||
* @param code 值
|
||||
* @return /
|
||||
*/
|
||||
Picture findByMd5Code(String code);
|
||||
|
||||
/**
|
||||
* 根据连接地址查询
|
||||
* @param url /
|
||||
* @return /
|
||||
*/
|
||||
boolean existsByUrl(String url);
|
||||
}
|
|
@ -18,8 +18,11 @@ package me.zhengjie.rest;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
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.LocalStorageQueryCriteria;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.utils.SecurityUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -67,6 +70,19 @@ public class LocalStorageController {
|
|||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("上传图片")
|
||||
@PostMapping("/pictures")
|
||||
@ApiOperation("上传图片")
|
||||
public ResponseEntity<Object> upload(@RequestParam MultipartFile file){
|
||||
// 判断文件是否为图片
|
||||
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
|
||||
throw new BadRequestException("只能上传图片");
|
||||
}
|
||||
LocalStorage localStorage = localStorageService.create(null, file);
|
||||
return new ResponseEntity<>(localStorage, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("修改文件")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('storage:edit')")
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 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.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.service.PictureService;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.utils.SecurityUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author 郑杰
|
||||
* @date 2018/09/20 14:13:32
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/pictures")
|
||||
@Api(tags = "工具:免费图床管理")
|
||||
public class PictureController {
|
||||
|
||||
private final PictureService pictureService;
|
||||
|
||||
@Log("查询图片")
|
||||
@PreAuthorize("@el.check('pictures:list')")
|
||||
@GetMapping
|
||||
@ApiOperation("查询图片")
|
||||
public ResponseEntity<Object> query(PictureQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(pictureService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('pictures:list')")
|
||||
public void download(HttpServletResponse response, PictureQueryCriteria criteria) throws IOException {
|
||||
pictureService.download(pictureService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@Log("上传图片")
|
||||
@PreAuthorize("@el.check('pictures:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("上传图片")
|
||||
public ResponseEntity<Object> upload(@RequestParam MultipartFile file){
|
||||
String userName = SecurityUtils.getCurrentUsername();
|
||||
Picture picture = pictureService.upload(file,userName);
|
||||
return new ResponseEntity<>(picture,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("同步图床数据")
|
||||
@ApiOperation("同步图床数据")
|
||||
@PostMapping(value = "/synchronize")
|
||||
public ResponseEntity<Object> synchronize(){
|
||||
pictureService.synchronize();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("多选删除图片")
|
||||
@ApiOperation("多选删除图片")
|
||||
@PreAuthorize("@el.check('pictures:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
pictureService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -56,8 +56,9 @@ public interface LocalStorageService {
|
|||
* 上传
|
||||
* @param name 文件名称
|
||||
* @param file 文件
|
||||
* @return
|
||||
*/
|
||||
void create(String name, MultipartFile file);
|
||||
LocalStorage create(String name, MultipartFile file);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 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.service;
|
||||
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
public interface PictureService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return /
|
||||
*/
|
||||
Object queryAll(PictureQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
List<Picture> queryAll(PictureQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file /
|
||||
* @param username /
|
||||
* @return /
|
||||
*/
|
||||
Picture upload(MultipartFile file, String username);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
Picture findById(Long id);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param queryAll 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<Picture> queryAll, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 同步数据
|
||||
*/
|
||||
void synchronize();
|
||||
}
|
|
@ -64,7 +64,7 @@ public class EmailServiceImpl implements EmailService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void send(EmailVo emailVo, EmailConfig emailConfig){
|
||||
if(emailConfig == null){
|
||||
if(emailConfig.getId() == null){
|
||||
throw new BadRequestException("请先配置,再操作");
|
||||
}
|
||||
// 封装
|
||||
|
|
|
@ -71,7 +71,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(String name, MultipartFile multipartFile) {
|
||||
public LocalStorage create(String name, MultipartFile multipartFile) {
|
||||
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
||||
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
|
||||
String type = FileUtil.getFileType(suffix);
|
||||
|
@ -89,7 +89,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
|||
type,
|
||||
FileUtil.getSize(multipartFile.getSize())
|
||||
);
|
||||
localStorageRepository.save(localStorage);
|
||||
return localStorageRepository.save(localStorage);
|
||||
}catch (Exception e){
|
||||
FileUtil.del(file);
|
||||
throw e;
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 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.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.repository.PictureRepository;
|
||||
import me.zhengjie.service.PictureService;
|
||||
import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service(value = "pictureService")
|
||||
public class PictureServiceImpl implements PictureService {
|
||||
|
||||
@Value("${smms.token}")
|
||||
private String token;
|
||||
private final PictureRepository pictureRepository;
|
||||
private static final String SUCCESS = "success";
|
||||
private static final String CODE = "code";
|
||||
private static final String MSG = "message";
|
||||
|
||||
@Override
|
||||
public Object queryAll(PictureQueryCriteria criteria, Pageable pageable){
|
||||
return PageUtil.toPage(pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Picture> queryAll(PictureQueryCriteria criteria) {
|
||||
return pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Throwable.class)
|
||||
public Picture upload(MultipartFile multipartFile, String username) {
|
||||
File file = FileUtil.toFile(multipartFile);
|
||||
// 验证是否重复上传
|
||||
Picture picture = pictureRepository.findByMd5Code(FileUtil.getMd5(file));
|
||||
if(picture != null){
|
||||
return picture;
|
||||
}
|
||||
HashMap<String, Object> paramMap = new HashMap<>(1);
|
||||
paramMap.put("smfile", file);
|
||||
// 上传文件
|
||||
String result= HttpRequest.post(ElAdminConstant.Url.SM_MS_URL + "/v2/upload")
|
||||
.header("Authorization", token)
|
||||
.form(paramMap)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(result);
|
||||
if(!jsonObject.get(CODE).toString().equals(SUCCESS)){
|
||||
throw new BadRequestException(TranslatorUtil.translate(jsonObject.get(MSG).toString()));
|
||||
}
|
||||
picture = JSON.parseObject(jsonObject.get("data").toString(), Picture.class);
|
||||
picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize())));
|
||||
picture.setUsername(username);
|
||||
picture.setMd5Code(FileUtil.getMd5(file));
|
||||
picture.setFilename(FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename())+"."+FileUtil.getExtensionName(multipartFile.getOriginalFilename()));
|
||||
pictureRepository.save(picture);
|
||||
//删除临时文件
|
||||
FileUtil.del(file);
|
||||
return picture;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Picture findById(Long id) {
|
||||
Picture picture = pictureRepository.findById(id).orElseGet(Picture::new);
|
||||
ValidationUtil.isNull(picture.getId(),"Picture","id",id);
|
||||
return picture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
Picture picture = findById(id);
|
||||
try {
|
||||
HttpUtil.get(picture.getDelete());
|
||||
pictureRepository.delete(picture);
|
||||
} catch(Exception e){
|
||||
pictureRepository.delete(picture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronize() {
|
||||
//链式构建请求
|
||||
String result = HttpRequest.get(ElAdminConstant.Url.SM_MS_URL + "/v2/upload_history")
|
||||
//头信息,多个头信息多次调用此方法即可
|
||||
.header("Authorization", token)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(result);
|
||||
List<Picture> pictures = JSON.parseArray(jsonObject.get("data").toString(), Picture.class);
|
||||
for (Picture picture : pictures) {
|
||||
if(!pictureRepository.existsByUrl(picture.getUrl())){
|
||||
picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize())));
|
||||
picture.setUsername("System Sync");
|
||||
picture.setMd5Code(null);
|
||||
pictureRepository.save(picture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<Picture> queryAll, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (Picture picture : queryAll) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("文件名", picture.getFilename());
|
||||
map.put("图片地址", picture.getUrl());
|
||||
map.put("文件大小", picture.getSize());
|
||||
map.put("操作人", picture.getUsername());
|
||||
map.put("高度", picture.getHeight());
|
||||
map.put("宽度", picture.getWidth());
|
||||
map.put("删除地址", picture.getDelete());
|
||||
map.put("创建日期", picture.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
2
pom.xml
2
pom.xml
|
@ -7,7 +7,7 @@
|
|||
<groupId>me.zhengjie</groupId>
|
||||
<artifactId>eladmin</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.5</version>
|
||||
<version>2.6</version>
|
||||
|
||||
<modules>
|
||||
<module>eladmin-common</module>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
-- code_gen_config 表改动 start --
|
||||
alter table code_gen_config CHANGE id config_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
-- code_gen_config end --
|
||||
|
||||
-- code_column_config 表改动 start --
|
||||
alter table code_column_config CHANGE id column_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
-- code_column_config end --
|
164
sql/eladmin.sql
164
sql/eladmin.sql
|
@ -3,15 +3,15 @@
|
|||
|
||||
Source Server : localhost
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50710
|
||||
Source Server Version : 100505
|
||||
Source Host : localhost:3306
|
||||
Source Schema : eladmin
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50710
|
||||
Target Server Version : 100505
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 14/05/2020 13:28:14
|
||||
Date: 05/09/2020 10:49:19
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
@ -38,7 +38,7 @@ CREATE TABLE `code_column_config` (
|
|||
`date_annotation` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`column_id`) USING BTREE,
|
||||
KEY `idx_table_name` (`table_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=187 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成字段信息存储';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成字段信息存储';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for code_gen_config
|
||||
|
@ -57,7 +57,7 @@ CREATE TABLE `code_gen_config` (
|
|||
`api_alias` varchar(255) DEFAULT NULL COMMENT '接口名称',
|
||||
PRIMARY KEY (`config_id`) USING BTREE,
|
||||
KEY `idx_table_name` (`table_name`(100))
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成器配置';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成器配置';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for mnt_app
|
||||
|
@ -185,13 +185,6 @@ CREATE TABLE `mnt_server` (
|
|||
KEY `idx_ip` (`ip`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='服务器管理';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of mnt_server
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `mnt_server` VALUES (1, 'root', '132.232.129.20', '腾讯云', 'Dqjdda1996.', 8013, NULL, NULL, '2019-11-24 20:35:02', NULL);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dept
|
||||
-- ----------------------------
|
||||
|
@ -199,9 +192,9 @@ DROP TABLE IF EXISTS `sys_dept`;
|
|||
CREATE TABLE `sys_dept` (
|
||||
`dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '上级部门',
|
||||
`sub_count` int(5) DEFAULT '0' COMMENT '子部门数目',
|
||||
`sub_count` int(5) DEFAULT 0 COMMENT '子部门数目',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`dept_sort` int(5) DEFAULT '999' COMMENT '排序',
|
||||
`dept_sort` int(5) DEFAULT 999 COMMENT '排序',
|
||||
`enabled` bit(1) NOT NULL COMMENT '状态',
|
||||
`create_by` varchar(255) DEFAULT NULL COMMENT '创建者',
|
||||
`update_by` varchar(255) DEFAULT NULL COMMENT '更新者',
|
||||
|
@ -210,18 +203,19 @@ CREATE TABLE `sys_dept` (
|
|||
PRIMARY KEY (`dept_id`) USING BTREE,
|
||||
KEY `inx_pid` (`pid`),
|
||||
KEY `inx_enabled` (`enabled`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dept
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_dept` VALUES (2, 7, 0, '研发部', 3, b'1', NULL, 'admin', '2019-03-25 09:15:32', '2020-05-10 17:37:58');
|
||||
INSERT INTO `sys_dept` VALUES (5, 7, 0, '运维部', 4, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (6, 8, 0, '测试部', 6, b'1', NULL, NULL, '2019-03-25 09:52:18', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (7, NULL, 2, '华南分部', 0, b'1', NULL, 'admin', '2019-03-25 11:04:50', '2020-05-10 19:59:12');
|
||||
INSERT INTO `sys_dept` VALUES (8, NULL, 2, '华北分部', 1, b'1', NULL, 'admin', '2019-03-25 11:04:53', '2020-05-14 12:54:00');
|
||||
INSERT INTO `sys_dept` VALUES (2, 7, 1, '研发部', 3, b'1', 'admin', 'admin', '2019-03-25 09:15:32', '2020-08-02 14:48:47');
|
||||
INSERT INTO `sys_dept` VALUES (5, 7, 0, '运维部', 4, b'1', 'admin', 'admin', '2019-03-25 09:20:44', '2020-05-17 14:27:27');
|
||||
INSERT INTO `sys_dept` VALUES (6, 8, 0, '测试部', 6, b'1', 'admin', 'admin', '2019-03-25 09:52:18', '2020-06-08 11:59:21');
|
||||
INSERT INTO `sys_dept` VALUES (7, NULL, 2, '华南分部', 0, b'1', 'admin', 'admin', '2019-03-25 11:04:50', '2020-06-08 12:08:56');
|
||||
INSERT INTO `sys_dept` VALUES (8, NULL, 2, '华北分部', 1, b'1', 'admin', 'admin', '2019-03-25 11:04:53', '2020-05-14 12:54:00');
|
||||
INSERT INTO `sys_dept` VALUES (15, 8, 0, 'UI部门', 7, b'1', 'admin', 'admin', '2020-05-13 22:56:53', '2020-05-14 12:54:13');
|
||||
INSERT INTO `sys_dept` VALUES (17, 2, 0, '研发一组', 999, b'1', 'admin', 'admin', '2020-08-02 14:49:07', '2020-08-02 14:49:07');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -315,24 +309,18 @@ CREATE TABLE `sys_log` (
|
|||
`description` varchar(255) DEFAULT NULL,
|
||||
`log_type` varchar(255) DEFAULT NULL,
|
||||
`method` varchar(255) DEFAULT NULL,
|
||||
`params` text,
|
||||
`params` text DEFAULT NULL,
|
||||
`request_ip` varchar(255) DEFAULT NULL,
|
||||
`time` bigint(20) DEFAULT NULL,
|
||||
`username` varchar(255) DEFAULT NULL,
|
||||
`address` varchar(255) DEFAULT NULL,
|
||||
`browser` varchar(255) DEFAULT NULL,
|
||||
`exception_detail` text,
|
||||
`exception_detail` text DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`log_id`) USING BTREE,
|
||||
KEY `log_create_time_index` (`create_time`),
|
||||
KEY `inx_log_type` (`log_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2573 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_log
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3537 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_menu
|
||||
|
@ -341,7 +329,7 @@ DROP TABLE IF EXISTS `sys_menu`;
|
|||
CREATE TABLE `sys_menu` (
|
||||
`menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID',
|
||||
`sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目',
|
||||
`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 '组件名称',
|
||||
|
@ -361,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=120 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_menu
|
||||
|
@ -372,17 +360,16 @@ INSERT INTO `sys_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/
|
|||
INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', NULL, NULL, '2018-12-18 15:16:07', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '菜单管理', 'Menu', 'system/menu/index', 5, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', NULL, NULL, '2018-12-18 15:17:28', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (6, NULL, 5, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:17:48', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (7, 6, 0, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:18:26', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (7, 6, 0, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'1', b'0', NULL, NULL, 'admin', '2018-12-18 15:18:26', '2020-06-06 13:11:57');
|
||||
INSERT INTO `sys_menu` VALUES (9, 6, 0, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 18, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:19:34', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (10, NULL, 5, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:16', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (11, 10, 0, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:49', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (14, 36, 0, 1, '邮件工具', 'Email', 'tools/email/index', 35, 'email', 'email', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 10:13:09', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (15, 10, 0, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 11:58:25', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (16, 36, 2, 1, '图床管理', 'Pictures', 'tools/picture/index', 33, 'image', 'pictures', b'0', b'0', b'0', 'pictures:list', NULL, NULL, '2018-12-28 09:36:53', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (18, 36, 3, 1, '存储管理', 'Storage', 'tools/storage/index', 34, 'qiniu', 'storage', b'0', b'0', b'0', 'storage:list', NULL, NULL, '2018-12-31 11:12:15', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (19, 36, 0, 1, '支付宝工具', 'AliPay', 'tools/aliPay/index', 37, 'alipay', 'aliPay', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-31 14:52:38', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (21, NULL, 2, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:22:03', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (22, 21, 2, 1, '二级菜单1', NULL, 'nested/menu1/index', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:29', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (21, NULL, 2, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'0', NULL, NULL, 'admin', '2019-01-04 16:22:03', '2020-06-21 17:27:35');
|
||||
INSERT INTO `sys_menu` VALUES (22, 21, 2, 1, '二级菜单1', NULL, 'nested/menu1/index', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, NULL, 'admin', '2019-01-04 16:23:29', '2020-06-21 17:27:20');
|
||||
INSERT INTO `sys_menu` VALUES (23, 21, 0, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:57', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (24, 22, 0, 1, '三级菜单1', NULL, 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:24:48', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (27, 22, 0, 1, '三级菜单2', NULL, 'nested/menu1/menu1-2', 999, 'menu', 'menu1-2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-07 17:27:32', NULL);
|
||||
|
@ -392,7 +379,7 @@ INSERT INTO `sys_menu` VALUES (32, 6, 0, 1, '异常日志', 'ErrorLog', 'monitor
|
|||
INSERT INTO `sys_menu` VALUES (33, 10, 0, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 13:46:44', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (34, 10, 0, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 15:49:40', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (35, 1, 3, 1, '部门管理', 'Dept', 'system/dept/index', 6, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', NULL, NULL, '2019-03-25 09:46:00', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (36, NULL, 8, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (36, NULL, 7, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (37, 1, 3, 1, '岗位管理', 'Job', 'system/job/index', 7, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', NULL, NULL, '2019-03-29 13:51:18', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (38, 36, 0, 1, '接口文档', 'Swagger', 'tools/swagger/index', 36, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 19:57:53', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (39, 1, 3, 1, '字典管理', 'Dict', 'system/dict/index', 8, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', NULL, NULL, '2019-04-10 11:49:04', NULL);
|
||||
|
@ -415,8 +402,6 @@ INSERT INTO `sys_menu` VALUES (62, 37, 0, 2, '岗位删除', NULL, '', 4, '', ''
|
|||
INSERT INTO `sys_menu` VALUES (64, 39, 0, 2, '字典新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dict:add', NULL, NULL, '2019-10-29 13:00:17', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (65, 39, 0, 2, '字典编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dict:edit', NULL, NULL, '2019-10-29 13:00:42', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (66, 39, 0, 2, '字典删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dict:del', NULL, NULL, '2019-10-29 13:00:59', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (70, 16, 0, 2, '图片上传', NULL, '', 2, '', '', b'0', b'0', b'0', 'pictures:add', NULL, NULL, '2019-10-29 13:05:34', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (71, 16, 0, 2, '图片删除', NULL, '', 3, '', '', b'0', b'0', b'0', 'pictures:del', NULL, NULL, '2019-10-29 13:05:52', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (73, 28, 0, 2, '任务新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'timing:add', NULL, NULL, '2019-10-29 13:07:28', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (74, 28, 0, 2, '任务编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'timing:edit', NULL, NULL, '2019-10-29 13:07:41', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (75, 28, 0, 2, '任务删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'timing:del', NULL, NULL, '2019-10-29 13:07:54', NULL);
|
||||
|
@ -477,8 +462,8 @@ CREATE TABLE `sys_quartz_job` (
|
|||
-- Records of sys_quartz_job
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_quartz_job` VALUES (2, 'testTask', '0/5 * * * * ?', b'1', '测试1', 'run1', 'test', '带参测试,多参使用json', '测试', NULL, NULL, NULL, NULL, 'admin', '2019-08-22 14:08:29', '2020-05-05 17:26:19');
|
||||
INSERT INTO `sys_quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试', 'run', '', '不带参测试', 'Zheng Jie', '', '2,6', b'1', NULL, 'admin', '2019-09-26 16:44:39', '2020-05-05 20:45:39');
|
||||
INSERT INTO `sys_quartz_job` VALUES (2, 'testTask', '0/5 * * * * ?', b'1', '测试1', 'run1', 'test', '带参测试,多参使用json', '测试', NULL, NULL, NULL, NULL, 'admin', '2019-08-22 14:08:29', '2020-05-24 13:58:33');
|
||||
INSERT INTO `sys_quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试', 'run', '', '不带参测试', 'Zheng Jie', '', '5,6', b'1', NULL, 'admin', '2019-09-26 16:44:39', '2020-05-24 14:48:12');
|
||||
INSERT INTO `sys_quartz_job` VALUES (5, 'Test', '0/5 * * * * ?', b'1', '任务告警测试', 'run', NULL, '测试', 'test', '', NULL, b'1', 'admin', 'admin', '2020-05-05 20:32:41', '2020-05-05 20:36:13');
|
||||
INSERT INTO `sys_quartz_job` VALUES (6, 'testTask', '0/5 * * * * ?', b'1', '测试3', 'run2', NULL, '测试3', 'Zheng Jie', '', NULL, b'1', 'admin', 'admin', '2020-05-05 20:35:41', '2020-05-05 20:36:07');
|
||||
COMMIT;
|
||||
|
@ -492,20 +477,14 @@ CREATE TABLE `sys_quartz_log` (
|
|||
`bean_name` varchar(255) DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`cron_expression` varchar(255) DEFAULT NULL,
|
||||
`exception_detail` text,
|
||||
`exception_detail` text DEFAULT NULL,
|
||||
`is_success` bit(1) DEFAULT NULL,
|
||||
`job_name` varchar(255) DEFAULT NULL,
|
||||
`method_name` varchar(255) DEFAULT NULL,
|
||||
`params` varchar(255) DEFAULT NULL,
|
||||
`time` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`log_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_quartz_log
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=151 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_role
|
||||
|
@ -530,8 +509,8 @@ CREATE TABLE `sys_role` (
|
|||
-- Records of sys_role
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '全部', NULL, 'admin', '2018-11-23 11:04:37', '2020-05-11 18:34:06');
|
||||
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-11 18:28:45');
|
||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '自定义', NULL, 'admin', '2018-11-23 11:04:37', '2020-08-06 16:10:24');
|
||||
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-09-05 10:45:12');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -549,7 +528,9 @@ CREATE TABLE `sys_roles_depts` (
|
|||
-- Records of sys_roles_depts
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_roles_depts` VALUES (2, 7);
|
||||
INSERT INTO `sys_roles_depts` VALUES (1, 7);
|
||||
INSERT INTO `sys_roles_depts` VALUES (1, 8);
|
||||
INSERT INTO `sys_roles_depts` VALUES (2, 6);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -568,52 +549,74 @@ CREATE TABLE `sys_roles_menus` (
|
|||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_roles_menus` VALUES (1, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (1, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (2, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (2, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (3, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (3, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (5, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (5, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (6, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (6, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (7, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (7, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (9, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (9, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (10, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (10, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (11, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (11, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (14, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (14, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (15, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (16, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (15, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (18, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (18, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (19, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (19, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (21, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (21, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (22, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (22, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (23, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (23, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (24, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (24, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (27, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (27, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (28, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (28, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (30, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (32, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (33, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (33, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (34, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (34, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (35, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (35, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (36, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (36, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (37, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (37, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (38, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (38, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (39, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (39, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (41, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (80, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (80, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (82, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (83, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (83, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (90, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (90, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (92, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (92, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (93, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (94, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (97, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (98, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (116, 1);
|
||||
INSERT INTO `sys_roles_menus` VALUES (1, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (2, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (3, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (5, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (10, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (21, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (36, 2);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -652,8 +655,8 @@ CREATE TABLE `sys_user` (
|
|||
-- Records of sys_user
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_user` VALUES (1, 2, 'admin', '管理员', '男', '18888888888', '201507802@qq.com', NULL, NULL, '$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa', b'1', 1, NULL, 'admin', '2020-05-03 16:38:31', '2018-08-23 09:11:56', '2020-05-05 10:12:21');
|
||||
INSERT INTO `sys_user` VALUES (2, 2, 'test', '测试', '男', '18888888888', '231@qq.com', NULL, NULL, '$2a$10$4XcyudOYTSz6fue6KFNMHeUQnCX5jbBQypLEnGk1PmekXt5c95JcK', b'0', 1, 'admin', 'admin', NULL, '2020-05-05 11:15:49', '2020-05-05 11:20:51');
|
||||
INSERT INTO `sys_user` VALUES (1, 2, 'admin', '管理员', '男', '18888888888', '201507802@qq.com', 'avatar-20200806032259161.png', '/Users/jie/Documents/work/me/admin/eladmin/~/avatar/avatar-20200806032259161.png', '$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa', b'1', 1, NULL, 'admin', '2020-05-03 16:38:31', '2018-08-23 09:11:56', '2020-09-05 10:43:31');
|
||||
INSERT INTO `sys_user` VALUES (2, 2, 'test', '测试', '男', '18888888888', '231@qq.com', NULL, NULL, '$2a$10$4XcyudOYTSz6fue6KFNMHeUQnCX5jbBQypLEnGk1PmekXt5c95JcK', b'0', 1, 'admin', 'admin', NULL, '2020-05-05 11:15:49', '2020-09-05 10:43:38');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -671,7 +674,6 @@ CREATE TABLE `sys_users_jobs` (
|
|||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_users_jobs` VALUES (1, 11);
|
||||
INSERT INTO `sys_users_jobs` VALUES (1, 12);
|
||||
INSERT INTO `sys_users_jobs` VALUES (2, 12);
|
||||
COMMIT;
|
||||
|
||||
|
@ -705,8 +707,8 @@ CREATE TABLE `tool_alipay_config` (
|
|||
`format` varchar(255) DEFAULT NULL COMMENT '类型 固定格式json',
|
||||
`gateway_url` varchar(255) DEFAULT NULL COMMENT '网关地址',
|
||||
`notify_url` varchar(255) DEFAULT NULL COMMENT '异步回调',
|
||||
`private_key` text COMMENT '私钥',
|
||||
`public_key` text COMMENT '公钥',
|
||||
`private_key` text DEFAULT NULL COMMENT '私钥',
|
||||
`public_key` text DEFAULT NULL COMMENT '公钥',
|
||||
`return_url` varchar(255) DEFAULT NULL COMMENT '回调地址',
|
||||
`sign_type` varchar(255) DEFAULT NULL COMMENT '签名方式',
|
||||
`sys_service_provider_id` varchar(255) DEFAULT NULL COMMENT '商户号',
|
||||
|
@ -751,7 +753,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=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='本地存储';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='本地存储';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of tool_local_storage
|
||||
|
@ -759,36 +761,16 @@ CREATE TABLE `tool_local_storage` (
|
|||
BEGIN;
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tool_picture
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tool_picture`;
|
||||
CREATE TABLE `tool_picture` (
|
||||
`picture_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`filename` varchar(255) DEFAULT NULL COMMENT '图片名称',
|
||||
`md5code` varchar(255) DEFAULT NULL COMMENT '文件的MD5值',
|
||||
`size` varchar(255) DEFAULT NULL COMMENT '图片大小',
|
||||
`url` varchar(255) DEFAULT NULL COMMENT '图片地址',
|
||||
`delete_url` varchar(255) DEFAULT NULL COMMENT '删除的URL',
|
||||
`height` varchar(255) DEFAULT NULL COMMENT '图片高度',
|
||||
`width` varchar(255) DEFAULT NULL COMMENT '图片宽度',
|
||||
`username` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '上传日期',
|
||||
PRIMARY KEY (`picture_id`) USING BTREE,
|
||||
UNIQUE KEY `uniq_md5_code` (`md5code`),
|
||||
KEY `inx_url` (`url`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Sm.Ms图床';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tool_qiniu_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tool_qiniu_config`;
|
||||
CREATE TABLE `tool_qiniu_config` (
|
||||
`config_id` bigint(20) NOT NULL COMMENT 'ID',
|
||||
`access_key` text COMMENT 'accessKey',
|
||||
`access_key` text DEFAULT NULL COMMENT 'accessKey',
|
||||
`bucket` varchar(255) DEFAULT NULL COMMENT 'Bucket 识别符',
|
||||
`host` varchar(255) NOT NULL COMMENT '外链域名',
|
||||
`secret_key` text COMMENT 'secretKey',
|
||||
`secret_key` text DEFAULT NULL COMMENT 'secretKey',
|
||||
`type` varchar(255) DEFAULT NULL COMMENT '空间类型',
|
||||
`zone` varchar(255) DEFAULT NULL COMMENT '机房',
|
||||
PRIMARY KEY (`config_id`) USING BTREE
|
||||
|
@ -809,6 +791,12 @@ CREATE TABLE `tool_qiniu_content` (
|
|||
`update_time` datetime DEFAULT NULL COMMENT '上传或同步的时间',
|
||||
PRIMARY KEY (`content_id`) USING BTREE,
|
||||
UNIQUE KEY `uniq_name` (`name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of tool_qiniu_content
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
-- mnt_app 表改动 start --
|
||||
alter table mnt_app CHANGE id app_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* 加入通用字段 */
|
||||
alter table mnt_app add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table mnt_app add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table mnt_app add update_time datetime COMMENT '更新时间';
|
||||
-- mnt_app end --
|
||||
|
||||
-- mnt_database 表改动 start --
|
||||
alter table mnt_database CHANGE id db_id VARCHAR(50) COMMENT 'ID';
|
||||
/* 加入通用字段 */
|
||||
alter table mnt_database add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table mnt_database add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table mnt_database add update_time datetime COMMENT '更新时间';
|
||||
-- mnt_database end --
|
||||
|
||||
-- mnt_deploy 表改动 start --
|
||||
alter table mnt_deploy CHANGE id deploy_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* 加入通用字段 */
|
||||
alter table mnt_deploy add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table mnt_deploy add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table mnt_deploy add update_time datetime COMMENT '更新时间';
|
||||
-- mnt_deploy end --
|
||||
|
||||
-- mnt_server 表改动 start --
|
||||
alter table mnt_server CHANGE id server_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* 加入通用字段 */
|
||||
alter table mnt_server add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table mnt_server add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table mnt_server add update_time datetime COMMENT '更新时间';
|
||||
-- mnt_server end --
|
||||
|
||||
-- mnt_deploy_history 表改动 start --
|
||||
alter table mnt_deploy_history CHANGE id history_id VARCHAR(50) COMMENT 'ID';
|
||||
-- mnt_deploy end --
|
|
@ -1,134 +0,0 @@
|
|||
-- sys_user 表变动 start --
|
||||
/* id 改为 user_id */
|
||||
alter table sys_user CHANGE id user_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* 实际操作中需要将 avatar 表的数据移入 sys_user 中 */
|
||||
alter table sys_user CHANGE avatar_id avatar_url VARCHAR(255) COMMENT '头像地址';
|
||||
/* 添加头像路径 */
|
||||
alter table sys_user add avatar_path VARCHAR(255) COMMENT '头像真实路径' AFTER avatar_url;
|
||||
/* 判断是否为 admin */
|
||||
alter table sys_user add is_admin bit(1) COMMENT '是否为admin账号' DEFAULT 0 AFTER create_time;
|
||||
/* sex 改为 gender */
|
||||
alter table sys_user CHANGE sex gender VARCHAR(2) COMMENT '性别';
|
||||
/* last_password_reset_time 改为 pwd_reset_time */
|
||||
alter table sys_user CHANGE last_password_reset_time pwd_reset_time datetime COMMENT '修改密码的时间';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_user add update_by VARCHAR(255) COMMENT '更新者' AFTER enabled;
|
||||
alter table sys_user add create_by VARCHAR(255) COMMENT '创建者' AFTER enabled;
|
||||
alter table sys_user add update_time datetime COMMENT '更新时间';
|
||||
-- sys_user end --
|
||||
|
||||
-- sys_role 表变动 start--
|
||||
/* id 改为 role_id */
|
||||
alter table sys_role CHANGE id role_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* remark 改为 description */
|
||||
alter table sys_role CHANGE remark description VARCHAR(255) COMMENT '描述';
|
||||
/* 删除权限字段 */
|
||||
ALTER TABLE sys_role DROP permission;
|
||||
/* 加入通用字段 */
|
||||
alter table sys_role add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_role add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_role add update_time datetime COMMENT '更新时间';
|
||||
-- sys_role end --
|
||||
|
||||
-- sys_menu 表变动 start--
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_menu CHANGE id menu_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* name 改为 title */
|
||||
alter table sys_menu CHANGE name title VARCHAR(255) COMMENT '菜单标题';
|
||||
/* component_name 改为 name */
|
||||
alter table sys_menu CHANGE component_name name VARCHAR(255) COMMENT '组件名称';
|
||||
/* sort 改为 menu_sort */
|
||||
alter table sys_menu CHANGE sort menu_sort INT(5) COMMENT '排序';
|
||||
/* pid 允许为空 */
|
||||
alter table sys_menu modify pid BIGINT(20) null;
|
||||
/* 加入子节点数量字段 */
|
||||
alter table sys_menu add sub_count INT(5) DEFAULT 0 COMMENT '子菜单数目';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_menu add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_menu add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_menu add update_time datetime COMMENT '更新时间';
|
||||
-- sys_menu end --
|
||||
|
||||
-- sys_job 表改动 start --
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_job CHANGE id job_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* sort 改为 job_sort */
|
||||
alter table sys_job CHANGE sort job_sort INT(5) COMMENT '排序';
|
||||
/* 删除岗位与部门的关系 */
|
||||
ALTER TABLE sys_job DROP dept_id;
|
||||
/* 加入通用字段 */
|
||||
alter table sys_job add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_job add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_job add update_time datetime COMMENT '更新时间';
|
||||
-- sys_job end --
|
||||
|
||||
-- sys_dept 表改动 start--
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_dept CHANGE id dept_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* pid 允许为空 */
|
||||
alter table sys_dept modify pid BIGINT(20) null;
|
||||
/* 加入排序字段 */
|
||||
alter table sys_dept add dept_sort int(5) DEFAULT 999 COMMENT '排序';
|
||||
/* 加入子节点数量字段 */
|
||||
alter table sys_dept add sub_count INT(5) DEFAULT 0 COMMENT '子部门数目';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_dept add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_dept add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_dept add update_time datetime COMMENT '更新时间';
|
||||
-- sys_dept end --
|
||||
|
||||
-- sys_dict 表改动 start --
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_dict CHANGE id dict_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* remark 改为 description */
|
||||
alter table sys_dict CHANGE remark description VARCHAR(255) COMMENT '描述';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_dict add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_dict add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_dict add update_time datetime COMMENT '更新时间';
|
||||
-- sys_dict end --
|
||||
|
||||
-- sys_dict_detail 表改动 start --
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_dict_detail CHANGE id detail_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* sort 改为 dict_sort */
|
||||
alter table sys_dict_detail CHANGE sort dict_sort INT(5) COMMENT '排序';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_dict_detail add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_dict_detail add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_dict_detail add update_time datetime COMMENT '更新时间';
|
||||
-- sys_dict_detail end --
|
||||
|
||||
-- sys_quartz_job and sys_quartz_log 表改动 start --
|
||||
/* id 改为 job_id */
|
||||
alter table sys_quartz_job CHANGE id job_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
alter table sys_quartz_log CHANGE id log_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* baen_name 改为 bean_name */
|
||||
alter table sys_quartz_log CHANGE baen_name bean_name VARCHAR(255) COMMENT 'Bean 名称';
|
||||
/* remark 改为 description */
|
||||
alter table sys_quartz_job CHANGE remark description VARCHAR(255) COMMENT '备注';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_quartz_job add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_quartz_job add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_quartz_job add update_time datetime COMMENT '更新时间';
|
||||
/* 添加负责人 与 报警邮箱 */
|
||||
alter table sys_quartz_job add person_in_charge VARCHAR(100) COMMENT '负责人';
|
||||
alter table sys_quartz_job add email VARCHAR(100) COMMENT '报警邮箱';
|
||||
alter table sys_quartz_job add sub_task VARCHAR(100) COMMENT '子任务ID';
|
||||
alter table sys_quartz_job add pause_after_failure bit(1) COMMENT '任务失败后是否暂停';
|
||||
-- sys_quartz_job end --
|
||||
|
||||
-- sys_monitor_server 表改动 start --
|
||||
alter table sys_monitor_server CHANGE id monitor_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* sort 改为 monitor_sort */
|
||||
alter table sys_monitor_server CHANGE sort monitor_sort INT(5) COMMENT '排序';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_monitor_server add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_monitor_server add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_monitor_server add create_time datetime COMMENT '创建时间';
|
||||
alter table sys_monitor_server add update_time datetime COMMENT '更新时间';
|
||||
-- sys_monitor_server end --
|
||||
|
||||
-- sys_log 表改动 start --
|
||||
alter table sys_log CHANGE id log_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
-- sys_log end --
|
|
@ -1,29 +0,0 @@
|
|||
-- tool_alipay_config 表改动 start --
|
||||
alter table tool_alipay_config CHANGE id config_id BIGINT(20) COMMENT 'ID';
|
||||
-- tool_alipay_config end --
|
||||
|
||||
-- tool_email_config 表改动 start --
|
||||
alter table tool_email_config CHANGE id config_id BIGINT(20) COMMENT 'ID';
|
||||
-- tool_email_config end --
|
||||
|
||||
-- tool_local_storage 表改动 start --
|
||||
alter table tool_local_storage CHANGE id storage_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* 加入通用字段 */
|
||||
alter table tool_local_storage add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table tool_local_storage add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table tool_local_storage add update_time datetime COMMENT '更新时间';
|
||||
/* 删除 operate 字段 */
|
||||
ALTER TABLE tool_local_storage DROP operate;
|
||||
-- tool_local_storage end --
|
||||
|
||||
-- tool_picture 表改动 start --
|
||||
alter table tool_picture CHANGE id picture_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
-- tool_picture end --
|
||||
|
||||
-- tool_qiniu_config 表改动 start --
|
||||
alter table tool_qiniu_config CHANGE id config_id BIGINT(20) COMMENT 'ID';
|
||||
-- tool_qiniu_config end --
|
||||
|
||||
-- tool_qiniu_content 表改动 start --
|
||||
alter table tool_qiniu_content CHANGE id content_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
-- tool_qiniu_content end --
|
|
@ -0,0 +1,2 @@
|
|||
-- 删除免费图床表
|
||||
DROP TABLE tool_picture;
|
|
@ -1,5 +0,0 @@
|
|||
/* 检索并拼接sql语句,复制所有结果删除所有外键 */
|
||||
SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' DROP FOREIGN KEY ',CONSTRAINT_NAME,';')
|
||||
FROM information_schema.TABLE_CONSTRAINTS c
|
||||
WHERE c.TABLE_SCHEMA='eladmin' AND c.CONSTRAINT_TYPE='FOREIGN KEY';
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
-- 删除头像关联表,将头像信息存入 sys_user 表,执行前先执行 字段调整. --
|
||||
DROP TABLE user_avatar
|
|
@ -1,12 +0,0 @@
|
|||
-- ----------------------------
|
||||
-- Table structure for sys_users_jobs
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_users_jobs`;
|
||||
CREATE TABLE `sys_users_jobs` (
|
||||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||
`job_id` bigint(20) NOT NULL COMMENT '岗位ID',
|
||||
PRIMARY KEY (`user_id`,`job_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- sys_user 需要将岗位信息移入 sys_users_jobs 表中,这里不提供移入脚本--
|
||||
ALTER TABLE sys_user DROP job_id;
|
|
@ -1,17 +0,0 @@
|
|||
/** 将admin改为管理员 */
|
||||
update sys_user set is_admin = 1 WHERE user_id = 1;
|
||||
UPDATE sys_dept SET pid = NULL WHERE pid = 0;
|
||||
UPDATE sys_menu SET pid = NULL WHERE pid = 0;
|
||||
-- 创建零时表并复制数据 --
|
||||
create table sys_menu_tmp select * from sys_menu;
|
||||
create table sys_dept_tmp select * from sys_dept;
|
||||
-- 更新 sub_count --
|
||||
UPDATE sys_menu s set s.sub_count = (
|
||||
SELECT COUNT(1) FROM sys_menu_tmp tmp WHERE tmp.pid = s.menu_id
|
||||
);
|
||||
UPDATE sys_dept d set d.sub_count = (
|
||||
SELECT COUNT(1) FROM sys_dept_tmp tmp WHERE tmp.pid = d.dept_id
|
||||
);
|
||||
-- 删除零时表 --
|
||||
DROP TABLE sys_menu_tmp;
|
||||
DROP TABLE sys_dept_tmp;
|
38
sql/索引相关.sql
38
sql/索引相关.sql
|
@ -1,38 +0,0 @@
|
|||
-- code_ --
|
||||
CREATE INDEX idx_table_name ON code_column_config(table_name);
|
||||
|
||||
CREATE INDEX idx_table_name ON code_gen_config(table_name);
|
||||
|
||||
-- mnt_ --
|
||||
CREATE INDEX idx_ip ON mnt_server(ip);
|
||||
|
||||
-- sys_ --
|
||||
CREATE INDEX inx_is_pause ON sys_quartz_job(is_pause);
|
||||
|
||||
CREATE INDEX inx_pid ON sys_dept(pid);
|
||||
CREATE INDEX inx_enabled ON sys_dept(enabled);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_name ON sys_job(name);
|
||||
CREATE INDEX inx_enabled ON sys_job(enabled);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_title ON sys_menu(title);
|
||||
-- 将 ‘’ 设置成 NULL --
|
||||
UPDATE sys_menu set name = NULL WHERE name = '';
|
||||
CREATE UNIQUE INDEX uniq_name ON sys_menu(name);
|
||||
CREATE INDEX inx_pid ON sys_menu(pid);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_name ON sys_role(name);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_username ON sys_user(username);
|
||||
CREATE UNIQUE INDEX uniq_email ON sys_user(email);
|
||||
CREATE INDEX inx_enabled ON sys_user(enabled);
|
||||
|
||||
CREATE INDEX inx_log_type ON sys_log(log_type);
|
||||
|
||||
-- tool_ --
|
||||
-- 将 ‘’ 设置成 NULL --
|
||||
UPDATE tool_picture set md5code = NULL WHERE md5code = '';
|
||||
CREATE UNIQUE INDEX uniq_md5_code ON tool_picture(md5code);
|
||||
CREATE INDEX inx_url ON tool_picture(url);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_name ON tool_qiniu_content(name);
|
|
@ -7,18 +7,5 @@
|
|||
|
||||
### 初次使用
|
||||
eladmin.sql 为 eladmin 项目完整的 sql 脚本,适合于初次使用的用户
|
||||
|
||||
### 更新迭代
|
||||
对于老版本的,可以按下面的顺序执行
|
||||
|
||||
1. 删除所有外键.sql
|
||||
2. 表名修改.sql
|
||||
3. code_ 相关表字段调整.sql
|
||||
4. mnt_ 相关表字段调整.sql
|
||||
5. tool_ 相关表字段调整.sql
|
||||
6. sys_ 相关表字段调整.sql
|
||||
7. 用户岗位改动.sql
|
||||
8. 相关数据更新.sql
|
||||
9. 索引相关.sql
|
||||
10. 删除无用表.sql
|
||||
|
||||
脚本已经提供,其他的就需要自己慢慢调试了,祝成功!
|
31
sql/表名修改.sql
31
sql/表名修改.sql
|
@ -1,31 +0,0 @@
|
|||
/** 系统相关表统一 sys 前缀 */
|
||||
ALTER TABLE `user` RENAME TO `sys_user`;
|
||||
ALTER TABLE `role` RENAME TO `sys_role`;
|
||||
ALTER TABLE `menu` RENAME TO `sys_menu`;
|
||||
ALTER TABLE `dept` RENAME TO `sys_dept`;
|
||||
ALTER TABLE `job` RENAME TO `sys_job`;
|
||||
ALTER TABLE `dict` RENAME TO `sys_dict`;
|
||||
ALTER TABLE `dict_detail` RENAME TO `sys_dict_detail`;
|
||||
ALTER TABLE `log` RENAME TO `sys_log`;
|
||||
ALTER TABLE `visits` RENAME TO `sys_visits`;
|
||||
ALTER TABLE `verification_code` RENAME TO `sys_verification_code`;
|
||||
ALTER TABLE `monitor_server` RENAME TO `sys_monitor_server`;
|
||||
ALTER TABLE `quartz_job` RENAME TO `sys_quartz_job`;
|
||||
ALTER TABLE `quartz_log` RENAME TO `sys_quartz_log`;
|
||||
ALTER TABLE `users_roles` RENAME TO `sys_users_roles`;
|
||||
ALTER TABLE `roles_menus` RENAME TO `sys_roles_menus`;
|
||||
ALTER TABLE `roles_depts` RENAME TO `sys_roles_depts`;
|
||||
|
||||
/** 工具相关表 */
|
||||
ALTER TABLE `alipay_config` RENAME TO `tool_alipay_config`;
|
||||
ALTER TABLE `email_config` RENAME TO `tool_email_config`;
|
||||
ALTER TABLE `local_storage` RENAME TO `tool_local_storage`;
|
||||
ALTER TABLE `picture` RENAME TO `tool_picture`;
|
||||
ALTER TABLE `qiniu_config` RENAME TO `tool_qiniu_config`;
|
||||
ALTER TABLE `qiniu_content` RENAME TO `tool_qiniu_content`;
|
||||
|
||||
/** 代码生成器相关 */
|
||||
ALTER TABLE `column_config` RENAME TO `code_column_config`;
|
||||
ALTER TABLE `gen_config` RENAME TO `code_gen_config`;
|
||||
|
||||
|
Loading…
Reference in New Issue