From a0900b1ceee3f81d890fc33a7ac1090bfc275dba Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Tue, 20 May 2025 16:34:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(nifilog):=20=E6=B7=BB=E5=8A=A0=202025=20?= =?UTF-8?q?=E5=B9=B4=204=E6=9C=88=2030=20=E6=97=A5=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=BA=8B=E4=BB=B6=E5=92=8C=E5=B1=9E=E6=80=A7=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 LoggingEvent20250430 和 LoggingEventProperty20250430 两个实体类 - 实现了对应的 DAO 和 Service 接口及其实现类 - 添加了分页查询、批量插入等方法 --- .../nifilog/dao/ILoggingEvent20250430Dao.java | 23 ++ .../dao/ILoggingEventProperty20250430Dao.java | 14 + .../dao/impl/LoggingEvent20250430DaoImpl.java | 26 ++ .../LoggingEventProperty20250430DaoImpl.java | 17 + .../entity/LoggingEvent20250430Entity.java | 91 +++++ .../entity/LoggingEvent20250430Entity.xml | 313 ++++++++++++++++++ .../LoggingEventProperty20250430Entity.java | 25 ++ .../LoggingEventProperty20250430Entity.xml | 140 ++++++++ .../service/ILoggingEvent20250430Service.java | 14 + .../ILoggingEventProperty20250430Service.java | 14 + .../impl/LoggingEvent20250430ServiceImpl.java | 29 ++ ...ggingEventProperty20250430ServiceImpl.java | 29 ++ 12 files changed, 735 insertions(+) create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEvent20250430Dao.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEventProperty20250430Dao.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEvent20250430DaoImpl.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEventProperty20250430DaoImpl.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.xml create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.xml create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEvent20250430Service.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEventProperty20250430Service.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEvent20250430ServiceImpl.java create mode 100644 fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEventProperty20250430ServiceImpl.java diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEvent20250430Dao.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEvent20250430Dao.java new file mode 100644 index 00000000..4d6aef2a --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEvent20250430Dao.java @@ -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 { + /** + * 根据指定的处理器id分页查询日志 + * + * @author liuyang + */ + PageInfo queryLoggingEventByProcessorId(LoggingEvent20250430Entity loggingEvent20250430Entity) throws Exception; +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEventProperty20250430Dao.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEventProperty20250430Dao.java new file mode 100644 index 00000000..757ff095 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/ILoggingEventProperty20250430Dao.java @@ -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 { + +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEvent20250430DaoImpl.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEvent20250430DaoImpl.java new file mode 100644 index 00000000..93e1b7ef --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEvent20250430DaoImpl.java @@ -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 implements ILoggingEvent20250430Dao { + @Override + public PageInfo queryLoggingEventByProcessorId(LoggingEvent20250430Entity loggingEvent20250430Entity) throws Exception { + PageHelper.startPage(loggingEvent20250430Entity.getPageNum(), loggingEvent20250430Entity.getPageSize()); + List loggingEvent20250430EntityList = query("com.hzya.frame.nifilog.dao.impl.LoggingEvent20250430DaoImpl.selectLoggingEvents", loggingEvent20250430Entity); + return new PageInfo(loggingEvent20250430EntityList); + } +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEventProperty20250430DaoImpl.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEventProperty20250430DaoImpl.java new file mode 100644 index 00000000..7f331eb1 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/dao/impl/LoggingEventProperty20250430DaoImpl.java @@ -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 implements ILoggingEventProperty20250430Dao { + +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.java new file mode 100644 index 00000000..f7fef438 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.java @@ -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 arg0List; + + /** + * 日期参数列表,250520 + */ + private List logDateList; +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.xml b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.xml new file mode 100644 index 00000000..dc835cbd --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEvent20250430Entity.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + 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 , + event_id , + sorts, + sts, + + )values( + + #{timestmp} , + #{formattedMessage} , + #{loggerName} , + #{levelString} , + #{threadName} , + #{referenceFlag} , + #{arg0} , + #{arg1} , + #{arg2} , + #{arg3} , + #{callerFilename} , + #{callerClass} , + #{callerMethod} , + #{callerLine} , + #{eventId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from logging_event_20250430 a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + 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 + + (#{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') + + + + + 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 + + (#{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}) + + 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) + + +update logging_event_20250430 set + + timestmp = #{timestmp}, + formatted_message = #{formattedMessage}, + logger_name = #{loggerName}, + level_string = #{levelString}, + thread_name = #{threadName}, + reference_flag = #{referenceFlag}, + arg0 = #{arg0}, + arg1 = #{arg1}, + arg2 = #{arg2}, + arg3 = #{arg3}, + caller_filename = #{callerFilename}, + caller_class = #{callerClass}, + caller_method = #{callerMethod}, + caller_line = #{callerLine}, + +where event_id = #{eventId} + + + +update logging_event_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where event_id = #{eventId} + + + +update logging_event_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and timestmp = #{timestmp} + and formatted_message = #{formattedMessage} + and logger_name = #{loggerName} + and level_string = #{levelString} + and thread_name = #{threadName} + and reference_flag = #{referenceFlag} + and arg0 = #{arg0} + and arg1 = #{arg1} + and arg2 = #{arg2} + and arg3 = #{arg3} + and caller_filename = #{callerFilename} + and caller_class = #{callerClass} + and caller_method = #{callerMethod} + and caller_line = #{callerLine} + and event_id = #{eventId} + and sts='Y' + + + + + delete from logging_event_20250430 where event_id = #{eventId} + + + + + \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.java new file mode 100644 index 00000000..967c9350 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.java @@ -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; +} + diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.xml b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.xml new file mode 100644 index 00000000..57857ab7 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/entity/LoggingEventProperty20250430Entity.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + event_id + ,mapped_key + ,mapped_value + + + + + + + + + + + + + + + + insert into logging_event_property_20250430( + + event_id , + mapped_key , + mapped_value , + sorts, + sts, + + )values( + + #{eventId} , + #{mappedKey} , + #{mappedValue} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from logging_event_property_20250430 a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into logging_event_property_20250430(mapped_value, sts) + values + + (#{entity.mappedValue}, 'Y') + + + + + insert into logging_event_property_20250430(mapped_value) + values + + (#{entity.mappedValue}) + + on duplicate key update + mapped_value = values(mapped_value) + + +update logging_event_property_20250430 set + + mapped_value = #{mappedValue}, + +where event_id = #{eventId} + + + +update logging_event_property_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where event_id = #{eventId} + + + +update logging_event_property_20250430 set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and event_id = #{eventId} + and mapped_key = #{mappedKey} + and mapped_value = #{mappedValue} + and sts='Y' + + + + + delete from logging_event_property_20250430 where event_id = #{eventId} + + + + diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEvent20250430Service.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEvent20250430Service.java new file mode 100644 index 00000000..783b1cc5 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEvent20250430Service.java @@ -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 { + +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEventProperty20250430Service.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEventProperty20250430Service.java new file mode 100644 index 00000000..0e538a66 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/ILoggingEventProperty20250430Service.java @@ -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 { + +} \ No newline at end of file diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEvent20250430ServiceImpl.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEvent20250430ServiceImpl.java new file mode 100644 index 00000000..862d01f5 --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEvent20250430ServiceImpl.java @@ -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 implements ILoggingEvent20250430Service { + + private ILoggingEvent20250430Dao loggingEvent20250430Dao; + + @Autowired + public void setLoggingEvent20250430Dao(ILoggingEvent20250430Dao dao) { + this.loggingEvent20250430Dao = dao; + this.dao = dao; + } +} diff --git a/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEventProperty20250430ServiceImpl.java b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEventProperty20250430ServiceImpl.java new file mode 100644 index 00000000..11032d2a --- /dev/null +++ b/fw-nifi/src/main/java/com/hzya/frame/nifilog/service/impl/LoggingEventProperty20250430ServiceImpl.java @@ -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 implements ILoggingEventProperty20250430Service { + + private ILoggingEventProperty20250430Dao loggingEventProperty20250430Dao; + + @Autowired + public void setLoggingEventProperty20250430Dao(ILoggingEventProperty20250430Dao dao) { + this.loggingEventProperty20250430Dao = dao; + this.dao = dao; + } +}