feat(nifilog): 添加 2025 年 4月 30 日的日志事件和属性表
- 新增 LoggingEvent20250430 和 LoggingEventProperty20250430 两个实体类 - 实现了对应的 DAO 和 Service 接口及其实现类 - 添加了分页查询、批量插入等方法
This commit is contained in:
parent
d7413fb99f
commit
a0900b1cee
|
@ -0,0 +1,23 @@
|
|||
package com.hzya.frame.nifilog.dao;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.page.PageAttribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* NiFi 日志事件表,按天拆分(logging_event_20250430: table)表数据库访问层
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:37:43
|
||||
*/
|
||||
public interface ILoggingEvent20250430Dao extends IBaseDao<LoggingEvent20250430Entity, String> {
|
||||
/**
|
||||
* 根据指定的处理器id分页查询日志
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
PageInfo<LoggingEvent20250430Entity> queryLoggingEventByProcessorId(LoggingEvent20250430Entity loggingEvent20250430Entity) throws Exception;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.hzya.frame.nifilog.dao;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* NiFi 日志MDC属性表,按天拆分(logging_event_property_20250430: table)表数据库访问层
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:38:36
|
||||
*/
|
||||
public interface ILoggingEventProperty20250430Dao extends IBaseDao<LoggingEventProperty20250430Entity, String> {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.nifilog.dao.impl;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
|
||||
import com.hzya.frame.nifilog.dao.ILoggingEvent20250430Dao;
|
||||
import com.hzya.frame.page.PageHelper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* NiFi 日志事件表,按天拆分(LoggingEvent20250430)表数据库访问层
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:37:49
|
||||
*/
|
||||
@Repository(value = "LoggingEvent20250430DaoImpl")
|
||||
public class LoggingEvent20250430DaoImpl extends MybatisGenericDao<LoggingEvent20250430Entity, String> implements ILoggingEvent20250430Dao {
|
||||
@Override
|
||||
public PageInfo<LoggingEvent20250430Entity> queryLoggingEventByProcessorId(LoggingEvent20250430Entity loggingEvent20250430Entity) throws Exception {
|
||||
PageHelper.startPage(loggingEvent20250430Entity.getPageNum(), loggingEvent20250430Entity.getPageSize());
|
||||
List<LoggingEvent20250430Entity> loggingEvent20250430EntityList = query("com.hzya.frame.nifilog.dao.impl.LoggingEvent20250430DaoImpl.selectLoggingEvents", loggingEvent20250430Entity);
|
||||
return new PageInfo(loggingEvent20250430EntityList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.nifilog.dao.impl;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity;
|
||||
import com.hzya.frame.nifilog.dao.ILoggingEventProperty20250430Dao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
|
||||
/**
|
||||
* NiFi 日志MDC属性表,按天拆分(LoggingEventProperty20250430)表数据库访问层
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:38:36
|
||||
*/
|
||||
@Repository(value = "LoggingEventProperty20250430DaoImpl")
|
||||
public class LoggingEventProperty20250430DaoImpl extends MybatisGenericDao<LoggingEventProperty20250430Entity, String> implements ILoggingEventProperty20250430Dao {
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.hzya.frame.nifilog.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* NiFi 日志事件表,按天拆分(LoggingEvent20250430)实体类
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:37:50
|
||||
*/
|
||||
@Data
|
||||
public class LoggingEvent20250430Entity extends BaseEntity {
|
||||
/**
|
||||
* 日志时间戳(毫秒)
|
||||
*/
|
||||
private Long timestmp;
|
||||
/**
|
||||
* 格式化后的日志消息
|
||||
*/
|
||||
private String formattedMessage;
|
||||
/**
|
||||
* 日志记录器的名称
|
||||
*/
|
||||
private String loggerName;
|
||||
/**
|
||||
* 日志级别(如INFO、ERROR)
|
||||
*/
|
||||
private String levelString;
|
||||
/**
|
||||
* 线程名称
|
||||
*/
|
||||
private String threadName;
|
||||
/**
|
||||
* 引用标志(预留字段,当前固定为0)
|
||||
*/
|
||||
private Integer referenceFlag;
|
||||
/**
|
||||
* 日志参数0
|
||||
*/
|
||||
private String arg0;
|
||||
/**
|
||||
* 日志参数1
|
||||
*/
|
||||
private String arg1;
|
||||
/**
|
||||
* 日志参数2
|
||||
*/
|
||||
private String arg2;
|
||||
/**
|
||||
* 日志参数3
|
||||
*/
|
||||
private String arg3;
|
||||
/**
|
||||
* 调用者的文件名
|
||||
*/
|
||||
private String callerFilename;
|
||||
/**
|
||||
* 调用者的类名
|
||||
*/
|
||||
private String callerClass;
|
||||
/**
|
||||
* 调用者的方法名
|
||||
*/
|
||||
private String callerMethod;
|
||||
/**
|
||||
* 调用者的行号
|
||||
*/
|
||||
private String callerLine;
|
||||
/**
|
||||
* 事件ID,主键
|
||||
*/
|
||||
private Long eventId;
|
||||
|
||||
/**
|
||||
* 格式化的年月日
|
||||
*/
|
||||
private String formattedTime;
|
||||
|
||||
/**
|
||||
* 日志参数0列表
|
||||
*/
|
||||
private List<String> arg0List;
|
||||
|
||||
/**
|
||||
* 日期参数列表,250520
|
||||
*/
|
||||
private List<String> logDateList;
|
||||
}
|
|
@ -0,0 +1,313 @@
|
|||
<?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.hzya.frame.nifilog.dao.impl.LoggingEvent20250430DaoImpl">
|
||||
|
||||
<resultMap id="get-LoggingEvent20250430Entity-result" type="com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" >
|
||||
<result property="timestmp" column="timestmp" jdbcType="INTEGER"/>
|
||||
<result property="formattedMessage" column="formatted_message" jdbcType="VARCHAR"/>
|
||||
<result property="loggerName" column="logger_name" jdbcType="VARCHAR"/>
|
||||
<result property="levelString" column="level_string" jdbcType="VARCHAR"/>
|
||||
<result property="threadName" column="thread_name" jdbcType="VARCHAR"/>
|
||||
<result property="referenceFlag" column="reference_flag" jdbcType="INTEGER"/>
|
||||
<result property="arg0" column="arg0" jdbcType="VARCHAR"/>
|
||||
<result property="arg1" column="arg1" jdbcType="VARCHAR"/>
|
||||
<result property="arg2" column="arg2" jdbcType="VARCHAR"/>
|
||||
<result property="arg3" column="arg3" jdbcType="VARCHAR"/>
|
||||
<result property="callerFilename" column="caller_filename" jdbcType="VARCHAR"/>
|
||||
<result property="callerClass" column="caller_class" jdbcType="VARCHAR"/>
|
||||
<result property="callerMethod" column="caller_method" jdbcType="VARCHAR"/>
|
||||
<result property="callerLine" column="caller_line" jdbcType="VARCHAR"/>
|
||||
<result property="eventId" column="event_id" jdbcType="INTEGER"/>
|
||||
<result property="formattedTime" column="formatted_time" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "LoggingEvent20250430Entity_Base_Column_List">
|
||||
timestmp
|
||||
,formatted_message
|
||||
,logger_name
|
||||
,level_string
|
||||
,thread_name
|
||||
,reference_flag
|
||||
,arg0
|
||||
,arg1
|
||||
,arg2
|
||||
,arg3
|
||||
,caller_filename
|
||||
,caller_class
|
||||
,caller_method
|
||||
,caller_line
|
||||
,event_id
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-LoggingEvent20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEvent20250430Entity_Base_Column_List" />
|
||||
from logging_event_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="timestmp != null"> and timestmp = #{timestmp} </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> and formatted_message = #{formattedMessage} </if>
|
||||
<if test="loggerName != null and loggerName != ''"> and logger_name = #{loggerName} </if>
|
||||
<if test="levelString != null and levelString != ''"> and level_string = #{levelString} </if>
|
||||
<if test="threadName != null and threadName != ''"> and thread_name = #{threadName} </if>
|
||||
<if test="referenceFlag != null"> and reference_flag = #{referenceFlag} </if>
|
||||
<if test="arg0 != null and arg0 != ''"> and arg0 = #{arg0} </if>
|
||||
<if test="arg1 != null and arg1 != ''"> and arg1 = #{arg1} </if>
|
||||
<if test="arg2 != null and arg2 != ''"> and arg2 = #{arg2} </if>
|
||||
<if test="arg3 != null and arg3 != ''"> and arg3 = #{arg3} </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> and caller_filename = #{callerFilename} </if>
|
||||
<if test="callerClass != null and callerClass != ''"> and caller_class = #{callerClass} </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> and caller_method = #{callerMethod} </if>
|
||||
<if test="callerLine != null and callerLine != ''"> and caller_line = #{callerLine} </if>
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity">
|
||||
select count(1) from logging_event_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="timestmp != null"> and timestmp = #{timestmp} </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> and formatted_message = #{formattedMessage} </if>
|
||||
<if test="loggerName != null and loggerName != ''"> and logger_name = #{loggerName} </if>
|
||||
<if test="levelString != null and levelString != ''"> and level_string = #{levelString} </if>
|
||||
<if test="threadName != null and threadName != ''"> and thread_name = #{threadName} </if>
|
||||
<if test="referenceFlag != null"> and reference_flag = #{referenceFlag} </if>
|
||||
<if test="arg0 != null and arg0 != ''"> and arg0 = #{arg0} </if>
|
||||
<if test="arg1 != null and arg1 != ''"> and arg1 = #{arg1} </if>
|
||||
<if test="arg2 != null and arg2 != ''"> and arg2 = #{arg2} </if>
|
||||
<if test="arg3 != null and arg3 != ''"> and arg3 = #{arg3} </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> and caller_filename = #{callerFilename} </if>
|
||||
<if test="callerClass != null and callerClass != ''"> and caller_class = #{callerClass} </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> and caller_method = #{callerMethod} </if>
|
||||
<if test="callerLine != null and callerLine != ''"> and caller_line = #{callerLine} </if>
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-LoggingEvent20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEvent20250430Entity_Base_Column_List" />
|
||||
from logging_event_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="timestmp != null"> and timestmp like concat('%',#{timestmp},'%') </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> and formatted_message like concat('%',#{formattedMessage},'%') </if>
|
||||
<if test="loggerName != null and loggerName != ''"> and logger_name like concat('%',#{loggerName},'%') </if>
|
||||
<if test="levelString != null and levelString != ''"> and level_string like concat('%',#{levelString},'%') </if>
|
||||
<if test="threadName != null and threadName != ''"> and thread_name like concat('%',#{threadName},'%') </if>
|
||||
<if test="referenceFlag != null"> and reference_flag like concat('%',#{referenceFlag},'%') </if>
|
||||
<if test="arg0 != null and arg0 != ''"> and arg0 like concat('%',#{arg0},'%') </if>
|
||||
<if test="arg1 != null and arg1 != ''"> and arg1 like concat('%',#{arg1},'%') </if>
|
||||
<if test="arg2 != null and arg2 != ''"> and arg2 like concat('%',#{arg2},'%') </if>
|
||||
<if test="arg3 != null and arg3 != ''"> and arg3 like concat('%',#{arg3},'%') </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> and caller_filename like concat('%',#{callerFilename},'%') </if>
|
||||
<if test="callerClass != null and callerClass != ''"> and caller_class like concat('%',#{callerClass},'%') </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> and caller_method like concat('%',#{callerMethod},'%') </if>
|
||||
<if test="callerLine != null and callerLine != ''"> and caller_line like concat('%',#{callerLine},'%') </if>
|
||||
<if test="eventId != null"> and event_id like concat('%',#{eventId},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="LoggingEvent20250430entity_list_or" resultMap="get-LoggingEvent20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEvent20250430Entity_Base_Column_List" />
|
||||
from logging_event_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="timestmp != null"> or timestmp = #{timestmp} </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> or formatted_message = #{formattedMessage} </if>
|
||||
<if test="loggerName != null and loggerName != ''"> or logger_name = #{loggerName} </if>
|
||||
<if test="levelString != null and levelString != ''"> or level_string = #{levelString} </if>
|
||||
<if test="threadName != null and threadName != ''"> or thread_name = #{threadName} </if>
|
||||
<if test="referenceFlag != null"> or reference_flag = #{referenceFlag} </if>
|
||||
<if test="arg0 != null and arg0 != ''"> or arg0 = #{arg0} </if>
|
||||
<if test="arg1 != null and arg1 != ''"> or arg1 = #{arg1} </if>
|
||||
<if test="arg2 != null and arg2 != ''"> or arg2 = #{arg2} </if>
|
||||
<if test="arg3 != null and arg3 != ''"> or arg3 = #{arg3} </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> or caller_filename = #{callerFilename} </if>
|
||||
<if test="callerClass != null and callerClass != ''"> or caller_class = #{callerClass} </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> or caller_method = #{callerMethod} </if>
|
||||
<if test="callerLine != null and callerLine != ''"> or caller_line = #{callerLine} </if>
|
||||
<if test="eventId != null"> or event_id = #{eventId} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_20250430(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="timestmp != null"> timestmp , </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> formatted_message , </if>
|
||||
<if test="loggerName != null and loggerName != ''"> logger_name , </if>
|
||||
<if test="levelString != null and levelString != ''"> level_string , </if>
|
||||
<if test="threadName != null and threadName != ''"> thread_name , </if>
|
||||
<if test="referenceFlag != null"> reference_flag , </if>
|
||||
<if test="arg0 != null and arg0 != ''"> arg0 , </if>
|
||||
<if test="arg1 != null and arg1 != ''"> arg1 , </if>
|
||||
<if test="arg2 != null and arg2 != ''"> arg2 , </if>
|
||||
<if test="arg3 != null and arg3 != ''"> arg3 , </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> caller_filename , </if>
|
||||
<if test="callerClass != null and callerClass != ''"> caller_class , </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> caller_method , </if>
|
||||
<if test="callerLine != null and callerLine != ''"> caller_line , </if>
|
||||
<if test="eventId != null"> event_id , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="timestmp != null"> #{timestmp} ,</if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> #{formattedMessage} ,</if>
|
||||
<if test="loggerName != null and loggerName != ''"> #{loggerName} ,</if>
|
||||
<if test="levelString != null and levelString != ''"> #{levelString} ,</if>
|
||||
<if test="threadName != null and threadName != ''"> #{threadName} ,</if>
|
||||
<if test="referenceFlag != null"> #{referenceFlag} ,</if>
|
||||
<if test="arg0 != null and arg0 != ''"> #{arg0} ,</if>
|
||||
<if test="arg1 != null and arg1 != ''"> #{arg1} ,</if>
|
||||
<if test="arg2 != null and arg2 != ''"> #{arg2} ,</if>
|
||||
<if test="arg3 != null and arg3 != ''"> #{arg3} ,</if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> #{callerFilename} ,</if>
|
||||
<if test="callerClass != null and callerClass != ''"> #{callerClass} ,</if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> #{callerMethod} ,</if>
|
||||
<if test="callerLine != null and callerLine != ''"> #{callerLine} ,</if>
|
||||
<if test="eventId != null"> #{eventId} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from logging_event_20250430 a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_20250430(timestmp, formatted_message, logger_name, level_string, thread_name, reference_flag, arg0, arg1, arg2, arg3, caller_filename, caller_class, caller_method, caller_line, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.timestmp},#{entity.formattedMessage},#{entity.loggerName},#{entity.levelString},#{entity.threadName},#{entity.referenceFlag},#{entity.arg0},#{entity.arg1},#{entity.arg2},#{entity.arg3},#{entity.callerFilename},#{entity.callerClass},#{entity.callerMethod},#{entity.callerLine}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_20250430(timestmp, formatted_message, logger_name, level_string, thread_name, reference_flag, arg0, arg1, arg2, arg3, caller_filename, caller_class, caller_method, caller_line)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.timestmp},#{entity.formattedMessage},#{entity.loggerName},#{entity.levelString},#{entity.threadName},#{entity.referenceFlag},#{entity.arg0},#{entity.arg1},#{entity.arg2},#{entity.arg3},#{entity.callerFilename},#{entity.callerClass},#{entity.callerMethod},#{entity.callerLine})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
timestmp = values(timestmp),
|
||||
formatted_message = values(formatted_message),
|
||||
logger_name = values(logger_name),
|
||||
level_string = values(level_string),
|
||||
thread_name = values(thread_name),
|
||||
reference_flag = values(reference_flag),
|
||||
arg0 = values(arg0),
|
||||
arg1 = values(arg1),
|
||||
arg2 = values(arg2),
|
||||
arg3 = values(arg3),
|
||||
caller_filename = values(caller_filename),
|
||||
caller_class = values(caller_class),
|
||||
caller_method = values(caller_method),
|
||||
caller_line = values(caller_line)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" >
|
||||
update logging_event_20250430 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="timestmp != null"> timestmp = #{timestmp},</if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> formatted_message = #{formattedMessage},</if>
|
||||
<if test="loggerName != null and loggerName != ''"> logger_name = #{loggerName},</if>
|
||||
<if test="levelString != null and levelString != ''"> level_string = #{levelString},</if>
|
||||
<if test="threadName != null and threadName != ''"> thread_name = #{threadName},</if>
|
||||
<if test="referenceFlag != null"> reference_flag = #{referenceFlag},</if>
|
||||
<if test="arg0 != null and arg0 != ''"> arg0 = #{arg0},</if>
|
||||
<if test="arg1 != null and arg1 != ''"> arg1 = #{arg1},</if>
|
||||
<if test="arg2 != null and arg2 != ''"> arg2 = #{arg2},</if>
|
||||
<if test="arg3 != null and arg3 != ''"> arg3 = #{arg3},</if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> caller_filename = #{callerFilename},</if>
|
||||
<if test="callerClass != null and callerClass != ''"> caller_class = #{callerClass},</if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> caller_method = #{callerMethod},</if>
|
||||
<if test="callerLine != null and callerLine != ''"> caller_line = #{callerLine},</if>
|
||||
</trim>
|
||||
where event_id = #{eventId}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" >
|
||||
update logging_event_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where event_id = #{eventId}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" >
|
||||
update logging_event_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="timestmp != null"> and timestmp = #{timestmp} </if>
|
||||
<if test="formattedMessage != null and formattedMessage != ''"> and formatted_message = #{formattedMessage} </if>
|
||||
<if test="loggerName != null and loggerName != ''"> and logger_name = #{loggerName} </if>
|
||||
<if test="levelString != null and levelString != ''"> and level_string = #{levelString} </if>
|
||||
<if test="threadName != null and threadName != ''"> and thread_name = #{threadName} </if>
|
||||
<if test="referenceFlag != null"> and reference_flag = #{referenceFlag} </if>
|
||||
<if test="arg0 != null and arg0 != ''"> and arg0 = #{arg0} </if>
|
||||
<if test="arg1 != null and arg1 != ''"> and arg1 = #{arg1} </if>
|
||||
<if test="arg2 != null and arg2 != ''"> and arg2 = #{arg2} </if>
|
||||
<if test="arg3 != null and arg3 != ''"> and arg3 = #{arg3} </if>
|
||||
<if test="callerFilename != null and callerFilename != ''"> and caller_filename = #{callerFilename} </if>
|
||||
<if test="callerClass != null and callerClass != ''"> and caller_class = #{callerClass} </if>
|
||||
<if test="callerMethod != null and callerMethod != ''"> and caller_method = #{callerMethod} </if>
|
||||
<if test="callerLine != null and callerLine != ''"> and caller_line = #{callerLine} </if>
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from logging_event_20250430 where event_id = #{eventId}
|
||||
</delete>
|
||||
|
||||
<select id="selectLoggingEvents" parameterType="com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity" resultMap="get-LoggingEvent20250430Entity-result">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
<foreach collection="logDateList" item="date" separator=" UNION ALL " index="index">
|
||||
SELECT
|
||||
DATE_FORMAT(FROM_UNIXTIME(le.timestmp / 1000), '%Y-%m-%d %H:%i:%s') formatted_time,
|
||||
le.timestmp,
|
||||
le.formatted_message,
|
||||
le.logger_name,
|
||||
le.level_string,
|
||||
le.thread_name,
|
||||
le.reference_flag,
|
||||
le.arg0,
|
||||
le.arg1,
|
||||
le.arg2,
|
||||
le.arg3,
|
||||
le.caller_filename,
|
||||
le.caller_class,
|
||||
le.caller_method,
|
||||
le.caller_line,
|
||||
le.event_id
|
||||
FROM
|
||||
logging_event_${date} le
|
||||
WHERE
|
||||
1=1
|
||||
<if test="arg0List != null and arg0List.size() > 0">
|
||||
AND le.arg0 IN
|
||||
<foreach collection="arg0List" item="item" open="(" separator="," close=")" index="index">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
) a
|
||||
ORDER BY a.timestmp DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
package com.hzya.frame.nifilog.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* NiFi 日志MDC属性表,按天拆分(LoggingEventProperty20250430)实体类
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:38:36
|
||||
*/
|
||||
public class LoggingEventProperty20250430Entity extends BaseEntity {
|
||||
/**
|
||||
* 关联logging_event表的事件ID
|
||||
*/
|
||||
private Long eventId;
|
||||
/**
|
||||
* MDC属性键
|
||||
*/
|
||||
private String mappedKey;
|
||||
/**
|
||||
* MDC属性值
|
||||
*/
|
||||
private String mappedValue;
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
<?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.hzya.frame.nifilog.dao.impl.LoggingEventProperty20250430DaoImpl">
|
||||
|
||||
<resultMap id="get-LoggingEventProperty20250430Entity-result" type="com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity" >
|
||||
<result property="eventId" column="event_id" jdbcType="INTEGER"/>
|
||||
<result property="mappedKey" column="mapped_key" jdbcType="VARCHAR"/>
|
||||
<result property="mappedValue" column="mapped_value" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "LoggingEventProperty20250430Entity_Base_Column_List">
|
||||
event_id
|
||||
,mapped_key
|
||||
,mapped_value
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-LoggingEventProperty20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEventProperty20250430Entity_Base_Column_List" />
|
||||
from logging_event_property_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> and mapped_key = #{mappedKey} </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> and mapped_value = #{mappedValue} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity">
|
||||
select count(1) from logging_event_property_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> and mapped_key = #{mappedKey} </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> and mapped_value = #{mappedValue} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-LoggingEventProperty20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEventProperty20250430Entity_Base_Column_List" />
|
||||
from logging_event_property_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="eventId != null"> and event_id like concat('%',#{eventId},'%') </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> and mapped_key like concat('%',#{mappedKey},'%') </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> and mapped_value like concat('%',#{mappedValue},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="LoggingEventProperty20250430entity_list_or" resultMap="get-LoggingEventProperty20250430Entity-result" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity">
|
||||
select
|
||||
<include refid="LoggingEventProperty20250430Entity_Base_Column_List" />
|
||||
from logging_event_property_20250430
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="eventId != null"> or event_id = #{eventId} </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> or mapped_key = #{mappedKey} </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> or mapped_value = #{mappedValue} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_property_20250430(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="eventId != null"> event_id , </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> mapped_key , </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> mapped_value , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="eventId != null"> #{eventId} ,</if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> #{mappedKey} ,</if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> #{mappedValue} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from logging_event_property_20250430 a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_property_20250430(mapped_value, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mappedValue}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="eventId" useGeneratedKeys="true">
|
||||
insert into logging_event_property_20250430(mapped_value)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mappedValue})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
mapped_value = values(mapped_value)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity" >
|
||||
update logging_event_property_20250430 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="mappedValue != null and mappedValue != ''"> mapped_value = #{mappedValue},</if>
|
||||
</trim>
|
||||
where event_id = #{eventId}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity" >
|
||||
update logging_event_property_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where event_id = #{eventId}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity" >
|
||||
update logging_event_property_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="eventId != null"> and event_id = #{eventId} </if>
|
||||
<if test="mappedKey != null and mappedKey != ''"> and mapped_key = #{mappedKey} </if>
|
||||
<if test="mappedValue != null and mappedValue != ''"> and mapped_value = #{mappedValue} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from logging_event_property_20250430 where event_id = #{eventId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.hzya.frame.nifilog.service;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
|
||||
/**
|
||||
* NiFi 日志事件表,按天拆分(LoggingEvent20250430)表服务接口
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:37:51
|
||||
*/
|
||||
public interface ILoggingEvent20250430Service extends IBaseService<LoggingEvent20250430Entity, String> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.hzya.frame.nifilog.service;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
|
||||
/**
|
||||
* NiFi 日志MDC属性表,按天拆分(LoggingEventProperty20250430)表服务接口
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:38:36
|
||||
*/
|
||||
public interface ILoggingEventProperty20250430Service extends IBaseService<LoggingEventProperty20250430Entity, String> {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.hzya.frame.nifilog.service.impl;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
|
||||
import com.hzya.frame.nifilog.dao.ILoggingEvent20250430Dao;
|
||||
import com.hzya.frame.nifilog.service.ILoggingEvent20250430Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
/**
|
||||
* NiFi 日志事件表,按天拆分(LoggingEvent20250430)表服务实现类
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:37:52
|
||||
*/
|
||||
@Service(value = "loggingEvent20250430Service")
|
||||
public class LoggingEvent20250430ServiceImpl extends BaseService<LoggingEvent20250430Entity, String> implements ILoggingEvent20250430Service {
|
||||
|
||||
private ILoggingEvent20250430Dao loggingEvent20250430Dao;
|
||||
|
||||
@Autowired
|
||||
public void setLoggingEvent20250430Dao(ILoggingEvent20250430Dao dao) {
|
||||
this.loggingEvent20250430Dao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.hzya.frame.nifilog.service.impl;
|
||||
|
||||
import com.hzya.frame.nifilog.entity.LoggingEventProperty20250430Entity;
|
||||
import com.hzya.frame.nifilog.dao.ILoggingEventProperty20250430Dao;
|
||||
import com.hzya.frame.nifilog.service.ILoggingEventProperty20250430Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
/**
|
||||
* NiFi 日志MDC属性表,按天拆分(LoggingEventProperty20250430)表服务实现类
|
||||
*
|
||||
* @author xiang2lin
|
||||
* @since 2025-05-20 09:38:36
|
||||
*/
|
||||
@Service(value = "loggingEventProperty20250430Service")
|
||||
public class LoggingEventProperty20250430ServiceImpl extends BaseService<LoggingEventProperty20250430Entity, String> implements ILoggingEventProperty20250430Service {
|
||||
|
||||
private ILoggingEventProperty20250430Dao loggingEventProperty20250430Dao;
|
||||
|
||||
@Autowired
|
||||
public void setLoggingEventProperty20250430Dao(ILoggingEventProperty20250430Dao dao) {
|
||||
this.loggingEventProperty20250430Dao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue