采用枚举类型

master
RuoYi 6 years ago committed by Limy
parent 2248b0b9b6
commit 64a918838e

@ -374,16 +374,16 @@ drop table if exists sys_oper_log;
create table sys_oper_log (
oper_id int(11) not null auto_increment comment '日志主键',
title varchar(50) default '' comment '模块标题',
action varchar(100) default '' comment '功能请求',
business_type int(2) default 0 comment '业务类型0其它 1新增 2修改 3删除',
method varchar(100) default '' comment '方法名称',
channel varchar(20) default '' comment '来源渠道manage后台用户 mobile手机端用户 other其它',
operator_type int(1) default 0 comment '操作类别0其它 1后台用户 2手机端用户',
oper_name varchar(50) default '' comment '操作人员',
dept_name varchar(50) default '' comment '部门名称',
oper_url varchar(255) default '' comment '请求URL',
oper_ip varchar(30) default '' comment '主机地址',
oper_location varchar(255) default '' comment '操作地点',
oper_param varchar(255) default '' comment '请求参数',
status char(1) default '0' comment '操作状态0正常 1异常',
status int(1) default 0 comment '操作状态0正常 1异常',
error_msg varchar(2000) default '' comment '错误消息',
oper_time datetime comment '操作时间',
primary key (oper_id)

@ -39,13 +39,11 @@ public class DsAspect
Method method = signature.getMethod();
if (method.isAnnotationPresent(Ds.class))
Ds dataSource = method.getAnnotation(Ds.class);
if (StringUtils.isNotNull(dataSource))
{
Ds dataSource = method.getAnnotation(Ds.class);
if (StringUtils.isNotNull(dataSource) && StringUtils.isNotEmpty(dataSource.name()))
{
DynamicDataSourceContextHolder.setDB(dataSource.name());
}
DynamicDataSourceContextHolder.setDateSoureType(dataSource.value().name());
}
try
@ -54,7 +52,8 @@ public class DsAspect
}
finally
{
DynamicDataSourceContextHolder.clearDB();
// 销毁数据源 在执行方法之后
DynamicDataSourceContextHolder.clearDateSoureType();
}
}
}

@ -19,7 +19,7 @@ import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessStatus;
import com.ruoyi.framework.aspectj.lang.enums.BusinessStatus;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.project.monitor.operlog.domain.OperLog;
@ -83,7 +83,7 @@ public class LogAspect
// *========数据库日志=========*//
OperLog operLog = new OperLog();
operLog.setStatus(BusinessStatus.SUCCESS);
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
// 请求的地址
String ip = ShiroUtils.getIp();
operLog.setOperIp(ip);
@ -101,7 +101,7 @@ public class LogAspect
if (e != null)
{
operLog.setStatus(BusinessStatus.FAIL);
operLog.setStatus(BusinessStatus.FAIL.ordinal());
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
}
// 设置方法名称
@ -132,11 +132,11 @@ public class LogAspect
public void getControllerMethodDescription(Log log, OperLog operLog) throws Exception
{
// 设置action动作
operLog.setAction(log.action());
operLog.setBusinessType(log.businessType().ordinal());
// 设置标题
operLog.setTitle(log.title());
// 设置channel
operLog.setChannel(log.channel());
// 设置操作人类别
operLog.setOperatorType(log.operatorType().ordinal());
// 是否需要保存request参数和值
if (log.isSaveRequestData())
{

@ -4,7 +4,8 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.ruoyi.framework.aspectj.lang.constant.DataSourceName;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
/**
*
@ -16,7 +17,7 @@ import com.ruoyi.framework.aspectj.lang.constant.DataSourceName;
public @interface Ds
{
/**
*
*
*/
String name() default DataSourceName.MASTER;
public DataSourceType value() default DataSourceType.MASTER;
}

@ -5,7 +5,8 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.ruoyi.framework.aspectj.lang.constant.OperatorType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.OperatorType;
/**
*
@ -22,10 +23,10 @@ public @interface Log
String title() default "";
/** 功能 */
String action() default "";
BusinessType businessType() default BusinessType.OTHER;
/** 渠道 */
String channel() default OperatorType.MANAGE;
/** 操作人类别 */
OperatorType operatorType() default OperatorType.MANAGE;
/** 是否保存请求的参数 */
boolean isSaveRequestData() default true;

@ -1,19 +0,0 @@
package com.ruoyi.framework.aspectj.lang.constant;
/**
*
*
* @author ruoyi
*
*/
public class BusinessStatus
{
/** 其它 */
public static final String OTHER = "-1";
/** 成功 */
public static final String SUCCESS = "0";
/** 失败 */
public static final String FAIL = "1";
}

@ -1,29 +0,0 @@
package com.ruoyi.framework.aspectj.lang.constant;
/**
*
*
* @author ruoyi
*
*/
public class BusinessType
{
/** 其它 */
public static final String OTHER = "0";
/** 新增 */
public static final String INSERT = "1";
/** 修改 */
public static final String UPDATE = "2";
/** 删除 */
public static final String DELETE = "3";
/** 授权 */
public static final String GRANT = "4";
/** 导出 */
public static final String EXPORT = "5";
/** 导入 */
public static final String IMPORT = "6";
/** 强退 */
public static final String FORCE = "7";
/** 生成代码 */
public static final String GENCODE = "8";
}

@ -1,16 +0,0 @@
package com.ruoyi.framework.aspectj.lang.constant;
/**
*
*
* @author ruoyi
*
*/
public class DataSourceName
{
/** 主库 */
public static final String MASTER = "master";
/** 从库 */
public static final String SLAVE = "slave";
}

@ -1,22 +0,0 @@
package com.ruoyi.framework.aspectj.lang.constant;
/**
*
*
* @author ruoyi
*
*/
public class OperatorType
{
/** 其它 */
public static final String OTHER = "0";
/** 后台用户 */
public static final String MANAGE = "1";
/** 渠道用户 */
public static final String CHANNEL = "2";
/** 手机端用户 */
public static final String MOBILE = "3";
}

@ -0,0 +1,20 @@
package com.ruoyi.framework.aspectj.lang.enums;
/**
*
*
* @author ruoyi
*
*/
public enum BusinessStatus
{
/**
*
*/
SUCCESS,
/**
*
*/
FAIL,
}

@ -0,0 +1,55 @@
package com.ruoyi.framework.aspectj.lang.enums;
/**
*
*
* @author ruoyi
*
*/
public enum BusinessType
{
/**
*
*/
OTHER,
/**
*
*/
INSERT,
/**
*
*/
UPDATE,
/**
*
*/
DELETE,
/**
*
*/
GRANT,
/**
*
*/
EXPORT,
/**
*
*/
IMPORT,
/**
* 退
*/
FORCE,
/**
*
*/
GENCODE,
}

@ -0,0 +1,19 @@
package com.ruoyi.framework.aspectj.lang.enums;
/**
*
*
* @author ruoyi
*/
public enum DataSourceType
{
/**
*
*/
MASTER,
/**
*
*/
SLAVE
}

@ -0,0 +1,26 @@
package com.ruoyi.framework.aspectj.lang.enums;
/**
*
*
* @author ruoyi
*
*/
public enum OperatorType
{
/**
*
*/
OTHER,
/**
*
*/
MANAGE,
/**
*
*/
MOBILE
}

@ -9,7 +9,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.ruoyi.framework.aspectj.lang.constant.DataSourceName;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.framework.datasource.DynamicDataSource;
/**
@ -29,7 +29,7 @@ public class DruidConfig
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "open", havingValue = "true")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource()
{
return DruidDataSourceBuilder.create().build();
@ -40,8 +40,8 @@ public class DruidConfig
public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource)
{
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceName.MASTER, masterDataSource);
targetDataSources.put(DataSourceName.SLAVE, slaveDataSource);
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
targetDataSources.put(DataSourceType.SLAVE.name(), slaveDataSource);
return new DynamicDataSource(masterDataSource, targetDataSources);
}
}

@ -21,7 +21,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource
@Override
protected Object determineCurrentLookupKey()
{
return DynamicDataSourceContextHolder.getDB();
return DynamicDataSourceContextHolder.getDateSoureType();
}
}

@ -4,7 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 线
*
*
* @author ruoyi
*/
@ -12,29 +12,33 @@ public class DynamicDataSourceContextHolder
{
public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
/**
* 使ThreadLocalThreadLocal使线
* 线线
*/
private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
/**
*
*
*/
public static void setDB(String dbType)
public static void setDateSoureType(String dsType)
{
log.info("切换到{}数据源", dbType);
CONTEXT_HOLDER.set(dbType);
log.info("切换到{}数据源", dsType);
CONTEXT_HOLDER.set(dsType);
}
/**
*
*
*/
public static String getDB()
public static String getDateSoureType()
{
return CONTEXT_HOLDER.get();
}
/**
*
*
*/
public static void clearDB()
public static void clearDateSoureType()
{
CONTEXT_HOLDER.remove();
}

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -50,7 +50,7 @@ public class JobController extends BaseController
return getDataTable(list);
}
@Log(title = "定时任务", action = BusinessType.EXPORT)
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:job:export")
@PostMapping("/export")
@ResponseBody
@ -68,7 +68,7 @@ public class JobController extends BaseController
}
}
@Log(title = "定时任务", action = BusinessType.DELETE)
@Log(title = "定时任务", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:job:remove")
@PostMapping("/remove")
@ResponseBody
@ -89,7 +89,7 @@ public class JobController extends BaseController
/**
*
*/
@Log(title = "定时任务", action = BusinessType.UPDATE)
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:changeStatus")
@PostMapping("/changeStatus")
@ResponseBody
@ -101,7 +101,7 @@ public class JobController extends BaseController
/**
*
*/
@Log(title = "定时任务", action = BusinessType.UPDATE)
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:changeStatus")
@PostMapping("/run")
@ResponseBody
@ -122,7 +122,7 @@ public class JobController extends BaseController
/**
*
*/
@Log(title = "定时任务", action = BusinessType.INSERT)
@Log(title = "定时任务", businessType = BusinessType.INSERT)
@RequiresPermissions("monitor:job:add")
@PostMapping("/add")
@ResponseBody
@ -144,7 +144,7 @@ public class JobController extends BaseController
/**
*
*/
@Log(title = "定时任务", action = BusinessType.UPDATE)
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:edit")
@PostMapping("/edit")
@ResponseBody

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -48,7 +48,7 @@ public class JobLogController extends BaseController
return getDataTable(list);
}
@Log(title = "调度日志", action = BusinessType.EXPORT)
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:job:export")
@PostMapping("/export")
@ResponseBody
@ -66,7 +66,7 @@ public class JobLogController extends BaseController
}
}
@Log(title = "调度日志", action = BusinessType.DELETE)
@Log(title = "调度日志", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:job:remove")
@PostMapping("/remove")
@ResponseBody

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -48,7 +48,7 @@ public class LogininforController extends BaseController
return getDataTable(list);
}
@Log(title = "登陆日志", action = BusinessType.EXPORT)
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:logininfor:export")
@PostMapping("/export")
@ResponseBody
@ -67,7 +67,7 @@ public class LogininforController extends BaseController
}
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登陆日志", action = BusinessType.DELETE)
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)

@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
@ -55,7 +55,7 @@ public class UserOnlineController extends BaseController
}
@RequiresPermissions("monitor:online:batchForceLogout")
@Log(title = "在线用户", action = BusinessType.FORCE)
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@PostMapping("/batchForceLogout")
@ResponseBody
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
@ -84,7 +84,7 @@ public class UserOnlineController extends BaseController
}
@RequiresPermissions("monitor:online:forceLogout")
@Log(title = "在线用户", action = BusinessType.FORCE)
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@PostMapping("/forceLogout")
@ResponseBody
public AjaxResult forceLogout(String sessionId)

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -50,7 +50,7 @@ public class OperlogController extends BaseController
return getDataTable(list);
}
@Log(title = "操作日志", action = BusinessType.EXPORT)
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export")
@PostMapping("/export")
@ResponseBody

@ -21,17 +21,17 @@ public class OperLog extends BaseEntity
@Excel(name = "操作模块")
private String title;
/** 操作类型 */
@Excel(name = "操作类型")
private String action;
/** 操作业务类型 */
@Excel(name = "业务类型")
private Integer businessType;
/** 请求方法 */
@Excel(name = "请求方法")
private String method;
/** 来源渠道 */
@Excel(name = "来源渠道")
private String channel;
/** 操作人类别 */
@Excel(name = "操作类别")
private Integer operatorType;
/** 操作人员 */
@Excel(name = "操作人员")
@ -59,7 +59,7 @@ public class OperLog extends BaseEntity
/** 状态0正常 1异常 */
@Excel(name = "状态")
private String status;
private Integer status;
/** 错误消息 */
@Excel(name = "错误消息")
@ -89,14 +89,14 @@ public class OperLog extends BaseEntity
this.title = title;
}
public String getAction()
public Integer getBusinessType()
{
return action;
return businessType;
}
public void setAction(String action)
public void setBusinessType(Integer businessType)
{
this.action = action;
this.businessType = businessType;
}
public String getMethod()
@ -109,14 +109,14 @@ public class OperLog extends BaseEntity
this.method = method;
}
public String getChannel()
public Integer getOperatorType()
{
return channel;
return operatorType;
}
public void setChannel(String channel)
public void setOperatorType(Integer operatorType)
{
this.channel = channel;
this.operatorType = operatorType;
}
public String getOperName()
@ -179,12 +179,12 @@ public class OperLog extends BaseEntity
this.operParam = operParam;
}
public String getStatus()
public Integer getStatus()
{
return status;
}
public void setStatus(String status)
public void setStatus(Integer status)
{
this.status = status;
}
@ -212,10 +212,10 @@ public class OperLog extends BaseEntity
@Override
public String toString()
{
return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method
+ ", channel=" + channel + ", operName=" + operName + ", deptName=" + deptName + ", operUrl=" + operUrl
+ ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam + ", status="
+ status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]";
return "OperLog [operId=" + operId + ", title=" + title + ", businessType=" + businessType + ", method="
+ method + ", operatorType=" + operatorType + ", operName=" + operName + ", deptName=" + deptName
+ ", operUrl=" + operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam="
+ operParam + ", status=" + status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]";
}
}

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -54,7 +54,7 @@ public class ConfigController extends BaseController
return getDataTable(list);
}
@Log(title = "参数管理", action = BusinessType.EXPORT)
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:config:export")
@PostMapping("/export")
@ResponseBody
@ -85,7 +85,7 @@ public class ConfigController extends BaseController
*
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", action = BusinessType.INSERT)
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Config config)
@ -107,7 +107,7 @@ public class ConfigController extends BaseController
*
*/
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", action = BusinessType.UPDATE)
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(Config config)
@ -119,7 +119,7 @@ public class ConfigController extends BaseController
*
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", action = BusinessType.DELETE)
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.dept.domain.Dept;
@ -62,7 +62,7 @@ public class DeptController extends BaseController
/**
*
*/
@Log(title = "部门管理", action = BusinessType.INSERT)
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dept:add")
@PostMapping("/add")
@ResponseBody
@ -84,7 +84,7 @@ public class DeptController extends BaseController
/**
*
*/
@Log(title = "部门管理", action = BusinessType.UPDATE)
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit")
@PostMapping("/edit")
@ResponseBody
@ -96,7 +96,7 @@ public class DeptController extends BaseController
/**
*
*/
@Log(title = "部门管理", action = BusinessType.DELETE)
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dept:remove")
@PostMapping("/remove/{deptId}")
@ResponseBody

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -50,7 +50,7 @@ public class DictDataController extends BaseController
return getDataTable(list);
}
@Log(title = "字典数据", action = BusinessType.EXPORT)
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
@ -81,7 +81,7 @@ public class DictDataController extends BaseController
/**
*
*/
@Log(title = "字典数据", action = BusinessType.INSERT)
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
@ -103,7 +103,7 @@ public class DictDataController extends BaseController
/**
*
*/
@Log(title = "字典数据", action = BusinessType.UPDATE)
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
@ -112,7 +112,7 @@ public class DictDataController extends BaseController
return toAjax(dictDataService.updateDictData(dict));
}
@Log(title = "字典数据", action = BusinessType.DELETE)
@Log(title = "字典数据", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove")
@PostMapping("/remove")
@ResponseBody

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -51,7 +51,7 @@ public class DictTypeController extends BaseController
return getDataTable(list);
}
@Log(title = "字典类型", action = BusinessType.EXPORT)
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
@ -81,7 +81,7 @@ public class DictTypeController extends BaseController
/**
*
*/
@Log(title = "字典类型", action = BusinessType.INSERT)
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
@ -103,7 +103,7 @@ public class DictTypeController extends BaseController
/**
*
*/
@Log(title = "字典类型", action = BusinessType.UPDATE)
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
@ -112,7 +112,7 @@ public class DictTypeController extends BaseController
return toAjax(dictTypeService.updateDictType(dict));
}
@Log(title = "字典类型", action = BusinessType.DELETE)
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove")
@PostMapping("/remove")
@ResponseBody

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.menu.domain.Menu;
@ -54,7 +54,7 @@ public class MenuController extends BaseController
/**
*
*/
@Log(title = "菜单管理", action = BusinessType.DELETE)
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove")
@PostMapping("/remove/{menuId}")
@ResponseBody
@ -95,7 +95,7 @@ public class MenuController extends BaseController
/**
*
*/
@Log(title = "菜单管理", action = BusinessType.INSERT)
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:menu:add")
@PostMapping("/add")
@ResponseBody
@ -117,7 +117,7 @@ public class MenuController extends BaseController
/**
*
*/
@Log(title = "菜单管理", action = BusinessType.UPDATE)
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@PostMapping("/edit")
@ResponseBody

@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -65,7 +65,7 @@ public class NoticeController extends BaseController
*
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", action = BusinessType.INSERT)
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Notice notice)
@ -87,7 +87,7 @@ public class NoticeController extends BaseController
*
*/
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", action = BusinessType.UPDATE)
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(Notice notice)
@ -99,7 +99,7 @@ public class NoticeController extends BaseController
*
*/
@RequiresPermissions("system:notice:remove")
@Log(title = "通知公告", action = BusinessType.DELETE)
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -51,7 +51,7 @@ public class PostController extends BaseController
return getDataTable(list);
}
@Log(title = "岗位管理", action = BusinessType.EXPORT)
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
@ResponseBody
@ -70,7 +70,7 @@ public class PostController extends BaseController
}
@RequiresPermissions("system:post:remove")
@Log(title = "岗位管理", action = BusinessType.DELETE)
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
@ -98,7 +98,7 @@ public class PostController extends BaseController
*
*/
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", action = BusinessType.INSERT)
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Post post)
@ -120,7 +120,7 @@ public class PostController extends BaseController
*
*/
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", action = BusinessType.UPDATE)
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(Post post)

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -53,7 +53,7 @@ public class RoleController extends BaseController
return getDataTable(list);
}
@Log(title = "角色管理", action = BusinessType.EXPORT)
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:role:export")
@PostMapping("/export")
@ResponseBody
@ -84,7 +84,7 @@ public class RoleController extends BaseController
*
*/
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", action = BusinessType.INSERT)
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
@ -108,7 +108,7 @@ public class RoleController extends BaseController
*
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", action = BusinessType.UPDATE)
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
@ -118,7 +118,7 @@ public class RoleController extends BaseController
}
@RequiresPermissions("system:role:remove")
@Log(title = "角色管理", action = BusinessType.DELETE)
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)

@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.service.DictService;
@ -75,7 +75,7 @@ public class ProfileController extends BaseController
return prefix + "/resetPwd";
}
@Log(title = "重置密码", action = BusinessType.UPDATE)
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwd(User user)
@ -112,7 +112,7 @@ public class ProfileController extends BaseController
/**
*
*/
@Log(title = "个人信息", action = BusinessType.UPDATE)
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/update")
@ResponseBody
public AjaxResult update(User user)
@ -128,7 +128,7 @@ public class ProfileController extends BaseController
/**
*
*/
@Log(title = "个人信息", action = BusinessType.UPDATE)
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/updateAvatar")
@ResponseBody
public AjaxResult updateAvatar(User user, @RequestParam("avatarfile") MultipartFile file)

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
@ -60,7 +60,7 @@ public class UserController extends BaseController
return getDataTable(list);
}
@Log(title = "用户管理", action = BusinessType.EXPORT)
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export")
@PostMapping("/export")
@ResponseBody
@ -93,7 +93,7 @@ public class UserController extends BaseController
*
*/
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", action = BusinessType.INSERT)
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
@ -122,7 +122,7 @@ public class UserController extends BaseController
*
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", action = BusinessType.UPDATE)
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
@ -136,7 +136,7 @@ public class UserController extends BaseController
}
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", action = BusinessType.UPDATE)
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@GetMapping("/resetPwd/{userId}")
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
{
@ -145,7 +145,7 @@ public class UserController extends BaseController
}
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", action = BusinessType.UPDATE)
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwd(User user)
@ -154,7 +154,7 @@ public class UserController extends BaseController
}
@RequiresPermissions("system:user:remove")
@Log(title = "用户管理", action = BusinessType.DELETE)
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.support.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.tool.gen.domain.TableInfo;
@ -55,7 +55,7 @@ public class GenController extends BaseController
*
*/
@RequiresPermissions("tool:gen:code")
@Log(title = "代码生成", action = BusinessType.GENCODE)
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/genCode/{tableName}")
public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
{
@ -72,7 +72,7 @@ public class GenController extends BaseController
*
*/
@RequiresPermissions("tool:gen:code")
@Log(title = "代码生成", action = BusinessType.GENCODE)
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/batchGenCode")
@ResponseBody
public void batchGenCode(HttpServletResponse response, String tables) throws IOException

@ -1,18 +1,21 @@
#数据源配置
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
druid:
master: #主库
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true
username: root
password: password
#slave: #从库
# open: true
# url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true
# username: root
# password: password
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initial-size: 10
# 最大连接池数量

@ -7,10 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="OperLog" id="OperLogResult">
<id property="operId" column="oper_id" />
<result property="title" column="title" />
<result property="action" column="action" />
<result property="businessType" column="business_type" />
<result property="method" column="method" />
<result property="channel" column="channel" />
<result property="operName" column="oper_name" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
@ -23,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectOperLogVo">
select
oper_id, title, action, method, channel, oper_name, dept_name, oper_url, oper_ip,oper_location,oper_param,status,error_msg,oper_time
oper_id, title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip,oper_location,oper_param,status,error_msg,oper_time
from
sys_oper_log
</sql>
<insert id="insertOperlog" parameterType="OperLog">
insert into sys_oper_log(title, action, method, channel, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
values (#{title}, #{action}, #{method}, #{channel}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
insert into sys_oper_log(title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="OperLog" resultMap="OperLogResult">
@ -39,8 +39,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="action != null and action != ''">
AND action = #{action}
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')

@ -8,7 +8,7 @@
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-2 control-label">操作模块:</label>
<div class="form-control-static" th:text="${operLog.title} + ' / ' + ${@dict.getLabel('sys_oper_type',operLog.action)}">
<div class="form-control-static" th:text="${operLog.title} + ' / ' + ${@dict.getLabel('sys_oper_type',operLog.businessType)}">
</div>
</div>
<div class="form-group">
@ -33,10 +33,10 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label">状态:</label>
<div class="form-control-static" th:class="${operLog.status == '0' ? 'label label-primary' : 'label label-danger'}" th:text="${operLog.status == '0' ? '正常' : '异常'}">
<div class="form-control-static" th:class="${operLog.status == 0 ? 'label label-primary' : 'label label-danger'}" th:text="${operLog.status == 0 ? '正常' : '异常'}">
</div>
</div>
<div class="form-group" th:style="'display:' + ${operLog.status == '0' ? 'none' : 'block'}">
<div class="form-group" th:style="'display:' + ${operLog.status == 0 ? 'none' : 'block'}">
<label class="col-sm-2 control-label">异常信息:</label>
<div class="form-control-static" th:text="${operLog.errorMsg}">
</div>

@ -18,7 +18,7 @@
<label>操作人员: </label><input type="text" name="operName"/>
</li>
<li>
<label>操作类型: </label><select name="action" th:with="type=${@dict.getType('sys_oper_type')}">
<label>操作类型: </label><select name="businessType" th:with="type=${@dict.getType('sys_oper_type')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
@ -77,7 +77,7 @@
title: '系统模块'
},
{
field: 'action',
field: 'businessType',
title: '操作类型',
align: 'center',
formatter: function(value, row, index) {

Loading…
Cancel
Save