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:
zegezy 2023-08-24 09:45:50 +08:00
commit 77f77fd407
9 changed files with 29 additions and 29 deletions

View File

@ -92,8 +92,8 @@
"children" : [ ]
} ]
}
}
================================
}
================================
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')

View File

@ -224,8 +224,8 @@
"children" : [ ]
} ]
}
}
================================
}
================================
import org.ssssssss.magicapi.utils.PathUtils
import org.ssssssss.magicapi.core.service.MagicResourceService
var getFiles = (groupId) => {

View File

@ -5,7 +5,7 @@
"groupId" : "8295fc13678d4144bf7363c465247a50",
"name" : "删除",
"createTime" : null,
"updateTime" : 1647615807925,
"updateTime" : 1679552802807,
"lock" : "0",
"createBy" : 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){
exit 500, '机构存在用户,不允许删除'
}
var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}")
if(root == '0'){
exit 500, '不能删除根节点'
}
// var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}")
// if(root == '0'){
// exit 500, '不能删除根节点'
// }
// 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();

View File

@ -5,7 +5,7 @@
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
"name" : "保存",
"createTime" : null,
"updateTime" : 1653129238531,
"updateTime" : 1679725946724,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -218,4 +218,4 @@ import org.ssssssss.magicapi.modules.db.cache.SqlCache
SqlCache.delete(`configure:${configureKey}${configureCondition}`)
SqlCache.delete(`configure:${configureKey}`)
return db.table('sys_configure').primary('id').saveOrUpdate(data)
return db.table('sys_configure').primary('id').withBlank().saveOrUpdate(data)

View File

@ -5,20 +5,21 @@
<parent>
<groupId>org.ssssssss</groupId>
<artifactId>magic-boot-parent</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
</parent>
<groupId>org.ssssssss</groupId>
<artifactId>magic-boot</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
<name>magic-boot</name>
<description>magic-boot</description>
<properties>
<java.version>1.8</java.version>
<magic-api.version>2.1.1</magic-api.version>
<druid.version>1.1.10</druid.version>
<hutool-all.version>5.7.22</hutool-all.version>
<sa-token.version>1.26.0</sa-token.version>
<java.version>17</java.version>
<magic-api.version>2.1.0</magic-api.version>
<druid.version>1.2.16</druid.version>
<hutool-all.version>5.8.15</hutool-all.version>
<sa-token.version>1.34.0</sa-token.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>
</properties>
<dependencies>
@ -38,6 +39,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
@ -51,7 +53,7 @@
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${sa-token.version}</version>
</dependency>
<dependency>

View File

@ -1,7 +1,6 @@
package org.ssssssss.magicboot.interceptor;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.extra.servlet.ServletUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.script.MagicScriptContext;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -65,7 +63,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
public Object postHandle(RequestEntity requestEntity, Object returnValue) throws Exception {
if(StpUtil.isLogin()){
try {
HttpServletRequest request = requestEntity.getRequest().getRequest();
MagicHttpServletRequest request = requestEntity.getRequest();
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(?,?,?,?,?,?,?,?)",
// PathUtils.replaceSlash(groupServiceProvider.getFullName(info.getGroupId()) + "/" + info.getName()).replace("/","-"),
@ -76,7 +74,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
StpUtil.getLoginId(),
new Date(requestEntity.getRequestTime()),
request.getHeader("User-Agent"),
ServletUtil.getClientIP(request));
request.getRemoteAddr());
} catch (Exception ignored){
ignored.printStackTrace();
}

View File

@ -1,6 +1,6 @@
package org.ssssssss.magicboot.provider;
import cn.dev33.satoken.exception.DisableLoginException;
import cn.dev33.satoken.exception.DisableServiceException;
import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.core.context.RequestEntity;
import org.ssssssss.magicapi.core.interceptor.ResultProvider;
@ -17,7 +17,7 @@ public class ExceptionResultProvider implements ResultProvider {
@Override
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, "系统内部出现错误");

View File

@ -1,10 +1,10 @@
package org.ssssssss.magicboot.utils;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.ssssssss.magicboot.model.Global;
import javax.servlet.http.HttpServletRequest;
public class WebUtils {

View File

@ -11,13 +11,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<version>3.0.4</version>
<relativePath/>
</parent>
<groupId>org.ssssssss</groupId>
<artifactId>magic-boot-parent</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
<name>magic-boot-parent</name>
<description>magic-boot-parent</description>