'修改日志管理的operType和fruit字段'
This commit is contained in:
parent
90f8a73100
commit
93a4b26947
|
|
@ -69,7 +69,7 @@ public class SysLogsVo {
|
||||||
*操作类型
|
*操作类型
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "操作类型 增删改查 登陆 登出")
|
@ApiModelProperty(value = "操作类型 增删改查 登陆 登出")
|
||||||
private String operaType;
|
private String operType;
|
||||||
/**
|
/**
|
||||||
* 操作方法
|
* 操作方法
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录日志方法
|
* 记录日志方法
|
||||||
*
|
*
|
||||||
* @author bonus
|
* @author bonus
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
|
@ -30,7 +30,7 @@ public class SysRecordLogService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录登录信息
|
* 记录登录信息
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param status 状态
|
* @param status 状态
|
||||||
* @param message 消息内容
|
* @param message 消息内容
|
||||||
|
|
@ -75,7 +75,7 @@ public class SysRecordLogService
|
||||||
sysLogsVo.setMethod("login()");
|
sysLogsVo.setMethod("login()");
|
||||||
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
||||||
sysLogsVo.setOperateDetail("用户登陆系统");
|
sysLogsVo.setOperateDetail("用户登陆系统");
|
||||||
sysLogsVo.setOperaType("登陆");
|
sysLogsVo.setOperType("登陆");
|
||||||
sysLogsVo.setOperaUri("/login");
|
sysLogsVo.setOperaUri("/login");
|
||||||
sysLogsVo.setLogType(0);
|
sysLogsVo.setLogType(0);
|
||||||
if (StringUtils.isNotEmpty(result)){
|
if (StringUtils.isNotEmpty(result)){
|
||||||
|
|
@ -110,7 +110,7 @@ public class SysRecordLogService
|
||||||
SysLogsVo sysLogsVo = new SysLogsVo();
|
SysLogsVo sysLogsVo = new SysLogsVo();
|
||||||
sysLogsVo.setGrade("高");
|
sysLogsVo.setGrade("高");
|
||||||
String uuid= UUID.randomUUID().toString().replace("-","").toUpperCase();
|
String uuid= UUID.randomUUID().toString().replace("-","").toUpperCase();
|
||||||
sysLogsVo.setOperaType("登陆");
|
sysLogsVo.setOperType("登陆");
|
||||||
sysLogsVo.setOperaUri("/login");
|
sysLogsVo.setOperaUri("/login");
|
||||||
sysLogsVo.setLogType(2);
|
sysLogsVo.setLogType(2);
|
||||||
sysLogsVo.setResult("成功");
|
sysLogsVo.setResult("成功");
|
||||||
|
|
@ -161,7 +161,7 @@ public class SysRecordLogService
|
||||||
sysLogsVo.setMethod("logout()");
|
sysLogsVo.setMethod("logout()");
|
||||||
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
||||||
sysLogsVo.setOperateDetail("用户退出登录");
|
sysLogsVo.setOperateDetail("用户退出登录");
|
||||||
sysLogsVo.setOperaType("登出");
|
sysLogsVo.setOperType("登出");
|
||||||
sysLogsVo.setOperaUri("/logout");
|
sysLogsVo.setOperaUri("/logout");
|
||||||
if (StringUtils.isNotEmpty(result)){
|
if (StringUtils.isNotEmpty(result)){
|
||||||
sysLogsVo.setResult(result);
|
sysLogsVo.setResult(result);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录处理
|
* 操作日志记录处理
|
||||||
*
|
*
|
||||||
* @author bonus
|
* @author bonus
|
||||||
*/
|
*/
|
||||||
@Aspect
|
@Aspect
|
||||||
|
|
@ -110,7 +110,7 @@ public class LogAspect
|
||||||
}
|
}
|
||||||
//操作模块及路径
|
//操作模块及路径
|
||||||
sysLogsVo.setModel(controllerLog.module());
|
sysLogsVo.setModel(controllerLog.module());
|
||||||
sysLogsVo.setOperaType(controllerLog.businessType());
|
sysLogsVo.setOperType(controllerLog.businessType());
|
||||||
sysLogsVo.setLogType(controllerLog.logType());
|
sysLogsVo.setLogType(controllerLog.logType());
|
||||||
if(StringUtils.isEmpty(controllerLog.details())){
|
if(StringUtils.isEmpty(controllerLog.details())){
|
||||||
sysLogsVo.setOperateDetail("进行了数据的"+controllerLog.businessType());
|
sysLogsVo.setOperateDetail("进行了数据的"+controllerLog.businessType());
|
||||||
|
|
@ -157,7 +157,7 @@ public class LogAspect
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取注解中对方法的描述信息 用于Controller层注解
|
* 获取注解中对方法的描述信息 用于Controller层注解
|
||||||
*
|
*
|
||||||
* @param log 日志
|
* @param log 日志
|
||||||
* @param sysLogsVo 操作日志
|
* @param sysLogsVo 操作日志
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
@ -182,7 +182,7 @@ public class LogAspect
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取请求的参数,放到log中
|
* 获取请求的参数,放到log中
|
||||||
*
|
*
|
||||||
* @param operLog 操作日志
|
* @param operLog 操作日志
|
||||||
* @throws Exception 异常
|
* @throws Exception 异常
|
||||||
*/
|
*/
|
||||||
|
|
@ -237,7 +237,7 @@ public class LogAspect
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否需要过滤的对象。
|
* 判断是否需要过滤的对象。
|
||||||
*
|
*
|
||||||
* @param o 对象信息。
|
* @param o 对象信息。
|
||||||
* @return 如果是需要过滤的对象,则返回true;否则返回false。
|
* @return 如果是需要过滤的对象,则返回true;否则返回false。
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public class SysLogServiceImpl implements ISysLogService {
|
||||||
sysLog.setGrade("高");
|
sysLog.setGrade("高");
|
||||||
sysLog.setErrType("越权访问");
|
sysLog.setErrType("越权访问");
|
||||||
sysLog.setFailureReason("页面未授权");
|
sysLog.setFailureReason("页面未授权");
|
||||||
sysLog.setOperaType("查询");
|
sysLog.setOperType("查询");
|
||||||
sysLog.setOperateDetail("查看页面");
|
sysLog.setOperateDetail("查看页面");
|
||||||
String module=mapper.getModuleName(sysLog);
|
String module=mapper.getModuleName(sysLog);
|
||||||
sysLog.setLogType(2);
|
sysLog.setLogType(2);
|
||||||
|
|
@ -213,7 +213,7 @@ public class SysLogServiceImpl implements ISysLogService {
|
||||||
List<Integer> nums=new ArrayList<>();
|
List<Integer> nums=new ArrayList<>();
|
||||||
List<SysLogsVo> list=mapper.getLogsList(dto);
|
List<SysLogsVo> list=mapper.getLogsList(dto);
|
||||||
list.forEach(vo->{
|
list.forEach(vo->{
|
||||||
typeList.add(vo.getOperaType());
|
typeList.add(vo.getOperType());
|
||||||
nums.add(vo.getNum());
|
nums.add(vo.getNum());
|
||||||
});
|
});
|
||||||
map.put("list",typeList);
|
map.put("list",typeList);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
</update>
|
</update>
|
||||||
<select id="getSystemLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
<select id="getSystemLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
||||||
SELECT log_id,opera_user_name operaUserName,ip,user_id userId,model,
|
SELECT log_id,opera_user_name operaUserName,ip,user_id userId,model,
|
||||||
oper_time operTime,method,params,result fruit,
|
oper_time operTime,method,params,
|
||||||
operate_detail operateDetail,oper_type operType,oper_uri operUri,
|
operate_detail operateDetail,oper_type operType,oper_uri operUri,
|
||||||
log_type logType,failure_reason failureReason,grade,
|
log_type logType,failure_reason failureReason,grade,
|
||||||
err_type errType,method_type methodType,times
|
err_type errType,method_type methodType,times
|
||||||
|
|
@ -88,9 +88,7 @@
|
||||||
<if test="params!=null and params!=''">
|
<if test="params!=null and params!=''">
|
||||||
and params LIKE concat('%',#{params},'%')
|
and params LIKE concat('%',#{params},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="fruit!=null and fruit!=''">
|
|
||||||
and result =#{fruit}
|
|
||||||
</if>
|
|
||||||
<if test="errType!=null and errType!=''">
|
<if test="errType!=null and errType!=''">
|
||||||
and err_type=#{errType}
|
and err_type=#{errType}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -172,7 +170,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
||||||
select count(1) num,result fruit
|
select count(1) num
|
||||||
from sys_logs
|
from sys_logs
|
||||||
where oper_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime},' 23:59:59')
|
where oper_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime},' 23:59:59')
|
||||||
GROUP BY result
|
GROUP BY result
|
||||||
|
|
@ -206,4 +204,4 @@
|
||||||
where log_type=#{logType}
|
where log_type=#{logType}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time, cost_time
|
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time, cost_time
|
||||||
from sys_oper_log
|
from sys_oper_log
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insertOperlog" parameterType="SysOperLog">
|
<insert id="insertOperlog" parameterType="SysOperLog">
|
||||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
||||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
||||||
|
|
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)values (
|
)values (
|
||||||
#{logId},#{operaUserName},#{ip},#{userId},
|
#{logId},#{operaUserName},#{ip},#{userId},
|
||||||
#{model},#{operaTime},#{method},#{params},
|
#{model},#{operaTime},#{method},#{params},
|
||||||
#{operateDetail},#{operaType},#{operaUri},
|
#{operateDetail},#{operType},#{operaUri},
|
||||||
#{logType},#{result},#{times},
|
#{logType},#{result},#{times},
|
||||||
#{failureReason},#{grade},#{errType},
|
#{failureReason},#{grade},#{errType},
|
||||||
#{methodType},#{title},#{resultData}
|
#{methodType},#{title},#{resultData}
|
||||||
|
|
@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND business_type in
|
AND business_type in
|
||||||
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
||||||
#{businessType}
|
#{businessType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
AND status = #{status}
|
AND status = #{status}
|
||||||
|
|
@ -82,14 +82,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
order by oper_id desc
|
order by oper_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteOperLogByIds" parameterType="Long">
|
<delete id="deleteOperLogByIds" parameterType="Long">
|
||||||
delete from sys_oper_log where oper_id in
|
delete from sys_oper_log where oper_id in
|
||||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||||
#{operId}
|
#{operId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
|
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
|
||||||
<include refid="selectOperLogVo"/>
|
<include refid="selectOperLogVo"/>
|
||||||
where oper_id = #{operId}
|
where oper_id = #{operId}
|
||||||
|
|
@ -109,4 +109,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
truncate table sys_oper_log
|
truncate table sys_oper_log
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue