-
@CreateDate: 2018/12/09 12:34:56
-
@Version 1.0
*/
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MapperMonitor {
String value() default “”;
}
3、Mapper层代码
/**
-
@Description:业务Mapper接口
-
@Author:zhangzhixiang
-
@Date:2018/09/08 19:56:31
*/
public interface BusinessDAO {
/**
-
根据条件查询业务数据
-
@param businessBO
-
@return List
-
@author zhangzhixiang
-
@date 2018/09/29 11:49:56
*/
@MapperMonitor
List selectByCondition(BusinessDO businessDO) throws Exception;
}
4、Mapper层日志监控及异常拦截
/**
-
@Description:Mapper层异常拦截器
-
@Author:zhangzhixiang
-
@CreateDate:2018/11/08 11:19:56
-
@Version:1.0
*/
@Aspect
@Component
public class MapperLogAspect {
private SimpleDateFormat dateFormat = new SimpleDateFormat(“yyyy-mm-dd HH:mm:ss”);
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Pointcut(“e