Conflicts:
	ruoyi-ui/src/api/system/dept.js
	ruoyi-ui/src/utils/request.js
	ruoyi-ui/src/views/monitor/job/index.vue
	ruoyi-ui/src/views/monitor/logininfor/index.vue
	ruoyi-ui/src/views/monitor/operlog/index.vue
	ruoyi-ui/src/views/system/dept/index.vue
	ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
	ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java
	ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java
	ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java
	ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java
	ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
	ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java
	ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
	ruoyi/src/main/resources/application.yml
This commit is contained in:
疯狂的狮子li
2020-05-20 09:15:19 +08:00
18 changed files with 116 additions and 64 deletions

View File

@ -1,6 +1,6 @@
package com.ruoyi.framework.aspectj;
import java.lang.reflect.Method;
import java.util.Objects;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@ -8,6 +8,7 @@ import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;
@ -60,17 +61,12 @@ public class DataSourceAspect
public DataSource getDataSource(ProceedingJoinPoint point)
{
MethodSignature signature = (MethodSignature) point.getSignature();
Class<? extends Object> targetClass = point.getTarget().getClass();
DataSource targetDataSource = targetClass.getAnnotation(DataSource.class);
if (StringUtils.isNotNull(targetDataSource))
DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class);
if (Objects.nonNull(dataSource))
{
return targetDataSource;
}
else
{
Method method = signature.getMethod();
DataSource dataSource = method.getAnnotation(DataSource.class);
return dataSource;
}
return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class);
}
}

View File

@ -10,7 +10,9 @@ import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
/**
* 自定义多数据源切换注解
*
*
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
*
* @author ruoyi
*/
@Target({ ElementType.METHOD, ElementType.TYPE })

View File

@ -33,9 +33,13 @@ public class SwaggerConfig
@Autowired
private RuoYiConfig ruoyiConfig;
/** Swagger开关配置 */
@Value("${swagger.enable}")
private boolean swaggerEnable;
/** 是否开启swagger */
@Value("${swagger.enabled}")
private boolean enabled;
/** 设置请求的统一前缀 */
@Value("${swagger.pathMapping}")
private String pathMapping;
/**
* 创建API
@ -45,8 +49,7 @@ public class SwaggerConfig
{
return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger
.enable(swaggerEnable)
.pathMapping("/dev-api")
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
@ -54,13 +57,14 @@ public class SwaggerConfig
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
/* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes())
.securityContexts(securityContexts());
.securityContexts(securityContexts())
.pathMapping(pathMapping);
}
/**
@ -72,7 +76,7 @@ public class SwaggerConfig
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
return apiKeyList;
}
/**
* 安全上下文
*/
@ -86,7 +90,7 @@ public class SwaggerConfig
.build());
return securityContexts;
}
/**
* 默认的安全上引用
*/

View File

@ -67,6 +67,7 @@ public class BaseController
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;

View File

@ -22,7 +22,7 @@ public class TableDataInfo implements Serializable
private int code;
/** 消息内容 */
private int msg;
private String msg;
/**
* 表格数据对象
@ -73,12 +73,12 @@ public class TableDataInfo implements Serializable
this.code = code;
}
public int getMsg()
public String getMsg()
{
return msg;
}
public void setMsg(int msg)
public void setMsg(String msg)
{
this.msg = msg;
}

View File

@ -76,6 +76,9 @@ public class SysJobLogController extends BaseController
return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
}
/**
* 清空定时任务调度日志
*/
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")

View File

@ -1,6 +1,8 @@
package com.ruoyi.project.system.controller;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -45,6 +47,27 @@ public class SysDeptController extends BaseController
return AjaxResult.success(depts);
}
/**
* 查询部门列表(排除节点)
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext())
{
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{
it.remove();
}
}
return AjaxResult.success(depts);
}
/**
* 根据部门编号获取详细信息
*/

View File

@ -114,6 +114,7 @@ public class SysDeptServiceImpl implements ISysDeptService
* @param deptId 部门ID
* @return 子部门数
*/
@Override
public int selectNormalChildrenDeptById(Long deptId)
{
return deptMapper.selectNormalChildrenDeptById(deptId);

View File

@ -124,6 +124,9 @@ public class GenController extends BaseController
return AjaxResult.success();
}
/**
* 删除代码生成
*/
@PreAuthorize("@ss.hasPermi('tool:gen:remove')")
@Log(title = "代码生成", businessType = BusinessType.DELETE)
@DeleteMapping("/{tableIds}")

View File

@ -118,7 +118,10 @@ pagehelper:
# Swagger配置
swagger:
enable: true
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss: