mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-02-09 10:21:56 +08:00
Compare commits
10 Commits
0ef1daeefe
...
5f95728152
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f95728152 | ||
|
|
85ff6a9910 | ||
|
|
cab5beaca7 | ||
|
|
fc8069a250 | ||
|
|
924e705dca | ||
|
|
049ba453d1 | ||
|
|
4aa261e8f7 | ||
|
|
914a6620f5 | ||
|
|
3dcee7057d | ||
|
|
93111d622a |
2
pom.xml
2
pom.xml
@@ -36,7 +36,7 @@
|
|||||||
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
|
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
|
||||||
|
|
||||||
<!-- override dependency version -->
|
<!-- override dependency version -->
|
||||||
<tomcat.version>9.0.96</tomcat.version>
|
<tomcat.version>9.0.98</tomcat.version>
|
||||||
<logback.version>1.2.13</logback.version>
|
<logback.version>1.2.13</logback.version>
|
||||||
<spring-framework.version>5.3.39</spring-framework.version>
|
<spring-framework.version>5.3.39</spring-framework.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@@ -252,4 +252,8 @@ public class SysOperLog extends BaseEntity
|
|||||||
{
|
{
|
||||||
this.costTime = costTime;
|
this.costTime = costTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toLogString(){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为boolean<br>
|
* 转换为boolean<br>
|
||||||
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
* String支持的值为:true、false、yes、ok、no、1、0、是、否, 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
@@ -569,10 +569,12 @@ public class Convert
|
|||||||
case "yes":
|
case "yes":
|
||||||
case "ok":
|
case "ok":
|
||||||
case "1":
|
case "1":
|
||||||
|
case "是":
|
||||||
return true;
|
return true;
|
||||||
case "false":
|
case "false":
|
||||||
case "no":
|
case "no":
|
||||||
case "0":
|
case "0":
|
||||||
|
case "否":
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|||||||
@@ -283,6 +283,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
|
||||||
|
*
|
||||||
|
* @param str 要截取的字符串
|
||||||
|
* @param open 起始字符串
|
||||||
|
* @param close 结束字符串
|
||||||
|
* @return 截取结果
|
||||||
|
*/
|
||||||
|
public static String substringBetweenLast(final String str, final String open, final String close)
|
||||||
|
{
|
||||||
|
if (isEmpty(str) || isEmpty(open) || isEmpty(close))
|
||||||
|
{
|
||||||
|
return NULLSTR;
|
||||||
|
}
|
||||||
|
final int start = str.indexOf(open);
|
||||||
|
if (start != INDEX_NOT_FOUND)
|
||||||
|
{
|
||||||
|
final int end = str.lastIndexOf(close);
|
||||||
|
if (end != INDEX_NOT_FOUND)
|
||||||
|
{
|
||||||
|
return str.substring(start + open.length(), end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULLSTR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否为空,并且不是空白字符
|
* 判断是否为空,并且不是空白字符
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1000,6 +1000,7 @@ public class ExcelUtil<T>
|
|||||||
String separator = attr.separator();
|
String separator = attr.separator();
|
||||||
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
|
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
|
||||||
{
|
{
|
||||||
|
cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat));
|
||||||
cell.setCellValue(parseDateToStr(dateFormat, value));
|
cell.setCellValue(parseDateToStr(dateFormat, value));
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
|
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable
|
|||||||
* @param list 列表数据
|
* @param list 列表数据
|
||||||
* @param total 总记录数
|
* @param total 总记录数
|
||||||
*/
|
*/
|
||||||
public TableDataInfo(List<?> list, int total)
|
public TableDataInfo(List<?> list, long total)
|
||||||
{
|
{
|
||||||
this.rows = list;
|
this.rows = list;
|
||||||
this.total = total;
|
this.total = total;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.core.utils.ExceptionUtil;
|
||||||
import com.ruoyi.common.core.utils.ServletUtils;
|
import com.ruoyi.common.core.utils.ServletUtils;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.ip.IpUtils;
|
import com.ruoyi.common.core.utils.ip.IpUtils;
|
||||||
@@ -53,7 +55,7 @@ public class LogAspect
|
|||||||
* 处理请求前执行
|
* 处理请求前执行
|
||||||
*/
|
*/
|
||||||
@Before(value = "@annotation(controllerLog)")
|
@Before(value = "@annotation(controllerLog)")
|
||||||
public void boBefore(JoinPoint joinPoint, Log controllerLog)
|
public void doBefore(JoinPoint joinPoint, Log controllerLog)
|
||||||
{
|
{
|
||||||
TIME_THREADLOCAL.set(System.currentTimeMillis());
|
TIME_THREADLOCAL.set(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -101,7 +103,7 @@ public class LogAspect
|
|||||||
if (e != null)
|
if (e != null)
|
||||||
{
|
{
|
||||||
operLog.setStatus(BusinessStatus.FAIL.ordinal());
|
operLog.setStatus(BusinessStatus.FAIL.ordinal());
|
||||||
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
|
operLog.setErrorMsg(StringUtils.substring(Convert.toStr(e.getMessage(), ExceptionUtil.getExceptionMessage(e)), 0, 2000));
|
||||||
}
|
}
|
||||||
// 设置方法名称
|
// 设置方法名称
|
||||||
String className = joinPoint.getTarget().getClass().getName();
|
String className = joinPoint.getTarget().getClass().getName();
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ public class TokenService
|
|||||||
|
|
||||||
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
|
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
|
||||||
|
|
||||||
private final static long expireTime = CacheConstants.EXPIRATION;
|
private final static long TOKEN_EXPIRE_TIME = CacheConstants.EXPIRATION;
|
||||||
|
|
||||||
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
||||||
|
|
||||||
private final static Long MILLIS_MINUTE_TEN = CacheConstants.REFRESH_TIME * MILLIS_MINUTE;
|
private final static Long TOKEN_REFRESH_THRESHOLD_MINUTES = CacheConstants.REFRESH_TIME * MILLIS_MINUTE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建令牌
|
* 创建令牌
|
||||||
@@ -65,7 +65,7 @@ public class TokenService
|
|||||||
// 接口返回信息
|
// 接口返回信息
|
||||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||||
rspMap.put("expires_in", expireTime);
|
rspMap.put("expires_in", TOKEN_EXPIRE_TIME);
|
||||||
return rspMap;
|
return rspMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ public class TokenService
|
|||||||
{
|
{
|
||||||
long expireTime = loginUser.getExpireTime();
|
long expireTime = loginUser.getExpireTime();
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
if (expireTime - currentTime <= MILLIS_MINUTE_TEN)
|
if (expireTime - currentTime <= TOKEN_REFRESH_THRESHOLD_MINUTES)
|
||||||
{
|
{
|
||||||
refreshToken(loginUser);
|
refreshToken(loginUser);
|
||||||
}
|
}
|
||||||
@@ -161,10 +161,10 @@ public class TokenService
|
|||||||
public void refreshToken(LoginUser loginUser)
|
public void refreshToken(LoginUser loginUser)
|
||||||
{
|
{
|
||||||
loginUser.setLoginTime(System.currentTimeMillis());
|
loginUser.setLoginTime(System.currentTimeMillis());
|
||||||
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
loginUser.setExpireTime(loginUser.getLoginTime() + TOKEN_EXPIRE_TIME * MILLIS_MINUTE);
|
||||||
// 根据uuid将loginUser缓存
|
// 根据uuid将loginUser缓存
|
||||||
String userKey = getTokenKey(loginUser.getToken());
|
String userKey = getTokenKey(loginUser.getToken());
|
||||||
redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
redisService.setCacheObject(userKey, loginUser, TOKEN_EXPIRE_TIME, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTokenKey(String token)
|
private String getTokenKey(String token)
|
||||||
|
|||||||
@@ -129,9 +129,9 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
int row = genTableMapper.updateGenTable(genTable);
|
int row = genTableMapper.updateGenTable(genTable);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
for (GenTableColumn cenTableColumn : genTable.getColumns())
|
for (GenTableColumn genTableColumn : genTable.getColumns())
|
||||||
{
|
{
|
||||||
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
|
genTableColumnMapper.updateGenTableColumn(genTableColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,6 +414,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
{
|
{
|
||||||
throw new ServiceException("树名称字段不能为空");
|
throw new ServiceException("树名称字段不能为空");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
|
else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
|
||||||
{
|
{
|
||||||
if (StringUtils.isEmpty(genTable.getSubTableName()))
|
if (StringUtils.isEmpty(genTable.getSubTableName()))
|
||||||
@@ -426,7 +427,6 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置主键列信息
|
* 设置主键列信息
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ public class ${ClassName} extends ${Entity}
|
|||||||
{
|
{
|
||||||
return $column.javaField;
|
return $column.javaField;
|
||||||
}
|
}
|
||||||
#end
|
|
||||||
#end
|
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
public List<${subClassName}> get${subClassName}List()
|
public List<${subClassName}> get${subClassName}List()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:add']"
|
v-hasPermi="['${permissionPrefix}:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -144,21 +144,21 @@
|
|||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
v-hasPermi="['${permissionPrefix}:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="handleAdd(scope.row)"
|
@click="handleAdd(scope.row)"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:add']"
|
v-hasPermi="['${permissionPrefix}:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
v-hasPermi="['${permissionPrefix}:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -453,7 +453,7 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
this.form.${treeParentCode} = row.${treeCode};
|
this.form.${treeParentCode} = row.${treeParentCode};
|
||||||
}
|
}
|
||||||
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:add']"
|
v-hasPermi="['${permissionPrefix}:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
v-hasPermi="['${permissionPrefix}:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
v-hasPermi="['${permissionPrefix}:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
v-hasPermi="['${permissionPrefix}:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
@@ -158,14 +158,14 @@
|
|||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
v-hasPermi="['${permissionPrefix}:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
v-hasPermi="['${permissionPrefix}:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
plain
|
plain
|
||||||
icon="Plus"
|
icon="Plus"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:add']"
|
v-hasPermi="['${permissionPrefix}:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -136,9 +136,9 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">新增</el-button>
|
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -420,7 +420,7 @@ async function handleUpdate(row) {
|
|||||||
reset();
|
reset();
|
||||||
await getTreeselect();
|
await getTreeselect();
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
form.value.${treeParentCode} = row.${treeCode};
|
form.value.${treeParentCode} = row.${treeParentCode};
|
||||||
}
|
}
|
||||||
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
plain
|
plain
|
||||||
icon="Plus"
|
icon="Plus"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:add']"
|
v-hasPermi="['${permissionPrefix}:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
icon="Edit"
|
icon="Edit"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
v-hasPermi="['${permissionPrefix}:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
icon="Delete"
|
icon="Delete"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
v-hasPermi="['${permissionPrefix}:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
plain
|
plain
|
||||||
icon="Download"
|
icon="Download"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
v-hasPermi="['${permissionPrefix}:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
@@ -148,8 +148,8 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class JobInvokeUtil
|
|||||||
*/
|
*/
|
||||||
public static List<Object[]> getMethodParams(String invokeTarget)
|
public static List<Object[]> getMethodParams(String invokeTarget)
|
||||||
{
|
{
|
||||||
String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")");
|
String methodStr = StringUtils.substringBetweenLast(invokeTarget, "(", ")");
|
||||||
if (StringUtils.isEmpty(methodStr))
|
if (StringUtils.isEmpty(methodStr))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.ruoyi.system.log;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Auther : qzy
|
||||||
|
* @Date: 2024/1/24 16:55
|
||||||
|
**/
|
||||||
|
public class AccessAddressUtils {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
|
||||||
|
* 参考文章: http://developer.51cto.com/art/201111/305181.htm
|
||||||
|
*
|
||||||
|
* 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
|
||||||
|
* 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。
|
||||||
|
*
|
||||||
|
* 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130,
|
||||||
|
* 192.168.1.100
|
||||||
|
*
|
||||||
|
* 用户真实IP为: 192.168.1.110
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getIpAddress(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.ruoyi.system.log;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志记录所有请求 工具类
|
||||||
|
* @Auther : qzy
|
||||||
|
* @Date: 2024/1/24 16:55
|
||||||
|
**/
|
||||||
|
public final class LoggerUtils {
|
||||||
|
|
||||||
|
public static final String LOGGER_RETURN = "LOGGER_RETURN";
|
||||||
|
|
||||||
|
private LoggerUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户端ip地址
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getCliectIp(HttpServletRequest request)
|
||||||
|
{
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || Objects.equals(ip.trim(), "") || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || Objects.equals(ip.trim(), "") || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || Objects.equals(ip.trim(), "") || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多个路由时,取第一个非unknown的ip
|
||||||
|
final String[] arr = ip.split(",");
|
||||||
|
for (final String str : arr) {
|
||||||
|
if (!"unknown".equalsIgnoreCase(str)) {
|
||||||
|
ip = str;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为ajax请求
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getRequestType(HttpServletRequest request) {
|
||||||
|
return request.getHeader("X-Requested-With");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package com.ruoyi.system.log.aop;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.ruoyi.system.log.AccessAddressUtils;
|
||||||
|
import com.ruoyi.system.log.LoggerUtils;
|
||||||
|
import com.ruoyi.system.log.dto.LoggerEntity;
|
||||||
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestAttributes;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : qzy
|
||||||
|
* @since : 2024/1/24 16:36
|
||||||
|
* <p style='color:yellow'>
|
||||||
|
* 通用请求日志打印处理类,方便联调/测试,生产环境视情况可选择是否保留
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
**/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class WebRequestLogAspect {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(WebRequestLogAspect.class);
|
||||||
|
|
||||||
|
private final ThreadLocal<LoggerEntity> threadLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
|
private final ThreadLocal<Long> startTimeLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
|
|
||||||
|
@Pointcut("within(com.ruoyi.*.controller.*)")
|
||||||
|
public void webRequestLog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before("webRequestLog()")
|
||||||
|
public void doBefore(JoinPoint joinPoint) {
|
||||||
|
try {
|
||||||
|
// 接收到请求,记录请求内容
|
||||||
|
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||||
|
if (requestAttributes == null) {
|
||||||
|
// 防止拦截的不是接口层,获取不到请求数据的情况
|
||||||
|
threadLocal.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ServletRequestAttributes attributes = (ServletRequestAttributes) requestAttributes;
|
||||||
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
//处理特殊请求,直接返回
|
||||||
|
// if (request.getRequestURI().contains("admin/sysLog")) {
|
||||||
|
// threadLocal.remove();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
String method = request.getMethod();
|
||||||
|
String params;
|
||||||
|
String post_code = "POST";
|
||||||
|
if (post_code.equals(method)) {
|
||||||
|
Object[] paramsArray = joinPoint.getArgs();
|
||||||
|
params = argsArrayToString(paramsArray);
|
||||||
|
} else {
|
||||||
|
//获取请求参数信息
|
||||||
|
params = JSON.toJSONString(request.getParameterMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
LoggerEntity optLog = new LoggerEntity();
|
||||||
|
//设置请求方法
|
||||||
|
optLog.setId(RandomUtils.nextLong());
|
||||||
|
optLog.setMethodCode(request.getMethod());
|
||||||
|
//设置请求类型(json|普通请求)
|
||||||
|
optLog.setTypeCode(LoggerUtils.getRequestType(request));
|
||||||
|
//设置请求参数内容json字符串
|
||||||
|
optLog.setParamData(params);
|
||||||
|
//设置请求地址
|
||||||
|
optLog.setUri(request.getRequestURI());
|
||||||
|
//设置sessionId
|
||||||
|
optLog.setSessionId(request.getSession().getId());
|
||||||
|
//设置调用的java类
|
||||||
|
optLog.setJavaBean(joinPoint.getSignature().getDeclaringTypeName());
|
||||||
|
//设置调用的java方法
|
||||||
|
optLog.setJavaMethod(joinPoint.getSignature().getName());
|
||||||
|
// optLog.setParamData(params);
|
||||||
|
//设置调用方ip
|
||||||
|
optLog.setClientIp(AccessAddressUtils.getIpAddress(request));
|
||||||
|
threadLocal.set(optLog);
|
||||||
|
startTimeLocal.set(System.currentTimeMillis());
|
||||||
|
LOGGER.info(optLog.toLogStr());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("***操作请求日志记录失败doBefore()***", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterReturning(returning = "result", pointcut = "webRequestLog()")
|
||||||
|
public void doAfterReturning(Object result) {
|
||||||
|
// 处理完请求,返回内容
|
||||||
|
if (threadLocal.get() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LoggerEntity optLog = threadLocal.get();
|
||||||
|
Long startTime = startTimeLocal.get();
|
||||||
|
optLog.setReturnData(JSON.toJSONString(result));
|
||||||
|
optLog.setTimeConsuming((int) (System.currentTimeMillis() - startTime));
|
||||||
|
LOGGER.info(optLog.toLogStr());
|
||||||
|
threadLocal.remove();
|
||||||
|
startTimeLocal.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数拼装
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
private String argsArrayToString(Object[] paramsArray) {
|
||||||
|
StringBuilder params = new StringBuilder();
|
||||||
|
if (paramsArray != null) {
|
||||||
|
for (Object o : paramsArray) {
|
||||||
|
if (o instanceof MultipartFile || o instanceof MultipartFile[]) {
|
||||||
|
// 当导入文件时,不打印输出二进制
|
||||||
|
params.append("上传文件 ");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Object jsonObj = JSON.toJSON(o);
|
||||||
|
params.append(jsonObj.toString()).append(" ");
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.debug("参数json解析异常,{}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params.toString().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
package com.ruoyi.system.log.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志记录所有请求 实体类
|
||||||
|
* @Auther : qzy
|
||||||
|
* @Date: 2024/1/24 16:55
|
||||||
|
**/
|
||||||
|
public class LoggerEntity implements Serializable {
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 客户端请求ip
|
||||||
|
*/
|
||||||
|
private String clientIp;
|
||||||
|
/**
|
||||||
|
* 客户端请求路径
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
/**
|
||||||
|
* 终端请求方式,普通请求,ajax请求
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 请求方式method,post,get等
|
||||||
|
*/
|
||||||
|
private String method;
|
||||||
|
/**
|
||||||
|
* 请求参数内容,json
|
||||||
|
*/
|
||||||
|
private String paramData;
|
||||||
|
/**
|
||||||
|
* 请求接口唯一session标识
|
||||||
|
*/
|
||||||
|
private String sessionId;
|
||||||
|
/**
|
||||||
|
* 请求时间
|
||||||
|
*/
|
||||||
|
private Timestamp time;
|
||||||
|
/**
|
||||||
|
* 接口返回时间
|
||||||
|
*/
|
||||||
|
private String returnTime;
|
||||||
|
/**
|
||||||
|
* 接口返回数据json
|
||||||
|
*/
|
||||||
|
private String returnData;
|
||||||
|
/**
|
||||||
|
* 请求时httpStatusCode代码,如:200,400,404等
|
||||||
|
*/
|
||||||
|
private String httpStatusCode;
|
||||||
|
/**
|
||||||
|
* 请求耗时秒单位
|
||||||
|
*/
|
||||||
|
private int timeConsuming;
|
||||||
|
private String javaBean;
|
||||||
|
private String javaMethod;
|
||||||
|
private String operaAdmin;
|
||||||
|
private String operaSource;
|
||||||
|
private String typeCode;
|
||||||
|
private String methodCode;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientIp() {
|
||||||
|
return clientIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientIp(String clientIp) {
|
||||||
|
this.clientIp = clientIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamData() {
|
||||||
|
return paramData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParamData(String paramData) {
|
||||||
|
this.paramData = paramData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSessionId() {
|
||||||
|
return sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSessionId(String sessionId) {
|
||||||
|
this.sessionId = sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Timestamp getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(Timestamp time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReturnTime() {
|
||||||
|
return returnTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReturnTime(String returnTime) {
|
||||||
|
this.returnTime = returnTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReturnData() {
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReturnData(String returnData) {
|
||||||
|
this.returnData = returnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttpStatusCode() {
|
||||||
|
return httpStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttpStatusCode(String httpStatusCode) {
|
||||||
|
this.httpStatusCode = httpStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimeConsuming() {
|
||||||
|
return timeConsuming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeConsuming(int timeConsuming) {
|
||||||
|
this.timeConsuming = timeConsuming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJavaBean(String javaBean) {
|
||||||
|
this.javaBean = javaBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJavaBean() {
|
||||||
|
return javaBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJavaMethod(String javaMethod) {
|
||||||
|
this.javaMethod = javaMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJavaMethod() {
|
||||||
|
return javaMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperaAdmin(String operaAdmin) {
|
||||||
|
|
||||||
|
this.operaAdmin = operaAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperaAdmin() {
|
||||||
|
return operaAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperaSource(String operaSource) {
|
||||||
|
this.operaSource = operaSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperaSource() {
|
||||||
|
return operaSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeCode(String typeCode) {
|
||||||
|
this.typeCode = typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeCode() {
|
||||||
|
return typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethodCode(String methodCode) {
|
||||||
|
this.methodCode = methodCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethodCode() {
|
||||||
|
return methodCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toLogStr(){
|
||||||
|
return String.format("\n==>请求IP:{%s},\n==>请求路径:{%s} - {%s},\n==>方法名:{%s},\n==>入参:{%s},\n==>出参:{%s}", this.clientIp, this.methodCode, this.uri, this.javaMethod, this.paramData,this.returnData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 统一请求日志处理工具
|
||||||
|
*/
|
||||||
|
package com.ruoyi.system.log;
|
||||||
@@ -365,7 +365,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
/**
|
/**
|
||||||
* 获取路由名称,如没有配置路由名称则取路由地址
|
* 获取路由名称,如没有配置路由名称则取路由地址
|
||||||
*
|
*
|
||||||
* @param routerName 路由名称
|
* @param name 路由名称
|
||||||
* @param path 路由地址
|
* @param path 路由地址
|
||||||
* @return 路由名称(驼峰格式)
|
* @return 路由名称(驼峰格式)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
|||||||
// 多角色设置permissions属性,以便数据权限匹配权限
|
// 多角色设置permissions属性,以便数据权限匹配权限
|
||||||
for (SysRole role : roles)
|
for (SysRole role : roles)
|
||||||
{
|
{
|
||||||
if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL))
|
if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && !role.isAdmin())
|
||||||
{
|
{
|
||||||
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
||||||
role.setPermissions(rolePerms);
|
role.setPermissions(rolePerms);
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
<if test="userName != null and userName != ''">user_name,</if>
|
|
||||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||||
|
|||||||
@@ -129,10 +129,6 @@ aside {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center
|
text-align: center
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,11 +117,9 @@
|
|||||||
|
|
||||||
/** 表格布局 **/
|
/** 表格布局 **/
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
position: relative;
|
display: flex;
|
||||||
height: 32px;
|
justify-content: flex-end;
|
||||||
margin-bottom: 10px;
|
margin-top: 20px;
|
||||||
margin-top: 15px;
|
|
||||||
padding: 10px 20px !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tree border */
|
/* tree border */
|
||||||
@@ -132,11 +130,6 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container .el-pagination {
|
|
||||||
right: 0;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.pagination-container .el-pagination > .el-pagination__jump {
|
.pagination-container .el-pagination > .el-pagination__jump {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
@@ -201,8 +194,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.card-box {
|
.card-box {
|
||||||
padding-right: 15px;
|
|
||||||
padding-left: 15px;
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
:headers="headers"
|
:headers="headers"
|
||||||
class="upload-file-uploader"
|
class="upload-file-uploader"
|
||||||
ref="fileUpload"
|
ref="fileUpload"
|
||||||
|
v-if="!disabled"
|
||||||
>
|
>
|
||||||
<!-- 上传按钮 -->
|
<!-- 上传按钮 -->
|
||||||
<el-button size="mini" type="primary">选取文件</el-button>
|
<el-button size="mini" type="primary">选取文件</el-button>
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
</el-link>
|
</el-link>
|
||||||
<div class="ele-upload-list__item-content-action">
|
<div class="ele-upload-list__item-content-action">
|
||||||
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
<el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled">删除</el-link>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
@@ -50,22 +51,27 @@ export default {
|
|||||||
// 数量限制
|
// 数量限制
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5
|
||||||
},
|
},
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: {
|
fileSize: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5
|
||||||
},
|
},
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
fileType: {
|
fileType: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
default: () => ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"]
|
||||||
},
|
},
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
isShowTip: {
|
isShowTip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
// 禁用组件(仅查看文件)
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
routes() {
|
routes() {
|
||||||
return this.$store.getters.permission_routes
|
return this.$store.getters.defaultRoutes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 32px 16px;
|
|
||||||
}
|
}
|
||||||
.pagination-container.hidden {
|
.pagination-container.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||||
|
|
||||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
|
<breadcrumb v-if="!topNav" id="breadcrumb-container" class="breadcrumb-container" />
|
||||||
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
|
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" />
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu">
|
||||||
<template v-if="device!=='mobile'">
|
<template v-if="device!=='mobile'">
|
||||||
|
|||||||
@@ -82,28 +82,13 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
|||||||
|
|
||||||
function filterChildren(childrenMap, lastRouter = false) {
|
function filterChildren(childrenMap, lastRouter = false) {
|
||||||
var children = []
|
var children = []
|
||||||
childrenMap.forEach((el, index) => {
|
childrenMap.forEach(el => {
|
||||||
if (el.children && el.children.length) {
|
el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path
|
||||||
if (el.component === 'ParentView' && !lastRouter) {
|
if (el.children && el.children.length && el.component === 'ParentView') {
|
||||||
el.children.forEach(c => {
|
|
||||||
c.path = el.path + '/' + c.path
|
|
||||||
if (c.children && c.children.length) {
|
|
||||||
children = children.concat(filterChildren(c.children, c))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
children.push(c)
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lastRouter) {
|
|
||||||
el.path = lastRouter.path + '/' + el.path
|
|
||||||
if (el.children && el.children.length) {
|
|
||||||
children = children.concat(filterChildren(el.children, el))
|
children = children.concat(filterChildren(el.children, el))
|
||||||
return
|
} else {
|
||||||
|
children.push(el)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
children = children.concat(el)
|
|
||||||
})
|
})
|
||||||
return children
|
return children
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用js方法封装处理
|
* 通用js方法封装处理
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
@@ -165,37 +163,19 @@ export function handleTree(data, id, parentId, children) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var childrenListMap = {};
|
var childrenListMap = {};
|
||||||
var nodeIds = {};
|
|
||||||
var tree = [];
|
var tree = [];
|
||||||
|
|
||||||
for (let d of data) {
|
for (let d of data) {
|
||||||
let parentId = d[config.parentId];
|
let id = d[config.id];
|
||||||
if (childrenListMap[parentId] == null) {
|
childrenListMap[id] = d;
|
||||||
childrenListMap[parentId] = [];
|
|
||||||
}
|
|
||||||
nodeIds[d[config.id]] = d;
|
|
||||||
childrenListMap[parentId].push(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let d of data) {
|
for (let d of data) {
|
||||||
let parentId = d[config.parentId];
|
let parentId = d[config.parentId]
|
||||||
if (nodeIds[parentId] == null) {
|
let parentObj = childrenListMap[parentId]
|
||||||
|
if (!parentObj) {
|
||||||
tree.push(d);
|
tree.push(d);
|
||||||
}
|
} else {
|
||||||
}
|
parentObj[config.childrenList].push(d)
|
||||||
|
|
||||||
for (let t of tree) {
|
|
||||||
adaptToChildrenList(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
function adaptToChildrenList(o) {
|
|
||||||
if (childrenListMap[o[config.id]] !== null) {
|
|
||||||
o[config.childrenList] = childrenListMap[o[config.id]];
|
|
||||||
}
|
|
||||||
if (o[config.childrenList]) {
|
|
||||||
for (let c of o[config.childrenList]) {
|
|
||||||
adaptToChildrenList(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tree;
|
return tree;
|
||||||
@@ -227,6 +207,18 @@ export function tansParams(params) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返回项目路径
|
||||||
|
export function getNormalPath(p) {
|
||||||
|
if (p.length === 0 || !p || p == 'undefined') {
|
||||||
|
return p
|
||||||
|
};
|
||||||
|
let res = p.replace('//', '/')
|
||||||
|
if (res[res.length - 1] === '/') {
|
||||||
|
return res.slice(0, res.length - 1)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
// 验证是否为blob格式
|
// 验证是否为blob格式
|
||||||
export function blobValidate(data) {
|
export function blobValidate(data) {
|
||||||
return data.type !== 'application/json'
|
return data.type !== 'application/json'
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container home">
|
<div class="app-container home">
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :sm="24" :lg="24">
|
|
||||||
<blockquote class="text-warning" style="font-size: 14px">
|
|
||||||
阿里云服务器折扣区<el-link href="http://aly.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link> 腾讯云服务器秒杀区<el-link href="http://txy.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link>
|
|
||||||
</blockquote>
|
|
||||||
<hr />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :sm="24" :lg="12" style="padding-left: 20px">
|
<el-col :sm="24" :lg="12" style="padding-left: 20px">
|
||||||
<h2>若依后台管理框架</h2>
|
<h2>若依后台管理框架</h2>
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export default {
|
|||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 默认排序
|
// 默认排序
|
||||||
defaultSort: {prop: 'accessTime', order: 'descending'},
|
defaultSort: { prop: "accessTime", order: "descending" },
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ export default {
|
|||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 默认排序
|
// 默认排序
|
||||||
defaultSort: {prop: 'operTime', order: 'descending'},
|
defaultSort: { prop: "operTime", order: "descending" },
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|||||||
@@ -80,36 +80,18 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
|
<el-table ref="tables" v-loading="loading" :data="tableList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||||
<el-table-column type="selection" align="center" width="55"></el-table-column>
|
<el-table-column type="selection" align="center" width="55"></el-table-column>
|
||||||
<el-table-column label="序号" type="index" width="50" align="center">
|
<el-table-column label="序号" type="index" width="50" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="表名称" align="center" prop="tableName" :show-overflow-tooltip="true" width="120" />
|
||||||
label="表名称"
|
<el-table-column label="表描述" align="center" prop="tableComment" :show-overflow-tooltip="true" width="120" />
|
||||||
align="center"
|
<el-table-column label="实体" align="center" prop="className" :show-overflow-tooltip="true" width="120" />
|
||||||
prop="tableName"
|
<el-table-column label="创建时间" align="center" prop="createTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="160" />
|
||||||
:show-overflow-tooltip="true"
|
<el-table-column label="更新时间" align="center" prop="updateTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="160" />
|
||||||
width="120"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="表描述"
|
|
||||||
align="center"
|
|
||||||
prop="tableComment"
|
|
||||||
:show-overflow-tooltip="true"
|
|
||||||
width="120"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="实体"
|
|
||||||
align="center"
|
|
||||||
prop="className"
|
|
||||||
:show-overflow-tooltip="true"
|
|
||||||
width="120"
|
|
||||||
/>
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
|
||||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -212,6 +194,8 @@ export default {
|
|||||||
tableList: [],
|
tableList: [],
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: "",
|
dateRange: "",
|
||||||
|
// 默认排序
|
||||||
|
defaultSort: { prop: "createTime", order: "descending" },
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -229,6 +213,8 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.queryParams.orderByColumn = this.defaultSort.prop;
|
||||||
|
this.queryParams.isAsc = this.defaultSort.order;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
@@ -287,7 +273,8 @@ export default {
|
|||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.dateRange = [];
|
this.dateRange = [];
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.queryParams.pageNum = 1;
|
||||||
|
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
||||||
},
|
},
|
||||||
/** 预览按钮 */
|
/** 预览按钮 */
|
||||||
handlePreview(row) {
|
handlePreview(row) {
|
||||||
@@ -315,6 +302,12 @@ export default {
|
|||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
|
/** 排序触发事件 */
|
||||||
|
handleSortChange(column, prop, order) {
|
||||||
|
this.queryParams.orderByColumn = column.prop;
|
||||||
|
this.queryParams.isAsc = column.order;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleEditTable(row) {
|
handleEditTable(row) {
|
||||||
const tableId = row.tableId || this.ids[0];
|
const tableId = row.tableId || this.ids[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user