ÎļþÃû´Ó sql/ry_20220822.sql ÐÞ¸Ä |
| | |
| | | status int(1) default 0 comment 'æä½ç¶æï¼0æ£å¸¸ 1å¼å¸¸ï¼',
|
| | | error_msg varchar(2000) default '' comment 'éè¯¯æ¶æ¯',
|
| | | oper_time datetime comment 'æä½æ¶é´',
|
| | | cost_time bigint(20) default 0 comment 'æ¶èæ¶é´',
|
| | | primary key (oper_id)
|
| | | ) engine=innodb auto_increment=100 comment = 'æä½æ¥å¿è®°å½';
|
| | |
|
| | |
| | | import org.aspectj.lang.annotation.AfterReturning;
|
| | | import org.aspectj.lang.annotation.AfterThrowing;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.aspectj.lang.annotation.Before;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.core.NamedThreadLocal;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.validation.BindingResult;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
| | |
|
| | | /** æé¤ææå±æ§å段 */
|
| | | public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
|
| | |
|
| | | /** è®¡ç®æä½æ¶èæ¶é´ */
|
| | | private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
| | |
|
| | | /**
|
| | | * å¤ç请æ±åæ§è¡
|
| | | */
|
| | | @Before(value = "@annotation(controllerLog)")
|
| | | public void boBefore(JoinPoint joinPoint, Log controllerLog)
|
| | | {
|
| | | TIME_THREADLOCAL.set(System.currentTimeMillis());
|
| | | }
|
| | |
|
| | | /**
|
| | | * å¤çå®è¯·æ±åæ§è¡
|
| | |
| | | operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
| | | // å¤ç设置注解ä¸çåæ°
|
| | | getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
|
| | | // 设置æ¶èæ¶é´
|
| | | operLog.setCostTime(System.currentTimeMillis() - TIME_THREADLOCAL.get());
|
| | | // ä¿åæ°æ®åº
|
| | | AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
| | | }
|
| | |
| | | log.error("å¼å¸¸ä¿¡æ¯:{}", exp.getMessage());
|
| | | exp.printStackTrace();
|
| | | }
|
| | | finally
|
| | | {
|
| | | TIME_THREADLOCAL.remove();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @Excel(name = "æä½æ¶é´", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
| | | private Date operTime;
|
| | |
|
| | | /** æ¶èæ¶é´ */
|
| | | @Excel(name = "æ¶èæ¶é´", suffix = "毫ç§")
|
| | | private Long costTime;
|
| | |
|
| | | public Long getOperId()
|
| | | {
|
| | | return operId;
|
| | |
| | | {
|
| | | this.operTime = operTime;
|
| | | }
|
| | |
|
| | | public Long getCostTime()
|
| | | {
|
| | | return costTime;
|
| | | }
|
| | |
|
| | | public void setCostTime(Long costTime)
|
| | | {
|
| | | this.costTime = costTime;
|
| | | }
|
| | | }
|
| | |
| | | <result property="status" column="status" />
|
| | | <result property="errorMsg" column="error_msg" />
|
| | | <result property="operTime" column="oper_time" />
|
| | | <result property="costTime" column="cost_time" />
|
| | | </resultMap>
|
| | |
|
| | | <sql id="selectOperLogVo">
|
| | | select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
|
| | | select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
|
| | | from sys_oper_log
|
| | | </sql>
|
| | |
|
| | | <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_location, oper_param, json_result, status, error_msg, oper_time)
|
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
|
| | | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
| | | </insert>
|
| | |
|
| | | <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|