mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-03-03 22:32:50 +08:00
Merge branch 'develop'
# Conflicts: # data/magic-api/api/系统管理/用户管理/所有机构.ms # data/magic-api/api/系统管理/组件/选择组件.ms # magic-boot/pom.xml # magic-boot/src/main/java/org/ssssssss/magicboot/extension/ResponseFunctionExtension.java # magic-boot/src/main/java/org/ssssssss/magicboot/interceptor/PermissionInterceptor.java
This commit is contained in:
commit
77f77fd407
@ -92,8 +92,8 @@
|
|||||||
"children" : [ ]
|
"children" : [ ]
|
||||||
} ]
|
} ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
================================
|
================================
|
||||||
var toTree = (list,pid) => select t.*,toTree(list,t.key) children from list t where t.pid = pid
|
var toTree = (list,pid) => select t.*,toTree(list,t.key) children from list t where t.pid = pid
|
||||||
var list = toTree(db.select('select id "key",name label,pid from sys_office where is_del = 0 order by sort'),'0')
|
var list = toTree(db.select('select id "key",name label,pid from sys_office where is_del = 0 order by sort'),'0')
|
||||||
|
|
||||||
|
@ -224,8 +224,8 @@
|
|||||||
"children" : [ ]
|
"children" : [ ]
|
||||||
} ]
|
} ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
================================
|
================================
|
||||||
import org.ssssssss.magicapi.utils.PathUtils
|
import org.ssssssss.magicapi.utils.PathUtils
|
||||||
import org.ssssssss.magicapi.core.service.MagicResourceService
|
import org.ssssssss.magicapi.core.service.MagicResourceService
|
||||||
var getFiles = (groupId) => {
|
var getFiles = (groupId) => {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||||
"name" : "删除",
|
"name" : "删除",
|
||||||
"createTime" : null,
|
"createTime" : null,
|
||||||
"updateTime" : 1647615807925,
|
"updateTime" : 1679552802807,
|
||||||
"lock" : "0",
|
"lock" : "0",
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@ -126,9 +126,9 @@ var userCount = db.selectInt("select count(1) from sys_user where is_del = 0 and
|
|||||||
if(userCount > 0){
|
if(userCount > 0){
|
||||||
exit 500, '机构存在用户,不允许删除'
|
exit 500, '机构存在用户,不允许删除'
|
||||||
}
|
}
|
||||||
var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}")
|
// var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}")
|
||||||
if(root == '0'){
|
// if(root == '0'){
|
||||||
exit 500, '不能删除根节点'
|
// exit 500, '不能删除根节点'
|
||||||
}
|
// }
|
||||||
// db.table('sys_user_office').where().eq("office_id",id).delete();
|
// db.table('sys_user_office').where().eq("office_id",id).delete();
|
||||||
return db.table("sys_office").logic().where().eq("id",id).delete();
|
return db.table("sys_office").logic().where().eq("id",id).delete();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||||
"name" : "保存",
|
"name" : "保存",
|
||||||
"createTime" : null,
|
"createTime" : null,
|
||||||
"updateTime" : 1653129238531,
|
"updateTime" : 1679725946724,
|
||||||
"lock" : null,
|
"lock" : null,
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@ -218,4 +218,4 @@ import org.ssssssss.magicapi.modules.db.cache.SqlCache
|
|||||||
|
|
||||||
SqlCache.delete(`configure:${configureKey}${configureCondition}`)
|
SqlCache.delete(`configure:${configureKey}${configureCondition}`)
|
||||||
SqlCache.delete(`configure:${configureKey}`)
|
SqlCache.delete(`configure:${configureKey}`)
|
||||||
return db.table('sys_configure').primary('id').saveOrUpdate(data)
|
return db.table('sys_configure').primary('id').withBlank().saveOrUpdate(data)
|
||||||
|
@ -5,20 +5,21 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.ssssssss</groupId>
|
<groupId>org.ssssssss</groupId>
|
||||||
<artifactId>magic-boot-parent</artifactId>
|
<artifactId>magic-boot-parent</artifactId>
|
||||||
<version>0.0.1</version>
|
<version>0.0.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.ssssssss</groupId>
|
<groupId>org.ssssssss</groupId>
|
||||||
<artifactId>magic-boot</artifactId>
|
<artifactId>magic-boot</artifactId>
|
||||||
<version>0.0.1</version>
|
<version>0.0.2</version>
|
||||||
<name>magic-boot</name>
|
<name>magic-boot</name>
|
||||||
<description>magic-boot</description>
|
<description>magic-boot</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>17</java.version>
|
||||||
<magic-api.version>2.1.1</magic-api.version>
|
<magic-api.version>2.1.0</magic-api.version>
|
||||||
<druid.version>1.1.10</druid.version>
|
<druid.version>1.2.16</druid.version>
|
||||||
<hutool-all.version>5.7.22</hutool-all.version>
|
<hutool-all.version>5.8.15</hutool-all.version>
|
||||||
<sa-token.version>1.26.0</sa-token.version>
|
<sa-token.version>1.34.0</sa-token.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<mysql.connector.version>8.0.32</mysql.connector.version>
|
||||||
<aliyun-core.version>4.6.0</aliyun-core.version>
|
<aliyun-core.version>4.6.0</aliyun-core.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -38,6 +39,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>${mysql.connector.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
@ -51,7 +53,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||||
<version>${sa-token.version}</version>
|
<version>${sa-token.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.ssssssss.magicboot.interceptor;
|
package org.ssssssss.magicboot.interceptor;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
@ -20,7 +19,6 @@ import org.ssssssss.magicapi.utils.PathUtils;
|
|||||||
import org.ssssssss.magicboot.model.StatusCode;
|
import org.ssssssss.magicboot.model.StatusCode;
|
||||||
import org.ssssssss.script.MagicScriptContext;
|
import org.ssssssss.script.MagicScriptContext;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -65,7 +63,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
|
|||||||
public Object postHandle(RequestEntity requestEntity, Object returnValue) throws Exception {
|
public Object postHandle(RequestEntity requestEntity, Object returnValue) throws Exception {
|
||||||
if(StpUtil.isLogin()){
|
if(StpUtil.isLogin()){
|
||||||
try {
|
try {
|
||||||
HttpServletRequest request = requestEntity.getRequest().getRequest();
|
MagicHttpServletRequest request = requestEntity.getRequest();
|
||||||
ApiInfo info = requestEntity.getApiInfo();
|
ApiInfo info = requestEntity.getApiInfo();
|
||||||
template.update("insert into sys_oper_log(api_name, api_path, api_method, cost_time, create_by, create_date, user_agent, user_ip) values(?,?,?,?,?,?,?,?)",
|
template.update("insert into sys_oper_log(api_name, api_path, api_method, cost_time, create_by, create_date, user_agent, user_ip) values(?,?,?,?,?,?,?,?)",
|
||||||
// PathUtils.replaceSlash(groupServiceProvider.getFullName(info.getGroupId()) + "/" + info.getName()).replace("/","-"),
|
// PathUtils.replaceSlash(groupServiceProvider.getFullName(info.getGroupId()) + "/" + info.getName()).replace("/","-"),
|
||||||
@ -76,7 +74,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
|
|||||||
StpUtil.getLoginId(),
|
StpUtil.getLoginId(),
|
||||||
new Date(requestEntity.getRequestTime()),
|
new Date(requestEntity.getRequestTime()),
|
||||||
request.getHeader("User-Agent"),
|
request.getHeader("User-Agent"),
|
||||||
ServletUtil.getClientIP(request));
|
request.getRemoteAddr());
|
||||||
} catch (Exception ignored){
|
} catch (Exception ignored){
|
||||||
ignored.printStackTrace();
|
ignored.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.ssssssss.magicboot.provider;
|
package org.ssssssss.magicboot.provider;
|
||||||
|
|
||||||
import cn.dev33.satoken.exception.DisableLoginException;
|
import cn.dev33.satoken.exception.DisableServiceException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.ssssssss.magicapi.core.context.RequestEntity;
|
import org.ssssssss.magicapi.core.context.RequestEntity;
|
||||||
import org.ssssssss.magicapi.core.interceptor.ResultProvider;
|
import org.ssssssss.magicapi.core.interceptor.ResultProvider;
|
||||||
@ -17,7 +17,7 @@ public class ExceptionResultProvider implements ResultProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object buildException(RequestEntity requestEntity, Throwable throwable) {
|
public Object buildException(RequestEntity requestEntity, Throwable throwable) {
|
||||||
if(throwable.getCause() instanceof DisableLoginException){
|
if(throwable.getCause() instanceof DisableServiceException){
|
||||||
return buildResult(requestEntity, 500, "此账号已被临时封禁,请联系管理员");
|
return buildResult(requestEntity, 500, "此账号已被临时封禁,请联系管理员");
|
||||||
}
|
}
|
||||||
return buildResult(requestEntity, 500, "系统内部出现错误");
|
return buildResult(requestEntity, 500, "系统内部出现错误");
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.ssssssss.magicboot.utils;
|
package org.ssssssss.magicboot.utils;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import org.ssssssss.magicboot.model.Global;
|
import org.ssssssss.magicboot.model.Global;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
public class WebUtils {
|
public class WebUtils {
|
||||||
|
|
||||||
|
4
pom.xml
4
pom.xml
@ -11,13 +11,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.4.5</version>
|
<version>3.0.4</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.ssssssss</groupId>
|
<groupId>org.ssssssss</groupId>
|
||||||
<artifactId>magic-boot-parent</artifactId>
|
<artifactId>magic-boot-parent</artifactId>
|
||||||
<version>0.0.1</version>
|
<version>0.0.2</version>
|
||||||
<name>magic-boot-parent</name>
|
<name>magic-boot-parent</name>
|
||||||
<description>magic-boot-parent</description>
|
<description>magic-boot-parent</description>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user