mirror of https://github.com/elunez/eladmin
commit
f317c72b79
20
README.md
20
README.md
|
@ -84,26 +84,6 @@
|
||||||
- eladmin-tools 系统第三方工具模块
|
- eladmin-tools 系统第三方工具模块
|
||||||
- eladmin-generator 系统代码生成模块
|
- eladmin-generator 系统代码生成模块
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 系统预览
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<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.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.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.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>
|
|
||||||
|
|
||||||
#### 特别鸣谢
|
#### 特别鸣谢
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,11 @@ import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.poi.excel.BigExcelWriter;
|
import cn.hutool.poi.excel.BigExcelWriter;
|
||||||
import cn.hutool.poi.excel.ExcelUtil;
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.exception.BadRequestException;
|
||||||
import org.apache.poi.ss.usermodel.CellType;
|
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFCell;
|
|
||||||
import org.apache.poi.xssf.streaming.SXSSFRow;
|
|
||||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -217,8 +213,6 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||||
sheet.trackAllColumnsForAutoSizing();
|
sheet.trackAllColumnsForAutoSizing();
|
||||||
//列宽自适应
|
//列宽自适应
|
||||||
writer.autoSizeColumnAll();
|
writer.autoSizeColumnAll();
|
||||||
//列宽自适应支持中文单元格
|
|
||||||
sizeChineseColumn(sheet, writer);
|
|
||||||
//response为HttpServletResponse对象
|
//response为HttpServletResponse对象
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
@ -231,33 +225,6 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||||
IoUtil.close(out);
|
IoUtil.close(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 自适应宽度(中文支持)
|
|
||||||
*/
|
|
||||||
private static void sizeChineseColumn(SXSSFSheet sheet, BigExcelWriter writer) {
|
|
||||||
for (int columnNum = 0; columnNum < writer.getColumnCount(); columnNum++) {
|
|
||||||
int columnWidth = sheet.getColumnWidth(columnNum) / 256;
|
|
||||||
for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) {
|
|
||||||
SXSSFRow currentRow;
|
|
||||||
if (sheet.getRow(rowNum) == null) {
|
|
||||||
currentRow = sheet.createRow(rowNum);
|
|
||||||
} else {
|
|
||||||
currentRow = sheet.getRow(rowNum);
|
|
||||||
}
|
|
||||||
if (currentRow.getCell(columnNum) != null) {
|
|
||||||
SXSSFCell currentCell = currentRow.getCell(columnNum);
|
|
||||||
if (currentCell.getCellTypeEnum() == CellType.STRING) {
|
|
||||||
int length = currentCell.getStringCellValue().getBytes().length;
|
|
||||||
if (columnWidth < length) {
|
|
||||||
columnWidth = length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sheet.setColumnWidth(columnNum, columnWidth * 256);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFileType(String type) {
|
public static String getFileType(String type) {
|
||||||
String documents = "txt doc pdf ppt pps xlsx xls docx";
|
String documents = "txt doc pdf ppt pps xlsx xls docx";
|
||||||
String music = "mp3 wav wma mpa ram ra aac aif m4a";
|
String music = "mp3 wav wma mpa ram ra aac aif m4a";
|
||||||
|
|
|
@ -15,14 +15,22 @@
|
||||||
*/
|
*/
|
||||||
package me.zhengjie.config;
|
package me.zhengjie.config;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
import org.springframework.web.filter.CorsFilter;
|
import org.springframework.web.filter.CorsFilter;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebMvcConfigurer
|
* WebMvcConfigurer
|
||||||
|
@ -62,4 +70,18 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||||
registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0);
|
registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0);
|
||||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
|
||||||
|
List<MediaType> supportMediaTypeList = new ArrayList<>();
|
||||||
|
supportMediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
FastJsonConfig config = new FastJsonConfig();
|
||||||
|
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
converter.setFastJsonConfig(config);
|
||||||
|
converter.setSupportedMediaTypes(supportMediaTypeList);
|
||||||
|
converter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
|
converters.add(converter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TokenProvider implements InitializingBean {
|
||||||
|
|
||||||
private final SecurityProperties properties;
|
private final SecurityProperties properties;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
public static final String AUTHORITIES_KEY = "auth";
|
public static final String AUTHORITIES_KEY = "user";
|
||||||
private JwtParser jwtParser;
|
private JwtParser jwtParser;
|
||||||
private JwtBuilder jwtBuilder;
|
private JwtBuilder jwtBuilder;
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ public class TokenProvider implements InitializingBean {
|
||||||
return jwtBuilder
|
return jwtBuilder
|
||||||
// 加入ID确保生成的 Token 都不一致
|
// 加入ID确保生成的 Token 都不一致
|
||||||
.setId(IdUtil.simpleUUID())
|
.setId(IdUtil.simpleUUID())
|
||||||
|
.claim(AUTHORITIES_KEY, authentication.getName())
|
||||||
.setSubject(authentication.getName())
|
.setSubject(authentication.getName())
|
||||||
.compact();
|
.compact();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
|
@ -85,19 +85,13 @@
|
||||||
{{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }}
|
{{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<#elseif column.columnType != 'Timestamp'>
|
|
||||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" />
|
|
||||||
<#else>
|
<#else>
|
||||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" />
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.${column.changeColumnName}) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
</#if>
|
||||||
<el-table-column v-permission="['admin','${changeClassName}:edit','${changeClassName}:del']" label="操作" width="150px" align="center">
|
<el-table-column v-if="checkPer(['admin','${changeClassName}:edit','${changeClassName}:del'])" label="操作" width="150px" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
|
|
|
@ -510,7 +510,7 @@ CREATE TABLE `sys_role` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
BEGIN;
|
||||||
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 (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');
|
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '本级', NULL, 'admin', '2018-11-23 13:09:06', '2020-09-05 10:45:12');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
@ -524,13 +524,6 @@ CREATE TABLE `sys_roles_depts` (
|
||||||
KEY `FK7qg6itn5ajdoa9h9o78v9ksur` (`dept_id`) USING BTREE
|
KEY `FK7qg6itn5ajdoa9h9o78v9ksur` (`dept_id`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色部门关联';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色部门关联';
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_roles_depts
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `sys_roles_depts` VALUES (2, 6);
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_roles_menus
|
-- Table structure for sys_roles_menus
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
@ -829,4 +822,4 @@ CREATE TABLE `tool_qiniu_content` (
|
||||||
BEGIN;
|
BEGIN;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
Loading…
Reference in New Issue