1. 添加
This commit is contained in:
parent
efcba7241a
commit
d640f8a285
|
|
@ -1,50 +0,0 @@
|
||||||
package com.chushang.common.core.util;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* by zhaowenyuan create 2021/11/5 14:53
|
|
||||||
* 公共 请求 query
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CommonParam implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前页码
|
|
||||||
*/
|
|
||||||
private Integer page = 1;
|
|
||||||
/**
|
|
||||||
* 页面大小
|
|
||||||
*/
|
|
||||||
private Integer limit = 10;
|
|
||||||
/**
|
|
||||||
* 排序字段: 排序方式 -- 为 null 时, 没有排序
|
|
||||||
*/
|
|
||||||
private String sortStr;
|
|
||||||
/**
|
|
||||||
* 额外分组选项
|
|
||||||
*/
|
|
||||||
private String groupStr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内部使用 sql 查询, 仅用于 角色权限所需查询, 前端不能传递
|
|
||||||
*/
|
|
||||||
private Map<String, Object> sqlParam;
|
|
||||||
|
|
||||||
public Map<String, Object> getSqlParam()
|
|
||||||
{
|
|
||||||
if (sqlParam == null)
|
|
||||||
{
|
|
||||||
sqlParam = new HashMap<>();
|
|
||||||
}
|
|
||||||
return sqlParam;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
package com.chushang.common.log.annotation;
|
package com.chushang.common.log.annotation;
|
||||||
|
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,12 +25,15 @@ public @interface SysLog {
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 请求参数
|
||||||
* 判断参数下标 -- 需要与 参数下标一一对应
|
* 判断参数下标 -- 需要与 参数下标一一对应
|
||||||
* -2 代表删除
|
|
||||||
* -1 代表默认
|
|
||||||
* 0 - Integer.MAX_VALUE 代表 参数下标
|
* 0 - Integer.MAX_VALUE 代表 参数下标
|
||||||
*/
|
*/
|
||||||
int index() default -1;
|
int index() default -1;
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
boolean export() default false;
|
boolean export() default false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||||
*
|
* <p>
|
||||||
* https://www.renren.io
|
* https://www.renren.io
|
||||||
*
|
* <p>
|
||||||
* 版权所有,侵权必究!
|
* 版权所有,侵权必究!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -15,6 +15,7 @@ import com.chushang.common.core.util.IPUtils;
|
||||||
import com.chushang.common.core.util.ServletUtils;
|
import com.chushang.common.core.util.ServletUtils;
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.entity.SysLogEntity;
|
import com.chushang.common.log.entity.SysLogEntity;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.common.log.enums.LogTypeEnum;
|
import com.chushang.common.log.enums.LogTypeEnum;
|
||||||
import com.chushang.common.log.service.SysLogService;
|
import com.chushang.common.log.service.SysLogService;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
|
@ -50,129 +51,117 @@ import java.util.stream.Collectors;
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
public class SysLogAspect {
|
public class SysLogAspect {
|
||||||
|
|
||||||
final SysLogService sysLogService;
|
final SysLogService sysLogService;
|
||||||
|
|
||||||
@Pointcut("@annotation(com.chushang.common.log.annotation.SysLog)")
|
@Pointcut("@annotation(com.chushang.common.log.annotation.SysLog)")
|
||||||
public void logPointCut() {
|
public void logPointCut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不主动拦截get 请求
|
* 不主动拦截get 请求
|
||||||
*/
|
*/
|
||||||
@Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping)" +
|
@Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping)" +
|
||||||
"|| @annotation(org.springframework.web.bind.annotation.PostMapping)" +
|
"|| @annotation(org.springframework.web.bind.annotation.PostMapping)" +
|
||||||
"|| @annotation(org.springframework.web.bind.annotation.DeleteMapping)" +
|
"|| @annotation(org.springframework.web.bind.annotation.DeleteMapping)" +
|
||||||
"|| @annotation(org.springframework.web.bind.annotation.PutMapping)")
|
"|| @annotation(org.springframework.web.bind.annotation.PutMapping)")
|
||||||
public void exceptionLogPointCut() {
|
public void exceptionLogPointCut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterReturning("logPointCut()")
|
@AfterReturning("logPointCut()")
|
||||||
public void around(JoinPoint point) {
|
public void around(JoinPoint point) {
|
||||||
long beginTime = System.currentTimeMillis();
|
long beginTime = System.currentTimeMillis();
|
||||||
//执行时长(毫秒)
|
//执行时长(毫秒)
|
||||||
long time = System.currentTimeMillis() - beginTime;
|
long time = System.currentTimeMillis() - beginTime;
|
||||||
//保存日志
|
//保存日志
|
||||||
saveSysLog(point, time, LogTypeEnum.NORMAL, null);
|
saveSysLog(point, time, LogTypeEnum.NORMAL, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
|
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
|
||||||
* --> 未执行, 因为 有全局捕捉一长
|
* --> 未执行, 因为 有全局捕捉一长
|
||||||
* @param joinPoint 切入点
|
* @param joinPoint 切入点
|
||||||
* @param ex 异常信息
|
* @param ex 异常信息
|
||||||
*/
|
*/
|
||||||
@AfterThrowing(pointcut = "exceptionLogPointCut()", throwing = "ex")
|
@AfterThrowing(pointcut = "exceptionLogPointCut()", throwing = "ex")
|
||||||
public void saveExceptionLog(JoinPoint joinPoint, Throwable ex)
|
public void saveExceptionLog(JoinPoint joinPoint, Throwable ex) {
|
||||||
{
|
long beginTime = System.currentTimeMillis();
|
||||||
long beginTime = System.currentTimeMillis();
|
//执行时长(毫秒)
|
||||||
//执行时长(毫秒)
|
long time = System.currentTimeMillis() - beginTime;
|
||||||
long time = System.currentTimeMillis() - beginTime;
|
|
||||||
|
|
||||||
saveSysLog(joinPoint, time, LogTypeEnum.ERROR, ex.getMessage());
|
saveSysLog(joinPoint, time, LogTypeEnum.ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveSysLog(JoinPoint joinPoint, long time, LogTypeEnum type, String ex) {
|
private void saveSysLog(JoinPoint joinPoint, long time, LogTypeEnum type, String ex) {
|
||||||
try {
|
try {
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|
||||||
// 获取到的所有参数
|
// 获取到的所有参数
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
|
SysLogEntity sysLogEntity = new SysLogEntity();
|
||||||
|
SysLog syslog =
|
||||||
|
method.getAnnotation(SysLog.class);
|
||||||
|
|
||||||
|
if (syslog != null) {
|
||||||
|
String value = syslog.value();
|
||||||
|
BusinessType businessType = syslog.businessType();
|
||||||
|
if (null != businessType){
|
||||||
|
value += businessType.getDesc();
|
||||||
|
sysLogEntity.setOperationType(businessType.getCode());
|
||||||
|
}
|
||||||
|
sysLogEntity.setOperation(value);
|
||||||
|
if (null != args && args.length > 0) {
|
||||||
|
// 将导出的response 过滤掉
|
||||||
|
List<Object> argList =
|
||||||
|
Arrays.stream(args)
|
||||||
|
.filter(arg -> !(arg instanceof HttpServletResponse) && !(arg instanceof HttpServletRequest))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
sysLogEntity.setParams(JacksonUtils.toJSONString(argList));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SysLogEntity sysLogEntity = new SysLogEntity();
|
//获取request
|
||||||
SysLog syslog =
|
HttpServletRequest request = ServletUtils.getRequest();
|
||||||
method.getAnnotation(SysLog.class);
|
String ipAddr = IPUtils.clientIp(request);
|
||||||
|
//请求的方法名
|
||||||
|
String className = joinPoint.getTarget().getClass().getName();
|
||||||
|
String methodName = signature.getName();
|
||||||
|
sysLogEntity.setMethod(className + "." + methodName + "()");
|
||||||
|
//设置IP地址
|
||||||
|
sysLogEntity.setRemoteAddr(ipAddr);
|
||||||
|
// 请求uri
|
||||||
|
sysLogEntity.setRequestUri(URLUtil.getPath(request.getRequestURI()));
|
||||||
|
// 请求代理
|
||||||
|
sysLogEntity.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||||
|
|
||||||
if(syslog != null){
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
String value = syslog.value();
|
// 请求账号信息
|
||||||
int index = syslog.index();
|
if (null != loginUser) {
|
||||||
if (index != -1){
|
Integer userId = loginUser.getUserId();
|
||||||
if (index >= 0){
|
//用户名
|
||||||
String id = args[index] + "";
|
sysLogEntity.setUserId(userId);
|
||||||
if ("0".equals(id)){
|
String username = loginUser.getUsername();
|
||||||
value += "新增 ";
|
sysLogEntity.setUsername(username);
|
||||||
}else {
|
//保存系统日志
|
||||||
value += "修改 ";
|
} else {
|
||||||
}
|
if (!ipAddr.equals("localhost") && !ipAddr.equals("127.0.0.1")) {
|
||||||
}else if (index == -2){
|
throw new ResultException("没有权限");
|
||||||
value += "删除 ";
|
}
|
||||||
}
|
sysLogEntity.setUserId(1);
|
||||||
}
|
sysLogEntity.setUsername("error");
|
||||||
sysLogEntity.setOperation(value);
|
}
|
||||||
if (null != args && args.length > 0){
|
// 执行时间
|
||||||
// 将导出的response 过滤掉
|
sysLogEntity.setTime(time);
|
||||||
List<Object> argList =
|
// 日志类型
|
||||||
Arrays.stream(args)
|
sysLogEntity.setType(type);
|
||||||
.filter(arg -> !(arg instanceof HttpServletResponse))
|
sysLogEntity.setException(ex);
|
||||||
.collect(Collectors.toList());
|
sysLogService.save(sysLogEntity);
|
||||||
sysLogEntity.setParams(JacksonUtils.toJSONString(argList));
|
} catch (Exception e) {
|
||||||
}
|
HttpServletRequest request = ServletUtils.getRequest();
|
||||||
}
|
// 保存日志失败 不应当影响 正常的操作
|
||||||
|
log.error("uri : {}, save log error", URLUtil.getPath(request.getRequestURI()), e);
|
||||||
//获取request
|
}
|
||||||
HttpServletRequest request = ServletUtils.getRequest();
|
}
|
||||||
String ipAddr = IPUtils.clientIp(request);
|
|
||||||
//请求的方法名
|
|
||||||
String className = joinPoint.getTarget().getClass().getName();
|
|
||||||
String methodName = signature.getName();
|
|
||||||
sysLogEntity.setMethod(className + "." + methodName + "()");
|
|
||||||
//设置IP地址
|
|
||||||
sysLogEntity.setRemoteAddr(ipAddr);
|
|
||||||
// 请求uri
|
|
||||||
sysLogEntity.setRequestUri(URLUtil.getPath(request.getRequestURI()));
|
|
||||||
// 请求代理
|
|
||||||
sysLogEntity.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
|
||||||
|
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
||||||
// 请求账号信息
|
|
||||||
if (null != loginUser){
|
|
||||||
Integer userId = loginUser.getUserId();
|
|
||||||
//用户名
|
|
||||||
sysLogEntity.setUserId(userId);
|
|
||||||
String username = loginUser.getUsername();
|
|
||||||
sysLogEntity.setUsername(username);
|
|
||||||
//保存系统日志
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!ipAddr.equals("localhost") && !ipAddr.equals("127.0.0.1")){
|
|
||||||
throw new ResultException("没有权限");
|
|
||||||
}
|
|
||||||
sysLogEntity.setUserId(1);
|
|
||||||
sysLogEntity.setUsername("error");
|
|
||||||
}
|
|
||||||
// 执行时间
|
|
||||||
sysLogEntity.setTime(time);
|
|
||||||
// 日志类型
|
|
||||||
sysLogEntity.setType(type);
|
|
||||||
sysLogEntity.setException(ex);
|
|
||||||
sysLogService.save(sysLogEntity);
|
|
||||||
}catch (Exception e){
|
|
||||||
HttpServletRequest request = ServletUtils.getRequest();
|
|
||||||
// 保存日志失败 不应当影响 正常的操作
|
|
||||||
log.error("uri : {}, save log error",URLUtil.getPath(request.getRequestURI()),e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
package com.chushang.common.log.controller;
|
package com.chushang.common.log.controller;
|
||||||
|
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.log.entity.dto.ListLogDTO;
|
import com.chushang.common.log.entity.dto.ListLogDTO;
|
||||||
import com.chushang.common.core.web.Result;
|
|
||||||
import com.chushang.common.log.service.SysLogService;
|
import com.chushang.common.log.service.SysLogService;
|
||||||
import com.chushang.common.mybatis.utils.PageUtils;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -30,16 +30,16 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
public class SysLogController {
|
public class SysLogController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLogService sysLogService;
|
private SysLogService sysLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@RequiresPermissions("sys:log:list")
|
@RequiresPermissions("sys:log:list")
|
||||||
public Result<?> list(ListLogDTO params){
|
public AjaxResult list(ListLogDTO params){
|
||||||
PageUtils page = sysLogService.queryPage(params);
|
PageResult page = sysLogService.queryPage(params);
|
||||||
return Result.ok(page);
|
return AjaxResult.success(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.chushang.common.log.entity;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.common.log.enums.LogTypeEnum;
|
import com.chushang.common.log.enums.LogTypeEnum;
|
||||||
import com.chushang.common.mybatis.base.BaseEntity;
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
@ -84,6 +85,11 @@ public class SysLogEntity {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "operation")
|
@TableField(value = "operation")
|
||||||
private String operation;
|
private String operation;
|
||||||
|
/**
|
||||||
|
* 用户操作 类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "operation_type")
|
||||||
|
private Integer operationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
|
@ -103,4 +109,4 @@ public class SysLogEntity {
|
||||||
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
|
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chushang.common.log.entity.dto;
|
package com.chushang.common.log.entity.dto;
|
||||||
|
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
@ -12,5 +12,6 @@ import lombok.EqualsAndHashCode;
|
||||||
public class ListLogDTO extends CommonParam {
|
public class ListLogDTO extends CommonParam {
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
private String operType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.chushang.common.log.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务操作类型
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum BusinessType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 其它
|
||||||
|
*/
|
||||||
|
OTHER(1,"其他"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
INSERT(2,"新增"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
UPDATE(3,"修改"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
DELETE(4,"删除"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权
|
||||||
|
*/
|
||||||
|
GRANT(5,"授权"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
EXPORT(6,"导出"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入
|
||||||
|
*/
|
||||||
|
IMPORT(7,"导入"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强退
|
||||||
|
*/
|
||||||
|
FORCE(8,"强退"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成代码
|
||||||
|
*/
|
||||||
|
GENCODE(9,"生成代码"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空数据
|
||||||
|
*/
|
||||||
|
CLEAN(10,"清空数据"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
|
|
@ -1,30 +1,32 @@
|
||||||
package com.chushang.common.log.service;
|
package com.chushang.common.log.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.common.log.entity.SysLogEntity;
|
import com.chushang.common.log.entity.SysLogEntity;
|
||||||
import com.chushang.common.log.entity.dto.ListLogDTO;
|
import com.chushang.common.log.entity.dto.ListLogDTO;
|
||||||
import com.chushang.common.mybatis.utils.PageUtils;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* by zhaowenyuan create 2022/3/16 15:35
|
* by zhaowenyuan create 2022/3/16 15:35
|
||||||
*/
|
*/
|
||||||
public interface SysLogService extends IService<SysLogEntity> {
|
public interface SysLogService extends IService<SysLogEntity> {
|
||||||
|
|
||||||
default PageUtils queryPage(ListLogDTO params){
|
default PageResult queryPage(ListLogDTO params){
|
||||||
String key = params.getTitle();
|
String key = params.getTitle();
|
||||||
|
|
||||||
IPage<SysLogEntity> page = this.page(
|
IPage<SysLogEntity> page = this.page(
|
||||||
new Page<>(params.getPage(), params.getLimit()),
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(params.getPage(), params.getLimit()),
|
||||||
new LambdaQueryWrapper<SysLogEntity>()
|
new QueryWrapper<SysLogEntity>()
|
||||||
|
.orderBy(true, "asc".equals(params.getIsAsc()), params.getOrderBy())
|
||||||
|
.lambda()
|
||||||
.like(StringUtils.isNotBlank(key),SysLogEntity::getUsername, key)
|
.like(StringUtils.isNotBlank(key),SysLogEntity::getUsername, key)
|
||||||
.or()
|
.or()
|
||||||
.like(StringUtils.isNotEmpty(key), SysLogEntity::getOperation, key)
|
.like(StringUtils.isNotEmpty(key), SysLogEntity::getOperation, key)
|
||||||
.orderByDesc(SysLogEntity::getCreateTime)
|
.in(StringUtils.isNotEmpty(params.getOperType()), SysLogEntity::getOperationType, Arrays.asList(params.getOperType().split(",")))
|
||||||
);
|
);
|
||||||
return new PageUtils(page);
|
return new PageResult(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.chushang.common.log.mapper.SysLogMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -36,6 +36,15 @@
|
||||||
<groupId>com.github.jsqlparser</groupId>
|
<groupId>com.github.jsqlparser</groupId>
|
||||||
<artifactId>jsqlparser</artifactId>
|
<artifactId>jsqlparser</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
package com.chushang.common.mybatis.page;
|
||||||
|
|
||||||
|
import com.chushang.common.core.exception.utils.AssertUtil;
|
||||||
|
import com.chushang.common.core.text.Convert;
|
||||||
|
import com.chushang.common.core.util.ServletUtils;
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* by zhaowenyuan create 2021/11/5 14:53
|
||||||
|
* 公共 请求 query
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommonParam implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前页码
|
||||||
|
*/
|
||||||
|
private Integer page = 1;
|
||||||
|
/**
|
||||||
|
* 页面大小
|
||||||
|
*/
|
||||||
|
private Integer limit = 10;
|
||||||
|
/**
|
||||||
|
* 排序字段: 排序方式 -- 为 null 时, 没有排序
|
||||||
|
* 默认创建时间倒叙
|
||||||
|
*/
|
||||||
|
private String orderBy = "create_time";
|
||||||
|
/**
|
||||||
|
* 额外分组选项
|
||||||
|
*/
|
||||||
|
private String groupStr;
|
||||||
|
/**
|
||||||
|
* 排序方式
|
||||||
|
*/
|
||||||
|
private String isAsc = "asc";
|
||||||
|
/**
|
||||||
|
* 是否查询全部数据
|
||||||
|
*/
|
||||||
|
private Boolean isAll = false;
|
||||||
|
/**
|
||||||
|
* 内部使用 sql 查询, 仅用于 角色权限所需查询, 前端不能传递
|
||||||
|
*/
|
||||||
|
private Map<String, Object> sqlParam;
|
||||||
|
|
||||||
|
public Map<String, Object> getSqlParam()
|
||||||
|
{
|
||||||
|
if (sqlParam == null)
|
||||||
|
{
|
||||||
|
sqlParam = new HashMap<>();
|
||||||
|
}
|
||||||
|
return sqlParam;
|
||||||
|
}
|
||||||
|
public String getOrderBy()
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(orderBy))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return StringUtils.toUnderScoreCase(orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsAsc(String isAsc)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(isAsc))
|
||||||
|
{
|
||||||
|
// 兼容前端排序类型
|
||||||
|
if ("ascending".equals(isAsc))
|
||||||
|
{
|
||||||
|
isAsc = "asc";
|
||||||
|
}
|
||||||
|
else if ("descending".equals(isAsc))
|
||||||
|
{
|
||||||
|
isAsc = "desc";
|
||||||
|
}
|
||||||
|
this.isAsc = isAsc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前记录起始索引
|
||||||
|
*/
|
||||||
|
private static final String PAGE_NUM = "page";
|
||||||
|
/**
|
||||||
|
* 每页显示记录数
|
||||||
|
*/
|
||||||
|
private static final String PAGE_SIZE = "limit";
|
||||||
|
/**
|
||||||
|
* 排序列
|
||||||
|
*/
|
||||||
|
private static final String ORDER_BY_COLUMN = "orderBy";
|
||||||
|
/**
|
||||||
|
* 排序的方向 "desc" 或者 "asc".
|
||||||
|
*/
|
||||||
|
private static final String IS_ASC = "isAsc";
|
||||||
|
|
||||||
|
private static final String GROUP_STR = "groupStr";
|
||||||
|
/**
|
||||||
|
* 封装分页对象
|
||||||
|
*/
|
||||||
|
private static CommonParam getPageParam()
|
||||||
|
{
|
||||||
|
CommonParam pageDomain = new CommonParam();
|
||||||
|
pageDomain.setPage(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||||
|
pageDomain.setLimit(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||||
|
pageDomain.setOrderBy(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||||
|
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||||
|
pageDomain.setGroupStr(ServletUtils.getParameter(GROUP_STR));
|
||||||
|
return pageDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CommonParam buildPageRequest()
|
||||||
|
{
|
||||||
|
return getPageParam();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于查询所有数据
|
||||||
|
*/
|
||||||
|
public static CommonParam buildAllRequest()
|
||||||
|
{
|
||||||
|
CommonParam commonParam = new CommonParam();
|
||||||
|
commonParam.setLimit(null);
|
||||||
|
commonParam.setPage(null);
|
||||||
|
commonParam.setIsAll(true);
|
||||||
|
return commonParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,9 @@
|
||||||
package com.chushang.common.mybatis.utils;
|
package com.chushang.common.mybatis.utils;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -17,7 +19,9 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author Mark sunlightcs@gmail.com
|
* @author Mark sunlightcs@gmail.com
|
||||||
*/
|
*/
|
||||||
public class PageUtils implements Serializable {
|
@Data
|
||||||
|
public class PageResult implements Serializable {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/**
|
/**
|
||||||
* 总记录数
|
* 总记录数
|
||||||
|
|
@ -39,7 +43,7 @@ public class PageUtils implements Serializable {
|
||||||
* 列表数据
|
* 列表数据
|
||||||
*/
|
*/
|
||||||
private List<?> list;
|
private List<?> list;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
* @param list 列表数据
|
* @param list 列表数据
|
||||||
|
|
@ -47,14 +51,14 @@ public class PageUtils implements Serializable {
|
||||||
* @param pageSize 每页记录数
|
* @param pageSize 每页记录数
|
||||||
* @param currPage 当前页数
|
* @param currPage 当前页数
|
||||||
*/
|
*/
|
||||||
public PageUtils(List<?> list, long totalCount, long pageSize, long currPage) {
|
public PageResult(List<?> list, long totalCount, long pageSize, long currPage) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
this.totalCount = (int)totalCount;
|
this.totalCount = (int)totalCount;
|
||||||
this.pageSize = (int)pageSize;
|
this.pageSize = (int)pageSize;
|
||||||
this.currPage = (int)currPage;
|
this.currPage = (int)currPage;
|
||||||
this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
|
this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
|
||||||
}
|
}
|
||||||
public PageUtils(List<?> list, IPage<?> page) {
|
public PageResult(List<?> list, IPage<?> page) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
if (null != page){
|
if (null != page){
|
||||||
this.totalCount = (int)page.getTotal();
|
this.totalCount = (int)page.getTotal();
|
||||||
|
|
@ -67,7 +71,7 @@ public class PageUtils implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
public PageUtils(IPage<?> page) {
|
public PageResult(IPage<?> page) {
|
||||||
this.list = page.getRecords();
|
this.list = page.getRecords();
|
||||||
this.totalCount = (int)page.getTotal();
|
this.totalCount = (int)page.getTotal();
|
||||||
this.pageSize = (int)page.getSize();
|
this.pageSize = (int)page.getSize();
|
||||||
|
|
@ -75,44 +79,4 @@ public class PageUtils implements Serializable {
|
||||||
this.totalPage = (int)page.getPages();
|
this.totalPage = (int)page.getPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTotalCount() {
|
|
||||||
return totalCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalCount(int totalCount) {
|
|
||||||
this.totalCount = totalCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPageSize() {
|
|
||||||
return pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPageSize(int pageSize) {
|
|
||||||
this.pageSize = pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalPage() {
|
|
||||||
return totalPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalPage(int totalPage) {
|
|
||||||
this.totalPage = totalPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrPage() {
|
|
||||||
return currPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCurrPage(int currPage) {
|
|
||||||
this.currPage = currPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<?> getList() {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setList(List<?> list) {
|
|
||||||
this.list = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.chushang.common.mybatis.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.UtilException;
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql操作工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class SqlUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义常用的 sql关键字
|
||||||
|
*/
|
||||||
|
public static String SQL_REGEX = "and |extractvalue|updatexml|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |+|user()";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
|
||||||
|
*/
|
||||||
|
public static String SQL_PATTERN = "[a-zA-Z0-9_ ,.]+";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限制orderBy最大长度
|
||||||
|
*/
|
||||||
|
private static final int ORDER_BY_MAX_LENGTH = 500;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查字符,防止注入绕过
|
||||||
|
*/
|
||||||
|
public static String escapeOrderBySql(String value)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value))
|
||||||
|
{
|
||||||
|
throw new UtilException("参数不符合规范,不能进行查询");
|
||||||
|
}
|
||||||
|
if (StringUtils.length(value) > ORDER_BY_MAX_LENGTH)
|
||||||
|
{
|
||||||
|
throw new UtilException("参数已超过最大限制,不能进行查询");
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证 order by 语法是否符合规范
|
||||||
|
*/
|
||||||
|
public static boolean isValidOrderBySql(String value)
|
||||||
|
{
|
||||||
|
return value.matches(SQL_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQL关键字检查
|
||||||
|
*/
|
||||||
|
public static void filterKeyword(String value)
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(value))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
|
||||||
|
for (String sqlKeyword : sqlKeywords)
|
||||||
|
{
|
||||||
|
if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1)
|
||||||
|
{
|
||||||
|
throw new UtilException("参数存在SQL注入风险");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,11 +7,15 @@
|
||||||
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
||||||
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
||||||
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
||||||
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
<springProperty scope="context" name="plumelog.redis.db" source="plumelog.redis.db" />
|
||||||
|
<springProperty scope="context" name="plumelog.env" source="spring.profiles.active"/>
|
||||||
|
|
||||||
|
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
||||||
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
||||||
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
||||||
|
<property name="log.redis.db" value="${plumelog.redis.db}"/>
|
||||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||||
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
|
|
@ -91,6 +95,8 @@
|
||||||
<!-- <appName>${spring.application.name}</appName>-->
|
<!-- <appName>${spring.application.name}</appName>-->
|
||||||
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
||||||
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
||||||
|
<!-- <redisDb>${log.redis.db}</redisDb>-->
|
||||||
|
<!-- <env>${log.env}</env>-->
|
||||||
<!-- </appender>-->
|
<!-- </appender>-->
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,15 @@
|
||||||
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
||||||
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
||||||
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
||||||
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
<springProperty scope="context" name="plumelog.redis.db" source="plumelog.redis.db" />
|
||||||
|
<springProperty scope="context" name="plumelog.env" source="spring.profiles.active"/>
|
||||||
|
|
||||||
|
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
||||||
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
||||||
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
||||||
|
<property name="log.redis.db" value="${plumelog.redis.db}"/>
|
||||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||||
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
|
|
@ -91,6 +95,8 @@
|
||||||
<!-- <appName>${spring.application.name}</appName>-->
|
<!-- <appName>${spring.application.name}</appName>-->
|
||||||
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
||||||
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
||||||
|
<!-- <redisDb>${log.redis.db}</redisDb>-->
|
||||||
|
<!-- <env>${log.env}</env>-->
|
||||||
<!-- </appender>-->
|
<!-- </appender>-->
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,9 @@
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>chushang-common-security</artifactId>
|
<artifactId>chushang-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chushang.system.entity.dto;
|
package com.chushang.system.entity.dto;
|
||||||
|
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.chushang.system.entity.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 17:09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ListDictDTO {
|
||||||
|
/**
|
||||||
|
* 字典编码
|
||||||
|
*/
|
||||||
|
private Integer dictCode;
|
||||||
|
/**
|
||||||
|
* 字典类型
|
||||||
|
*/
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样式属性(其他样式扩展)
|
||||||
|
*/
|
||||||
|
private String cssClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格字典样式
|
||||||
|
*/
|
||||||
|
private String listClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否默认(Y是 N否)
|
||||||
|
*/
|
||||||
|
private String isDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chushang.system.entity.dto;
|
package com.chushang.system.entity.dto;
|
||||||
|
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chushang.system.entity.dto;
|
package com.chushang.system.entity.dto;
|
||||||
|
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chushang.system.entity.dto;
|
package com.chushang.system.entity.dto;
|
||||||
|
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置表 sys_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_config")
|
||||||
|
public class SysConfig extends BaseEntity
|
||||||
|
{
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 参数主键 */
|
||||||
|
@TableId(value = "config_id", type = IdType.AUTO)
|
||||||
|
@ExcelProperty(value = "参数主键", index = 0)
|
||||||
|
private Long configId;
|
||||||
|
|
||||||
|
/** 参数名称 */
|
||||||
|
@ExcelProperty(value = "参数名称", index = 1)
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
/** 参数键名 */
|
||||||
|
@ExcelProperty(value = "参数键名", index = 2)
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/** 参数键值 */
|
||||||
|
@ExcelProperty(value = "参数键值", index = 3)
|
||||||
|
private String configValue;
|
||||||
|
|
||||||
|
/** 系统内置(Y是 N否) */
|
||||||
|
@ExcelProperty(value = "系统内置", index = 4)
|
||||||
|
private String configType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "create_by",
|
||||||
|
updateStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "创建人", index = 5)
|
||||||
|
protected String createBy;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "update_by",
|
||||||
|
insertStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "修改人", index = 6)
|
||||||
|
protected String updateBy;
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.chushang.system.entity.po;
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
@ -14,7 +15,7 @@ import java.io.Serializable;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_dict_data")
|
@TableName("sys_dict_data")
|
||||||
public class SysDictData implements Serializable {
|
public class SysDictData extends BaseEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
@ -22,46 +23,72 @@ public class SysDictData implements Serializable {
|
||||||
* 字典编码
|
* 字典编码
|
||||||
*/
|
*/
|
||||||
@TableId(value = "dict_code", type = IdType.AUTO)
|
@TableId(value = "dict_code", type = IdType.AUTO)
|
||||||
|
@ExcelProperty(value = "字典编码", index = 0)
|
||||||
private Integer dictCode;
|
private Integer dictCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典排序
|
* 字典排序
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "字典排序", index = 1)
|
||||||
private Integer dictSort;
|
private Integer dictSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典标签
|
* 字典标签
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "字典标签", index = 2)
|
||||||
private String dictLabel;
|
private String dictLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典键值
|
* 字典键值
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "字典键值", index = 3)
|
||||||
private String dictValue;
|
private String dictValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型
|
* 字典类型
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "字典键值", index = 4)
|
||||||
private String dictType;
|
private String dictType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 样式属性(其他样式扩展)
|
* 样式属性(其他样式扩展)
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "样式属性(其他样式扩展)", index = 5)
|
||||||
private String cssClass;
|
private String cssClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格字典样式
|
* 表格字典样式
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "表格字典样式", index = 6)
|
||||||
private String listClass;
|
private String listClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否默认(Y是 N否)
|
* 是否默认(Y是 N否)
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "是否默认", index = 7)
|
||||||
private String isDefault;
|
private String isDefault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "状态", index = 8)
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "create_by",
|
||||||
|
updateStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
protected String createBy;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "update_by",
|
||||||
|
insertStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
protected String updateBy;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典类型表 sys_dict_type
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_dict_type")
|
||||||
|
public class SysDictType extends BaseEntity
|
||||||
|
{
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 字典主键 */
|
||||||
|
@TableId(value = "dict_id", type = IdType.AUTO)
|
||||||
|
@ExcelProperty(value = "字典主键", index = 0)
|
||||||
|
private Long dictId;
|
||||||
|
|
||||||
|
/** 字典名称 */
|
||||||
|
@ExcelProperty(value = "字典名称", index = 1)
|
||||||
|
private String dictName;
|
||||||
|
|
||||||
|
/** 字典类型 */
|
||||||
|
@ExcelProperty(value = "字典类型", index = 2)
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
/** 状态(0正常 1停用) */
|
||||||
|
@ExcelProperty(value = "状态", index = 3)
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "create_by",
|
||||||
|
updateStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "创建人", index = 4)
|
||||||
|
protected String createBy;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "update_by",
|
||||||
|
insertStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "修改人", index = 5)
|
||||||
|
protected String updateBy;
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author author
|
* @author author
|
||||||
|
|
@ -57,21 +57,21 @@ public class SysMenu extends BaseEntity {
|
||||||
private String query;
|
private String query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否 外链 true 不为外链, false 为外链
|
* 是否 外链 1 为内链, 0 为外链
|
||||||
*/
|
*/
|
||||||
private boolean frame;
|
private String frame;
|
||||||
|
|
||||||
/** 是否缓存(false不缓存 true缓存) */
|
/** 是否缓存(1缓存 0不缓存) */
|
||||||
private boolean cache;
|
private String cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否隐藏 true 隐藏
|
* 是否显示 1 显示
|
||||||
*/
|
*/
|
||||||
private boolean visible;
|
private String visible;
|
||||||
/**
|
/**
|
||||||
* 状态 true 停用
|
* 状态 0 停用
|
||||||
*/
|
*/
|
||||||
private boolean status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拥有权限
|
* 拥有权限
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位表 sys_post
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_post")
|
||||||
|
public class SysPost extends BaseEntity
|
||||||
|
{
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 岗位序号 */
|
||||||
|
@TableId(value = "post_id", type = IdType.AUTO)
|
||||||
|
@ExcelProperty(value = "岗位序号", index = 0)
|
||||||
|
private Long postId;
|
||||||
|
|
||||||
|
/** 岗位编码 */
|
||||||
|
@ExcelProperty(value = "岗位编码", index = 1)
|
||||||
|
private String postCode;
|
||||||
|
|
||||||
|
/** 岗位名称 */
|
||||||
|
@ExcelProperty(value = "岗位名称", index = 2)
|
||||||
|
private String postName;
|
||||||
|
|
||||||
|
/** 岗位排序 */
|
||||||
|
@ExcelProperty(value = "岗位排序", index = 3)
|
||||||
|
private Integer postSort;
|
||||||
|
|
||||||
|
/** 状态(0正常 1停用) */
|
||||||
|
@ExcelProperty(value = "状态", index = 4)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "create_by",
|
||||||
|
updateStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "创建人", index = 4)
|
||||||
|
protected String createBy;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(
|
||||||
|
value = "update_by",
|
||||||
|
insertStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
@ExcelProperty(value = "修改人", index = 5)
|
||||||
|
protected String updateBy;
|
||||||
|
|
||||||
|
/** 用户是否存在此岗位标识 默认不存在 */
|
||||||
|
@TableField(exist = false)
|
||||||
|
private boolean flag = false;
|
||||||
|
}
|
||||||
|
|
@ -21,13 +21,6 @@ public class SysRoleDept implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 自增Id
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色Id
|
* 角色Id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author author
|
* @author author
|
||||||
|
|
@ -24,13 +24,6 @@ import java.io.Serializable;
|
||||||
public class SysRoleMenu implements Serializable {
|
public class SysRoleMenu implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 自增Id
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色Id
|
* 角色Id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author author
|
* @author author
|
||||||
|
|
@ -27,12 +27,6 @@ public class SysUserPost implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 自增主键Id
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位Id
|
* 岗位Id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author author
|
* @author author
|
||||||
|
|
@ -27,12 +27,6 @@ public class SysUserRole implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 自增Id
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色id
|
* 角色id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.chushang.system.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前在线会话
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserOnline
|
||||||
|
{
|
||||||
|
/** 会话编号 */
|
||||||
|
private String tokenId;
|
||||||
|
|
||||||
|
/** 用户名称 */
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 登录IP地址 */
|
||||||
|
private String ipaddr;
|
||||||
|
|
||||||
|
/** 登录地址 */
|
||||||
|
private String loginLocation;
|
||||||
|
|
||||||
|
/** 浏览器类型 */
|
||||||
|
private String browser;
|
||||||
|
|
||||||
|
/** 操作系统 */
|
||||||
|
private String os;
|
||||||
|
|
||||||
|
/** 登录时间 */
|
||||||
|
private Long loginTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -37,4 +37,4 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.chushang.system.aspect;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.chushang.common.core.text.Convert;
|
import com.chushang.common.core.text.Convert;
|
||||||
import com.chushang.common.core.util.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.mybatis.base.BaseEntity;
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
import com.chushang.security.context.SecurityContextHolder;
|
import com.chushang.security.context.SecurityContextHolder;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,25 @@
|
||||||
package com.chushang.system.controller;
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.dto.ListDictDTO;
|
||||||
|
import com.chushang.system.entity.po.SysDictData;
|
||||||
|
import com.chushang.system.service.ISysDictTypeService;
|
||||||
import com.chushang.system.service.SysDictDataService;
|
import com.chushang.system.service.SysDictDataService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.aspectj.weaver.loadtime.Aj;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author by zhaowenyuan create 2022/8/26 11:43
|
* @author by zhaowenyuan create 2022/8/26 11:43
|
||||||
|
|
@ -16,15 +29,83 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@RequestMapping(value = "/dict/data")
|
@RequestMapping(value = "/dict/data")
|
||||||
public class DictController {
|
public class DictController {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
SysDictDataService dictDataService;
|
SysDictDataService dictDataService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ISysDictTypeService dictTypeService;
|
||||||
/**
|
/**
|
||||||
* 获取字典数据值
|
* 获取字典数据值
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/type/{dictType}")
|
@GetMapping(value = "/type/{dictType}")
|
||||||
public AjaxResult getInfo(@PathVariable String dictType)
|
public AjaxResult getInfo(@PathVariable String dictType)
|
||||||
{
|
{
|
||||||
return dictDataService.selectDictDataByType(dictType);
|
return AjaxResult.success(dictDataService.selectDictDataByType(dictType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(ListDictDTO dictData)
|
||||||
|
{
|
||||||
|
CommonParam pageParam = CommonParam.buildPageRequest();
|
||||||
|
return AjaxResult.success(dictDataService.pageDictDataList(dictData, pageParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "导出字典数据")
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ListDictDTO dictData)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysDictData> list = dictDataService.allDictDataList(dictData,commonParam);
|
||||||
|
ExcelUtils.exportList(response, SysDictData.class, list, "导出字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据详细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:query")
|
||||||
|
@GetMapping(value = "/{dictCode}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(dictDataService.getById(dictCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@SysLog(value = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
dictDataService.saveOrUpdate(dict);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@SysLog(value = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
dictDataService.saveOrUpdate(dict);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictCodes}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||||
|
{
|
||||||
|
dictDataService.removeBatchByIds(Arrays.asList(dictCodes));
|
||||||
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
|
import com.chushang.common.core.exception.utils.AssertUtil;
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
import com.chushang.system.service.ISysDictTypeService;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import org.aspectj.weaver.loadtime.Aj;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:54
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/dict/type")
|
||||||
|
public class DictTypeController {
|
||||||
|
@Resource
|
||||||
|
ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysDictType dictType)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
PageResult pageResult = dictTypeService.pageDictTypeList(dictType, commonParam);
|
||||||
|
return AjaxResult.success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictType dictType)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysDictType> list = dictTypeService.allDictTypeList(dictType, commonParam);
|
||||||
|
ExcelUtils.exportList(response, SysDictType.class, list, "导出字典类型数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典类型详细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:query")
|
||||||
|
@GetMapping(value = "/{dictId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(dictTypeService.getById(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
|
||||||
|
AssertUtil.invalidate(dictTypeService.checkDictTypeUnique(dict, commonParam),"新增字典'" + dict.getDictName() + "'失败,字典类型已存在" );
|
||||||
|
|
||||||
|
dict.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
dictTypeService.saveOrUpdate(dict);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
|
||||||
|
AssertUtil.invalidate(dictTypeService.checkDictTypeUnique(dict, commonParam),"修改字典'" + dict.getDictName() + "'失败,字典类型已存在" );
|
||||||
|
|
||||||
|
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
dictTypeService.saveOrUpdate(dict);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||||
|
{
|
||||||
|
dictTypeService.removeBatchByIds(Arrays.asList(dictIds));
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存 TODO
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@SysLog(value = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/option/select")
|
||||||
|
public AjaxResult optionSelect()
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysDictType> list = dictTypeService.allDictTypeList(new SysDictType(), commonParam);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -86,7 +86,8 @@ public class MenuController {
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (!menu.isFrame() && ! StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
// 外链
|
||||||
|
else if ("0".equals(menu.getFrame()) && ! StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +110,8 @@ public class MenuController {
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (!menu.isFrame() && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
// 外链
|
||||||
|
else if ("0".equals(menu.getFrame()) && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
|
import com.chushang.common.core.exception.utils.AssertUtil;
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.po.SysPost;
|
||||||
|
import com.chushang.system.service.ISysPostService;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:54
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/post")
|
||||||
|
public class PostController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ISysPostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysPost post)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
PageResult pageResult = postService.pagePostList(post, commonParam);
|
||||||
|
return AjaxResult.success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:post:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysPost post)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysPost> list = postService.allPostList(post, commonParam);
|
||||||
|
ExcelUtils.exportList(response, SysPost.class,list, "岗位数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据岗位编号获取详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:query")
|
||||||
|
@GetMapping(value = "/{postId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long postId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(postService.getById(postId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:add")
|
||||||
|
@SysLog(value = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
SysPost postName = new SysPost();
|
||||||
|
postName.setPostName(post.getPostName());
|
||||||
|
postName.setPostCode(null);
|
||||||
|
AssertUtil.invalidate(postService.checkPostCodeUnique(postName, commonParam), "新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
postName.setPostCode(post.getPostCode());
|
||||||
|
postName.setPostName(null);
|
||||||
|
AssertUtil.invalidate(postService.checkPostCodeUnique(postName, commonParam), "新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
post.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
postService.saveOrUpdate(post);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:edit")
|
||||||
|
@SysLog(value = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
SysPost postName = new SysPost();
|
||||||
|
postName.setPostName(post.getPostName());
|
||||||
|
postName.setPostCode(null);
|
||||||
|
AssertUtil.invalidate(postService.checkPostCodeUnique(postName, commonParam), "修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
postName.setPostCode(post.getPostCode());
|
||||||
|
postName.setPostName(null);
|
||||||
|
AssertUtil.invalidate(postService.checkPostCodeUnique(postName, commonParam), "修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
post.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
postService.saveOrUpdate(post);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:remove")
|
||||||
|
@SysLog(value = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{postIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||||
|
{
|
||||||
|
postService.removeBatchByIds(Arrays.asList(postIds));
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/option/select")
|
||||||
|
public AjaxResult optionselect()
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysPost> list = postService.allPostList(new SysPost(), commonParam);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.po.SysConfig;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
import com.chushang.system.service.ISysConfigService;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/config")
|
||||||
|
public class SysConfigController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参数配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysConfig config)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
PageResult pageResult = configService.pageConfigList(config, commonParam);
|
||||||
|
return AjaxResult.success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:config:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysConfig config)
|
||||||
|
{
|
||||||
|
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||||
|
List<SysConfig> list = configService.allConfigList(config, commonParam);
|
||||||
|
ExcelUtils.exportList(response, SysConfig.class, list, "参数数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数编号获取详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{configId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long configId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(configService.getById(configId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数键名查询参数值
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
|
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||||
|
{
|
||||||
|
SysConfig config = new SysConfig();
|
||||||
|
config.setConfigKey(configKey);
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
return AjaxResult.success(configService.getOne(configService.buildWrapper(config, commonParam)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:add")
|
||||||
|
@SysLog(value = "参数管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||||
|
{
|
||||||
|
if (configService.checkConfigKeyUnique(config, CommonParam.buildAllRequest()))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
configService.saveOrUpdate(config);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:edit")
|
||||||
|
@SysLog(value = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||||
|
{
|
||||||
|
if (configService.checkConfigKeyUnique(config, CommonParam.buildAllRequest()))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
configService.saveOrUpdate(config);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:remove")
|
||||||
|
@SysLog(value = "参数管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{configIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||||
|
{
|
||||||
|
configService.removeBatchByIds(Arrays.asList(configIds));
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
//package com.chushang.system.controller;
|
||||||
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.Collection;
|
||||||
|
//import java.util.Collections;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//import com.chushang.common.core.constant.CacheConstants;
|
||||||
|
//import com.chushang.common.core.web.AjaxResult;
|
||||||
|
//import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
//import com.chushang.security.entity.vo.LoginUser;
|
||||||
|
//import com.chushang.system.entity.vo.SysUserOnline;
|
||||||
|
//import com.chushang.system.service.ISysUserOnlineService;
|
||||||
|
//import lombok.extern.java.Log;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 在线用户监控
|
||||||
|
// *
|
||||||
|
// * @author ruoyi
|
||||||
|
// */
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("/online")
|
||||||
|
//public class SysUserOnlineController
|
||||||
|
//{
|
||||||
|
// @Autowired
|
||||||
|
// private ISysUserOnlineService userOnlineService;
|
||||||
|
//
|
||||||
|
// @RequiresPermissions("monitor:online:list")
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public TableDataInfo list(String ipaddr, String userName)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// return getDataTable(userOnlineList);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 强退用户
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("monitor:online:forceLogout")
|
||||||
|
// @Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
|
// @DeleteMapping("/{tokenId}")
|
||||||
|
// public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||||
|
// {
|
||||||
|
// redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
|
// return success();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
@ -73,8 +73,6 @@ public class UserController implements RemoteUserService {
|
||||||
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
||||||
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
sysUser.setPassword("");
|
|
||||||
sysUser.setSalt("");
|
|
||||||
ajax.put("user", sysUser);
|
ajax.put("user", sysUser);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chushang.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chushang.system.entity.po.SysConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:48
|
||||||
|
*/
|
||||||
|
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chushang.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chushang.system.entity.po.SysDictData;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author by zhaowenyuan create 2022/8/26 11:40
|
||||||
|
*/
|
||||||
|
public interface SysDictTypeMapper extends BaseMapper<SysDictType> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chushang.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chushang.system.entity.po.SysPost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:49
|
||||||
|
*/
|
||||||
|
public interface SysPostMapper extends BaseMapper<SysPost> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.po.SysConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:53
|
||||||
|
*/
|
||||||
|
public interface ISysConfigService extends IService<SysConfig> {
|
||||||
|
default PageResult pageConfigList(SysConfig config, CommonParam commonParam){
|
||||||
|
return new PageResult(this.page(new Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
buildWrapper(config, commonParam)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<SysConfig> buildWrapper(SysConfig sysConfig, CommonParam commonParam);
|
||||||
|
|
||||||
|
default List<SysConfig> allConfigList(SysConfig config, CommonParam commonParam){
|
||||||
|
return this.list(this.buildWrapper(config, commonParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
default boolean checkConfigKeyUnique(SysConfig config, CommonParam commonParam){
|
||||||
|
return this.count(buildWrapper(config, commonParam)) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:53
|
||||||
|
*/
|
||||||
|
public interface ISysDictTypeService extends IService<SysDictType> {
|
||||||
|
PageResult pageDictTypeList(SysDictType dictType, CommonParam commonParam);
|
||||||
|
default List<SysDictType> allDictTypeList(SysDictType dictType, CommonParam commonParam){
|
||||||
|
return this.list(buildWrapper(dictType, commonParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysDictType> buildWrapper(SysDictType dictType, CommonParam commonParam);
|
||||||
|
|
||||||
|
default boolean checkDictTypeUnique(SysDictType dictType, CommonParam commonParam){
|
||||||
|
return this.count(buildWrapper(dictType, commonParam)) > 0;
|
||||||
|
}
|
||||||
|
// todo
|
||||||
|
default void resetDictCache(){}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.po.SysPost;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 15:53
|
||||||
|
*/
|
||||||
|
public interface ISysPostService extends IService<SysPost> {
|
||||||
|
default PageResult pagePostList(SysPost sysPost, CommonParam commonParam){
|
||||||
|
IPage<SysPost> page = this.page(
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
buildWrapper(sysPost, commonParam)
|
||||||
|
);
|
||||||
|
return new PageResult(page);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<SysPost> buildWrapper(SysPost sysPost, CommonParam commonParam);
|
||||||
|
|
||||||
|
default List<SysPost> allPostList(SysPost post, CommonParam commonParam){
|
||||||
|
return this.list(buildWrapper(post, commonParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default boolean checkPostCodeUnique(SysPost sysPost, CommonParam commonParam){
|
||||||
|
return this.count(buildWrapper(sysPost, commonParam)) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.system.entity.po.SysRoleDept;
|
import com.chushang.system.entity.po.SysRoleDept;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,7 +18,7 @@ import java.util.List;
|
||||||
* @since 2022-08-18
|
* @since 2022-08-18
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
||||||
|
@Transactional
|
||||||
default void saveBatch(Integer roleId, Integer[] deptIds){
|
default void saveBatch(Integer roleId, Integer[] deptIds){
|
||||||
|
|
||||||
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
||||||
|
|
@ -31,18 +32,18 @@ public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
||||||
rd.setDeptId(deptId);
|
rd.setDeptId(deptId);
|
||||||
list.add(rd);
|
list.add(rd);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (!list.isEmpty())
|
||||||
{
|
{
|
||||||
saveBatch(list);
|
saveBatch(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
default void deleteRoleDept(List<Integer> roleIds){
|
default void deleteRoleDept(List<Integer> roleIds){
|
||||||
if (CollectionUtil.isNotEmpty(roleIds)){
|
if (CollectionUtil.isNotEmpty(roleIds)){
|
||||||
roleIds.forEach(this::removeByRoleId);
|
roleIds.forEach(this::removeByRoleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
default void removeByRoleId(Integer roleId){
|
default void removeByRoleId(Integer roleId){
|
||||||
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.system.entity.po.SysRoleMenu;
|
import com.chushang.system.entity.po.SysRoleMenu;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -18,7 +19,7 @@ import java.util.List;
|
||||||
* @since 2022-08-18
|
* @since 2022-08-18
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
||||||
|
@Transactional
|
||||||
default void saveBatch(Integer roleId, Integer[] menuIds){
|
default void saveBatch(Integer roleId, Integer[] menuIds){
|
||||||
// 先删除 对应的角色菜单
|
// 先删除 对应的角色菜单
|
||||||
remove(new LambdaQueryWrapper<SysRoleMenu>()
|
remove(new LambdaQueryWrapper<SysRoleMenu>()
|
||||||
|
|
@ -34,13 +35,13 @@ public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
||||||
saveBatch(list);
|
saveBatch(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
default void deleteRoleMenu(Collection<Integer> roleIds){
|
default void deleteRoleMenu(Collection<Integer> roleIds){
|
||||||
if (CollectionUtil.isNotEmpty(roleIds)){
|
if (CollectionUtil.isNotEmpty(roleIds)){
|
||||||
roleIds.forEach(this::removeByRoleId);
|
roleIds.forEach(this::removeByRoleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
default void removeByRoleId(Integer roleId){
|
default void removeByRoleId(Integer roleId){
|
||||||
remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
//package com.chushang.system.service;
|
||||||
|
//
|
||||||
|
//import com.chushang.common.core.constant.CacheConstants;
|
||||||
|
//import com.chushang.common.core.util.StringUtils;
|
||||||
|
//import com.chushang.security.entity.vo.LoginUser;
|
||||||
|
//import com.chushang.system.entity.vo.SysUserOnline;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.redisson.api.RKeys;
|
||||||
|
//import org.redisson.api.RedissonClient;
|
||||||
|
//import org.springframework.stereotype.Service;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.Collection;
|
||||||
|
//import java.util.Collections;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 在线用户 服务层
|
||||||
|
// *
|
||||||
|
// * @author ruoyi
|
||||||
|
// */
|
||||||
|
//@Slf4j
|
||||||
|
//@Service
|
||||||
|
//public class ISysUserOnlineService
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// RedissonClient redissonClient;
|
||||||
|
//
|
||||||
|
// public SysUserOnline selectOnlineByIpaddr(){
|
||||||
|
//
|
||||||
|
// Collection<String> keys = new ArrayList<>();
|
||||||
|
// redissonClient.getKeys().getKeys().forEach(key-> {
|
||||||
|
// if (key.startsWith(CacheConstants.LOGIN_TOKEN_KEY)){
|
||||||
|
// keys.add(key);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||||
|
// for (String key : keys)
|
||||||
|
// {
|
||||||
|
// LoginUser user = redisService.getCacheObject(key);
|
||||||
|
// if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||||
|
// {
|
||||||
|
// userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||||
|
// }
|
||||||
|
// else if (StringUtils.isNotEmpty(ipaddr))
|
||||||
|
// {
|
||||||
|
// userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||||
|
// }
|
||||||
|
// else if (StringUtils.isNotEmpty(userName))
|
||||||
|
// {
|
||||||
|
// userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Collections.reverse(userOnlineList);
|
||||||
|
// userOnlineList.removeAll(Collections.singleton(null));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 通过登录地址查询信息
|
||||||
|
// *
|
||||||
|
// * @param ipaddr 登录地址
|
||||||
|
// * @param user 用户信息
|
||||||
|
// * @return 在线用户信息
|
||||||
|
// */
|
||||||
|
// public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user)
|
||||||
|
// {
|
||||||
|
// if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
||||||
|
// {
|
||||||
|
// return loginUserToUserOnline(user);
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 通过用户名称查询信息
|
||||||
|
// *
|
||||||
|
// * @param userName 用户名称
|
||||||
|
// * @param user 用户信息
|
||||||
|
// * @return 在线用户信息
|
||||||
|
// */
|
||||||
|
// public SysUserOnline selectOnlineByUserName(String userName, LoginUser user)
|
||||||
|
// {
|
||||||
|
// if (StringUtils.equals(userName, user.getUsername()))
|
||||||
|
// {
|
||||||
|
// return loginUserToUserOnline(user);
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 通过登录地址/用户名称查询信息
|
||||||
|
// *
|
||||||
|
// * @param ipaddr 登录地址
|
||||||
|
// * @param userName 用户名称
|
||||||
|
// * @param user 用户信息
|
||||||
|
// * @return 在线用户信息
|
||||||
|
// */
|
||||||
|
// public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user)
|
||||||
|
// {
|
||||||
|
// if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
||||||
|
// {
|
||||||
|
// return loginUserToUserOnline(user);
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 设置在线用户信息
|
||||||
|
// *
|
||||||
|
// * @param user 用户信息
|
||||||
|
// * @return 在线用户
|
||||||
|
// */
|
||||||
|
// public SysUserOnline loginUserToUserOnline(LoginUser user)
|
||||||
|
// {
|
||||||
|
// if (StringUtils.isNull(user))
|
||||||
|
// {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// SysUserOnline sysUserOnline = new SysUserOnline();
|
||||||
|
// sysUserOnline.setTokenId(user.getToken());
|
||||||
|
// sysUserOnline.setUserName(user.getUsername());
|
||||||
|
// sysUserOnline.setIpaddr(user.getIpaddr());
|
||||||
|
// sysUserOnline.setLoginTime(user.getLoginTime());
|
||||||
|
// return sysUserOnline;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.chushang.system.service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.system.entity.po.SysUserPost;
|
import com.chushang.system.entity.po.SysUserPost;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -12,7 +13,7 @@ import java.util.stream.Collectors;
|
||||||
* @author by zhaowenyuan create 2022/8/19 11:49
|
* @author by zhaowenyuan create 2022/8/19 11:49
|
||||||
*/
|
*/
|
||||||
public interface ISysUserPostService extends IService<SysUserPost> {
|
public interface ISysUserPostService extends IService<SysUserPost> {
|
||||||
|
@Transactional
|
||||||
default void saveOrUpdate(Integer userId, Integer[] roleIdList){
|
default void saveOrUpdate(Integer userId, Integer[] roleIdList){
|
||||||
//先删除用户与岗位
|
//先删除用户与岗位
|
||||||
this.remove(new LambdaQueryWrapper<SysUserPost>()
|
this.remove(new LambdaQueryWrapper<SysUserPost>()
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.chushang.system.service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.system.entity.po.SysUserRole;
|
import com.chushang.system.entity.po.SysUserRole;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -18,6 +19,7 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
public interface ISysUserRoleService extends IService<SysUserRole> {
|
public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||||
|
|
||||||
|
@Transactional
|
||||||
default void saveOrUpdate(Integer userId, Integer[] roleIdList){
|
default void saveOrUpdate(Integer userId, Integer[] roleIdList){
|
||||||
//先删除用户与角色关系
|
//先删除用户与角色关系
|
||||||
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
||||||
|
|
@ -32,7 +34,7 @@ public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||||
return sysUserRoleEntity;
|
return sysUserRoleEntity;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
default void saveOrUpdate(Integer[] userIdList, Integer roleId){
|
default void saveOrUpdate(Integer[] userIdList, Integer roleId){
|
||||||
//先删除用户与角色关系
|
//先删除用户与角色关系
|
||||||
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,22 @@ package com.chushang.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.dto.ListDictDTO;
|
||||||
import com.chushang.system.entity.po.SysDictData;
|
import com.chushang.system.entity.po.SysDictData;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author by zhaowenyuan create 2022/8/26 11:42
|
* @author by zhaowenyuan create 2022/8/26 11:42
|
||||||
*/
|
*/
|
||||||
public interface SysDictDataService extends IService<SysDictData> {
|
public interface SysDictDataService extends IService<SysDictData> {
|
||||||
|
|
||||||
AjaxResult selectDictDataByType(String dictType);
|
List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
PageResult pageDictDataList(ListDictDTO dictData, CommonParam commonParam);
|
||||||
|
List<SysDictData> allDictDataList(ListDictDTO dictData, CommonParam commonParam);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.chushang.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.system.entity.po.SysConfig;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
import com.chushang.system.mapper.SysConfigMapper;
|
||||||
|
import com.chushang.system.service.ISysConfigService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 18:47
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
||||||
|
public LambdaQueryWrapper<SysConfig> buildWrapper(SysConfig sysConfig, CommonParam commonParam) {
|
||||||
|
return new QueryWrapper<SysConfig>()
|
||||||
|
.orderBy(true, "asc".equals(commonParam.getIsAsc()), commonParam.getOrderBy())
|
||||||
|
.lambda()
|
||||||
|
.eq(null != sysConfig.getConfigId(), SysConfig::getConfigId, sysConfig.getConfigId())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysConfig.getConfigName()), SysConfig::getConfigName, sysConfig.getConfigName())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysConfig.getConfigKey()), SysConfig::getConfigKey, sysConfig.getConfigKey())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysConfig.getConfigType()), SysConfig::getConfigType, sysConfig.getConfigType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,12 +2,19 @@ package com.chushang.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.dto.ListDictDTO;
|
||||||
import com.chushang.system.entity.po.SysDictData;
|
import com.chushang.system.entity.po.SysDictData;
|
||||||
import com.chushang.system.mapper.SysDictDataMapper;
|
import com.chushang.system.mapper.SysDictDataMapper;
|
||||||
import com.chushang.system.service.SysDictDataService;
|
import com.chushang.system.service.SysDictDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.redisson.api.RBucket;
|
import org.redisson.api.RBucket;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -28,24 +35,52 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
|
||||||
String SYS_DICT_KEY = "sys_dict:";
|
String SYS_DICT_KEY = "sys_dict:";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult selectDictDataByType(String dictType) {
|
public List<SysDictData> selectDictDataByType(String dictType) {
|
||||||
RBucket<List<SysDictData>> bucket = redissonClient.getBucket(getCacheKey(dictType));
|
RBucket<List<SysDictData>> bucket = redissonClient.getBucket(getCacheKey(dictType));
|
||||||
List<SysDictData> dictDataList = bucket.get();
|
List<SysDictData> dictDataList = bucket.get();
|
||||||
if (CollectionUtil.isNotEmpty(dictDataList)){
|
if (CollectionUtil.isNotEmpty(dictDataList)) {
|
||||||
return AjaxResult.success(dictDataList);
|
return dictDataList;
|
||||||
}
|
}
|
||||||
List<SysDictData> list = list(new LambdaQueryWrapper<SysDictData>()
|
List<SysDictData> list = list(new LambdaQueryWrapper<SysDictData>()
|
||||||
.eq(SysDictData::getDictType, dictType)
|
.eq(SysDictData::getDictType, dictType)
|
||||||
.eq(SysDictData::getStatus, "0")
|
.eq(SysDictData::getStatus, "0")
|
||||||
.orderByAsc(SysDictData::getDictSort)
|
.orderByAsc(SysDictData::getDictSort)
|
||||||
);
|
);
|
||||||
if (CollectionUtil.isNotEmpty(list)){
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
bucket.set(list);
|
bucket.set(list);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(list);
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCacheKey(String cacheKey){
|
@Override
|
||||||
|
public PageResult pageDictDataList(ListDictDTO dictData, CommonParam commonParam) {
|
||||||
|
IPage<SysDictData> page = this.page(
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
buildWrapper(dictData, commonParam)
|
||||||
|
);
|
||||||
|
return new PageResult(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysDictData> allDictDataList(ListDictDTO dictData, CommonParam commonParam) {
|
||||||
|
return this.list(buildWrapper(dictData, commonParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getCacheKey(String cacheKey) {
|
||||||
return SYS_DICT_KEY + cacheKey;
|
return SYS_DICT_KEY + cacheKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<SysDictData> buildWrapper(ListDictDTO dictData, CommonParam commonParam) {
|
||||||
|
return new QueryWrapper<SysDictData>()
|
||||||
|
.orderBy(true, "asc".equals(commonParam.getIsAsc()), commonParam.getOrderBy())
|
||||||
|
.lambda()
|
||||||
|
.eq(null != dictData.getDictCode(), SysDictData::getDictCode, dictData.getDictCode())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictData.getCssClass()), SysDictData::getCssClass, dictData.getCssClass())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictData.getListClass()), SysDictData::getListClass, dictData.getListClass())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictData.getIsDefault()), SysDictData::getIsDefault, dictData.getIsDefault())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.chushang.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.dto.ListDictDTO;
|
||||||
|
import com.chushang.system.entity.po.SysDictData;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
import com.chushang.system.mapper.SysDictTypeMapper;
|
||||||
|
import com.chushang.system.service.ISysDictTypeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 17:57
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
|
||||||
|
@Override
|
||||||
|
public PageResult pageDictTypeList(SysDictType dictType, CommonParam commonParam) {
|
||||||
|
IPage<SysDictType> page = this.page(
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
buildWrapper(dictType, commonParam)
|
||||||
|
);
|
||||||
|
return new PageResult(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LambdaQueryWrapper<SysDictType> buildWrapper(SysDictType dictType, CommonParam commonParam) {
|
||||||
|
return new QueryWrapper<SysDictType>()
|
||||||
|
.orderBy(true, "asc".equals(commonParam.getIsAsc()), commonParam.getOrderBy())
|
||||||
|
.lambda()
|
||||||
|
.eq(null != dictType.getDictId(), SysDictType::getDictId, dictType.getDictId())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName())
|
||||||
|
.eq(StringUtils.isNotEmpty(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -105,12 +105,13 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
for (SysMenu menu : menus)
|
for (SysMenu menu : menus)
|
||||||
{
|
{
|
||||||
RouterVo router = new RouterVo();
|
RouterVo router = new RouterVo();
|
||||||
router.setHidden(menu.isVisible());
|
// visible 为1 代表显示路由
|
||||||
|
router.setHidden("0".equals(menu.getVisible()));
|
||||||
router.setName(getRouteName(menu));
|
router.setName(getRouteName(menu));
|
||||||
router.setPath(getRouterPath(menu));
|
router.setPath(getRouterPath(menu));
|
||||||
router.setComponent(getComponent(menu));
|
router.setComponent(getComponent(menu));
|
||||||
router.setQuery(menu.getQuery());
|
router.setQuery(menu.getQuery());
|
||||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.isCache(), menu.getPath()));
|
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), "0".equals(menu.getCache()), menu.getPath()));
|
||||||
List<SysMenu> cMenus = menu.getChildren();
|
List<SysMenu> cMenus = menu.getChildren();
|
||||||
if (!cMenus.isEmpty() && MenuTypeEnum.CATALOG.equals(menu.getMenuType()))
|
if (!cMenus.isEmpty() && MenuTypeEnum.CATALOG.equals(menu.getMenuType()))
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +127,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
children.setPath(menu.getPath());
|
children.setPath(menu.getPath());
|
||||||
children.setComponent(menu.getComponent());
|
children.setComponent(menu.getComponent());
|
||||||
children.setName(StringUtils.capitalize(menu.getPath()));
|
children.setName(StringUtils.capitalize(menu.getPath()));
|
||||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.isCache(), menu.getPath()));
|
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), "0".equals(menu.getCache()), menu.getPath()));
|
||||||
children.setQuery(menu.getQuery());
|
children.setQuery(menu.getQuery());
|
||||||
childrenList.add(children);
|
childrenList.add(children);
|
||||||
router.setChildren(childrenList);
|
router.setChildren(childrenList);
|
||||||
|
|
@ -175,7 +176,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
*/
|
*/
|
||||||
public boolean isMenuFrame(SysMenu menu)
|
public boolean isMenuFrame(SysMenu menu)
|
||||||
{
|
{
|
||||||
return menu.getParentId() == 0 && MenuTypeEnum.MENU.equals(menu.getMenuType()) && menu.isFrame();
|
return menu.getParentId() == 0 && MenuTypeEnum.MENU.equals(menu.getMenuType()) && "1".equals(menu.getFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -194,7 +195,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
}
|
}
|
||||||
// 非外链并且是一级目录(类型为目录)
|
// 非外链并且是一级目录(类型为目录)
|
||||||
if (0 == menu.getParentId() && MenuTypeEnum.CATALOG.equals(menu.getMenuType())
|
if (0 == menu.getParentId() && MenuTypeEnum.CATALOG.equals(menu.getMenuType())
|
||||||
&& menu.isFrame())
|
&& "1".equals(menu.getFrame()))
|
||||||
{
|
{
|
||||||
routerPath = "/" + menu.getPath();
|
routerPath = "/" + menu.getPath();
|
||||||
}
|
}
|
||||||
|
|
@ -213,10 +214,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
menu.setMenuName("系统管理");
|
menu.setMenuName("系统管理");
|
||||||
menu.setPath("system");
|
menu.setPath("system");
|
||||||
menu.setMenuType(MenuTypeEnum.CATALOG);
|
menu.setMenuType(MenuTypeEnum.CATALOG);
|
||||||
menu.setFrame(false);
|
menu.setFrame("1");
|
||||||
menu.setCache(false);
|
menu.setCache("1");
|
||||||
menu.setVisible(false);
|
menu.setVisible("1");
|
||||||
menu.setStatus(false);
|
menu.setStatus("1");
|
||||||
String routerPath = sysMenuService.getRouterPath(menu);
|
String routerPath = sysMenuService.getRouterPath(menu);
|
||||||
System.out.println(routerPath);
|
System.out.println(routerPath);
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +230,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
*/
|
*/
|
||||||
public boolean isInnerLink(SysMenu menu)
|
public boolean isInnerLink(SysMenu menu)
|
||||||
{
|
{
|
||||||
return !menu.isFrame() && StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS);
|
return "1".equals(menu.getFrame()) && StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.chushang.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
|
import com.chushang.system.entity.po.SysPost;
|
||||||
|
import com.chushang.system.mapper.SysPostMapper;
|
||||||
|
import com.chushang.system.service.ISysPostService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/5/9 18:33
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> implements ISysPostService {
|
||||||
|
|
||||||
|
public LambdaQueryWrapper<SysPost> buildWrapper(SysPost sysPost, CommonParam commonParam) {
|
||||||
|
return new QueryWrapper<SysPost>()
|
||||||
|
.orderBy(true, "asc".equals(commonParam.getIsAsc()), commonParam.getOrderBy())
|
||||||
|
.lambda()
|
||||||
|
.eq(null != sysPost.getPostId(), SysPost::getPostId, sysPost.getPostId())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysPost.getPostCode()), SysPost::getPostCode, sysPost.getPostCode())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysPost.getPostName()), SysPost::getPostName, sysPost.getPostName())
|
||||||
|
.eq(StringUtils.isNotEmpty(sysPost.getStatus()), SysPost::getStatus, sysPost.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package com.chushang.system.service.impl;
|
package com.chushang.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.common.core.exception.ResultException;
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.util.SpringUtils;
|
import com.chushang.common.core.util.SpringUtils;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.mybatis.utils.PageUtils;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.annotation.DataScope;
|
import com.chushang.system.annotation.DataScope;
|
||||||
import com.chushang.system.mapper.SysRoleMapper;
|
import com.chushang.system.mapper.SysRoleMapper;
|
||||||
|
|
@ -76,10 +75,10 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d")
|
@DataScope(deptAlias = "d")
|
||||||
public AjaxResult selectRoleList(ListRoleDTO listRole) {
|
public AjaxResult selectRoleList(ListRoleDTO listRole) {
|
||||||
Page<SysRole> page = new Page<>(listRole.getPage(), listRole.getLimit());
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysRole> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(listRole.getPage(), listRole.getLimit());
|
||||||
List<SysRole> listAfDataVOList = baseMapper.listRole(listRole, page);
|
List<SysRole> listAfDataVOList = baseMapper.listRole(listRole, page);
|
||||||
|
|
||||||
return AjaxResult.success(new PageUtils(
|
return AjaxResult.success(new PageResult(
|
||||||
listAfDataVOList,
|
listAfDataVOList,
|
||||||
page.getTotal(),
|
page.getTotal(),
|
||||||
page.getPages(),
|
page.getPages(),
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,12 @@ package com.chushang.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.common.core.exception.ResultException;
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.util.IdUtils;
|
import com.chushang.common.core.util.IdUtils;
|
||||||
import com.chushang.common.core.util.SpringUtils;
|
import com.chushang.common.core.util.SpringUtils;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.mybatis.utils.PageUtils;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import com.chushang.security.service.TokenService;
|
import com.chushang.security.service.TokenService;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.annotation.DataScope;
|
import com.chushang.system.annotation.DataScope;
|
||||||
|
|
@ -54,11 +53,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public AjaxResult listUser(ListUserDTO listUser) {
|
public AjaxResult listUser(ListUserDTO listUser) {
|
||||||
Page<SysUser> page = new Page<>(listUser.getPage(),listUser.getLimit());
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUser> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(listUser.getPage(),listUser.getLimit());
|
||||||
|
|
||||||
List<SysUser> listAfDataVOList = baseMapper.listUser(listUser,
|
List<SysUser> listAfDataVOList = baseMapper.listUser(listUser,
|
||||||
page);
|
page);
|
||||||
return AjaxResult.success(new PageUtils(
|
return AjaxResult.success(new PageResult(
|
||||||
listAfDataVOList,
|
listAfDataVOList,
|
||||||
page.getTotal(),
|
page.getTotal(),
|
||||||
page.getPages(),
|
page.getPages(),
|
||||||
|
|
@ -164,11 +163,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public AjaxResult selectAllocatedList(ListUserDTO listUser) {
|
public AjaxResult selectAllocatedList(ListUserDTO listUser) {
|
||||||
Page<SysUser> page = new Page<>(listUser.getPage(),listUser.getLimit());
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUser> page =
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(listUser.getPage(),listUser.getLimit());
|
||||||
List<SysUser> userList = baseMapper.selectAllocatedList(listUser,
|
List<SysUser> userList = baseMapper.selectAllocatedList(listUser,
|
||||||
page);
|
page);
|
||||||
return AjaxResult.success(new PageUtils(
|
return AjaxResult.success(new PageResult(
|
||||||
userList,
|
userList,
|
||||||
page.getTotal(),
|
page.getTotal(),
|
||||||
page.getPages(),
|
page.getPages(),
|
||||||
|
|
@ -178,11 +177,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public AjaxResult selectUnallocatedList(ListUserDTO listUser) {
|
public AjaxResult selectUnallocatedList(ListUserDTO listUser) {
|
||||||
Page<SysUser> page = new Page<>(listUser.getPage(),listUser.getLimit());
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUser> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(listUser.getPage(),listUser.getLimit());
|
||||||
|
|
||||||
List<SysUser> userList = baseMapper.selectUnallocatedList(listUser,
|
List<SysUser> userList = baseMapper.selectUnallocatedList(listUser,
|
||||||
page);
|
page);
|
||||||
return AjaxResult.success(new PageUtils(
|
return AjaxResult.success(new PageResult(
|
||||||
userList,
|
userList,
|
||||||
page.getTotal(),
|
page.getTotal(),
|
||||||
page.getPages(),
|
page.getPages(),
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,15 @@
|
||||||
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
<springProperty scope="context" name="plumelog.kafka.hosts" source="plumelog.kafka.hosts"/>
|
||||||
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
<springProperty scope="context" name="plumelog.redis.hosts" source="plumelog.redis.hosts" />
|
||||||
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
<springProperty scope="context" name="plumelog.redis.auth" source="plumelog.redis.auth" />
|
||||||
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
<springProperty scope="context" name="plumelog.redis.db" source="plumelog.redis.db" />
|
||||||
|
<springProperty scope="context" name="plumelog.env" source="spring.profiles.active"/>
|
||||||
|
|
||||||
|
<property name="log.kafka.hosts" value="${plumelog.kafka.hosts}" />
|
||||||
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
<property name="log.redis.hosts" value="${plumelog.redis.hosts}" />
|
||||||
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
<property name="log.redis.auth" value="${plumelog.redis.auth}" />
|
||||||
|
<property name="log.redis.db" value="${plumelog.redis.db}"/>
|
||||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||||
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
|
|
@ -91,6 +95,8 @@
|
||||||
<!-- <appName>${spring.application.name}</appName>-->
|
<!-- <appName>${spring.application.name}</appName>-->
|
||||||
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
<!-- <redisHost>${log.redis.hosts}</redisHost>-->
|
||||||
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
<!-- <redisAuth>${log.redis.auth}</redisAuth>-->
|
||||||
|
<!-- <redisDb>${log.redis.db}</redisDb>-->
|
||||||
|
<!-- <env>${log.env}</env>-->
|
||||||
<!-- </appender>-->
|
<!-- </appender>-->
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
where m.del_state = FALSE
|
where m.del_state = FALSE
|
||||||
AND m.menu_type in ('M', 'C')
|
AND m.menu_type in ('M', 'C')
|
||||||
and m.status = 0
|
and m.status = 1
|
||||||
order by m.parent_id, m.order_num
|
order by m.parent_id, m.order_num
|
||||||
</select>
|
</select>
|
||||||
<select id="selectMenuTreeByUserId" resultMap="SysMenuResult">
|
<select id="selectMenuTreeByUserId" resultMap="SysMenuResult">
|
||||||
|
|
@ -166,7 +166,7 @@
|
||||||
where m.del_state = FALSE
|
where m.del_state = FALSE
|
||||||
AND u.user_id = #{userId}
|
AND u.user_id = #{userId}
|
||||||
and m.menu_type in ('M', 'C')
|
and m.menu_type in ('M', 'C')
|
||||||
and m.status = 0
|
and m.status = 1
|
||||||
AND ro.status = 1
|
AND ro.status = 1
|
||||||
order by m.parent_id, m.order_num
|
order by m.parent_id, m.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -176,6 +176,6 @@
|
||||||
FROM sys_menu m
|
FROM sys_menu m
|
||||||
LEFT JOIN sys_role_menu rm ON m.menu_id = rm.menu_id
|
LEFT JOIN sys_role_menu rm ON m.menu_id = rm.menu_id
|
||||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( m.perms ) - LENGTH( REPLACE ( m.perms, ',', '' ) ) + 1 )
|
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( m.perms ) - LENGTH( REPLACE ( m.perms, ',', '' ) ) + 1 )
|
||||||
WHERE m.STATUS = '0' AND rm.role_id = #{roleId}
|
WHERE m.STATUS = 1 AND rm.role_id = #{roleId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
10
pom.xml
10
pom.xml
|
|
@ -67,6 +67,8 @@
|
||||||
<thumbnailator.version>0.4.20</thumbnailator.version>
|
<thumbnailator.version>0.4.20</thumbnailator.version>
|
||||||
<aliyun.oss.version>3.14.1</aliyun.oss.version>
|
<aliyun.oss.version>3.14.1</aliyun.oss.version>
|
||||||
<jsqparser.version>4.3</jsqparser.version>
|
<jsqparser.version>4.3</jsqparser.version>
|
||||||
|
<pagehelper.boot.version>2.0.0</pagehelper.boot.version>
|
||||||
|
|
||||||
<easy-es.version>2.0.0-beta8</easy-es.version>
|
<easy-es.version>2.0.0-beta8</easy-es.version>
|
||||||
<es.version>7.14.0</es.version>
|
<es.version>7.14.0</es.version>
|
||||||
<arthas.version>3.6.7</arthas.version>
|
<arthas.version>3.6.7</arthas.version>
|
||||||
|
|
@ -525,6 +527,12 @@
|
||||||
<artifactId>jsqlparser</artifactId>
|
<artifactId>jsqlparser</artifactId>
|
||||||
<version>${jsqparser.version}</version>
|
<version>${jsqparser.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>${pagehelper.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.elasticsearch.client</groupId>
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
|
@ -606,4 +614,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue