Compare commits

..

No commits in common. "58ff225c47576476e1696f61fefea995b0870e66" and "d7413fb99ff76f8d52011c1238cdf358cf73b87b" have entirely different histories.

28 changed files with 2 additions and 1216 deletions

View File

@ -1,59 +0,0 @@
package com.hzya.frame;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.nifilog.dao.ILoggingEvent20250430Dao;
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
import com.hzya.frame.page.PageAttribute;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestNifiLog
* @Date2025/5/20 11:53
* @FilenameTestNifiLog
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebappApplication.class})
public class TestNifiLog {
@Autowired
private ILoggingEvent20250430Dao iLoggingEvent20250430Dao;
/**
* 获取nifi token
*/
@Test
public void getAccessToken() {
try {
// PageAttribute<LoggingEvent20250430Entity> loggingEvent20250430EntityPageAttribute = iLoggingEvent20250430Dao.queryPaged();
List<String> arg0List = new ArrayList<>();
arg0List.add("UpdateAttribute[id=ad841aed-30f7-16e2-4fa0-595ab0ab9fdc]");
List<String> logDateList = new ArrayList<>();
logDateList.add("20250519");
logDateList.add("20250520");
LoggingEvent20250430Entity loggingEvent20250430Entity = new LoggingEvent20250430Entity();
loggingEvent20250430Entity.setArg0List(arg0List);
loggingEvent20250430Entity.setLogDateList(logDateList);
loggingEvent20250430Entity.setPageNum(1);
loggingEvent20250430Entity.setPageSize(100);
PageInfo<LoggingEvent20250430Entity> loggingEvent20250430EntityPageInfo = iLoggingEvent20250430Dao.queryLoggingEventByProcessorId(loggingEvent20250430Entity);
List<LoggingEvent20250430Entity> list = loggingEvent20250430EntityPageInfo.getList();
System.out.println(list.size());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -62,21 +62,6 @@ public class NifiClient {
}); });
} }
/**
* 获取原始JSON响应字符串不进行反序列化
*/
public String getRaw(String path) throws IOException {
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).get().header("Authorization", "Bearer " + accessToken.get()).build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("意外的响应码: " + response.code());
}
return response.body().string();
}
});
}
/** /**
* 执行GET请求并返回文件流供调用者处理如保存到文件或浏览器下载 * 执行GET请求并返回文件流供调用者处理如保存到文件或浏览器下载
*/ */

View File

@ -1,22 +0,0 @@
package com.hzya.frame.nifiapi.model.basemodel;
import lombok.Data;
/**
* 基类封转创建应用操作公共的字段
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class JoinBashModel {
private String appProcessGroupId;
private String parentProcessGroupId;
private String copyTargetProcessGroupId;
// private String copyTargetParentProcessGroupId;
}

View File

@ -1,16 +0,0 @@
package com.hzya.frame.nifiapi.model.joincreatemysqlapp;
import com.hzya.frame.nifiapi.model.basemodel.JoinBashModel;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class CreateMysqlApp extends JoinBashModel {
}

View File

@ -1,16 +0,0 @@
package com.hzya.frame.nifiapi.model.joincreateoracleapp;
import com.hzya.frame.nifiapi.model.basemodel.JoinBashModel;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class CreateOracleApp extends JoinBashModel {
}

View File

@ -5,5 +5,4 @@ import lombok.Data;
@Data @Data
public class Component7 { public class Component7 {
private String name; private String name;
private Position7 position;
} }

View File

@ -1,25 +0,0 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joinprocessgroups
* @Projectfw-nifi
* @namePosition7
* @Date2025/5/21 14:57
* @FilenamePosition7
*/
@Data
public class Position7 {
private String x;
private String y;
public Position7() {
}
public Position7(String x, String y) {
this.x = x;
this.y = y;
}
}

View File

@ -1,6 +1,5 @@
package com.hzya.frame.nifiapi.model.resultcreateprocessor; package com.hzya.frame.nifiapi.model.resultcreateprocessor;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/** /**
@ -13,5 +12,4 @@ import lombok.Data;
public class Config15 { public class Config15 {
private String schedulingPeriod; private String schedulingPeriod;
private Properties15 properties; private Properties15 properties;
private String bulletinLevel;
} }

View File

@ -12,13 +12,4 @@ import lombok.Data;
public class Position15 { public class Position15 {
private String x; private String x;
private String y; private String y;
public Position15(String x, String y) {
this.x = x;
this.y = y;
}
public Position15() {
}
} }

View File

@ -13,22 +13,4 @@ import lombok.Data;
public class Properties15 { public class Properties15 {
@JsonProperty("File Size") @JsonProperty("File Size")
private String fileSize; private String fileSize;
@JsonProperty("Log Level")
private String logLevel;
@JsonProperty("Log Payload")
private String logPayload;
@JsonProperty("attributes-to-log-regex")
private String attributesToLogRegex;
@JsonProperty("Log FlowFile Properties")
private String LogFlowFileProperties;
@JsonProperty("Output Format")
private String outputFormat;
@JsonProperty("character-set")
private String characterSet;
} }

View File

@ -17,7 +17,7 @@ public class ProcessGroupsInfoResult9 {
private String uri; private String uri;
private Position9 position; private Position9 position;
private Permissions9 permissions; private Permissions9 permissions;
// private List<String> bulletins; private List<String> bulletins;
private Component9 component; private Component9 component;
private Status9 status; private Status9 status;
private String runningCount; private String runningCount;

View File

@ -1,21 +0,0 @@
package com.hzya.frame.nifiapi.operation;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.operation
* @Projectfw-nifi
* @nameBaseNifiOperation
* @Date2025/5/21 17:50
* @FilenameBaseNifiOperation
*/
public interface BaseOperation {
/**
* 实例化某个应用对应nifi流程组id
*
* @param appProcessGroupId 需要复制的流程组id(应用id)比如Oracle应用idMysql应用id
* @param parentProcessGroupId 流程组id(应用id)的父流程组id
* @param copyTargetProcessGroupId 指定创建的流程组id
* @return 返回流程组实例化id
*/
String instantiateApp(String appProcessGroupId, String parentProcessGroupId, String copyTargetProcessGroupId) throws Exception;
}

View File

@ -1,37 +0,0 @@
package com.hzya.frame.nifiapi.operation;
import com.hzya.frame.nifiapi.model.joincreatemysqlapp.CreateMysqlApp;
import com.hzya.frame.nifiapi.model.joincreateoracleapp.CreateOracleApp;
/**
* NiFi应用实例化业务操作接口
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.operation
* @Projectfw-nifi
* @nameNifiOperation
* @Date2025/5/21 17:05
* @FilenameNifiOperation
*/
public interface NifiOperation {
/**
* Oracle应用创建并实例化
* 主要包含一系列nifi接口调用操作其他应用开发封转类以此类推
* 1.创建nifi片段
* 2.把片段实例化
* 3.修改nifi控制器
* 4.新建上下文环境参数
* 5.绑定上下文环境参数到流程组
* 6.激活当前流程组内的所有控制器服务
*
* @param createOracleApp 封装创建Oracle应用所需要的入参
*/
void createOracleApp(CreateOracleApp createOracleApp) throws Exception;
/**
* Mysql应用创建并实例化
*
* @param createMysqlApp 封装创建Mysql应用所需要的入参
*/
void createMysqlApp(CreateMysqlApp createMysqlApp) throws Exception;
}

View File

@ -1,80 +0,0 @@
package com.hzya.frame.nifiapi.operation.impl;
import com.hzya.frame.nifiapi.model.joinsnippetinstance.SnippetInstanceJoin;
import com.hzya.frame.nifiapi.model.joinsnippets.Snippet;
import com.hzya.frame.nifiapi.model.joinsnippets.SnippetsJoin;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.Flow15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.ProcessGroups15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.SnippetInstance15;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.ProcessGroupsInfoResult9;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.Revision9;
import com.hzya.frame.nifiapi.model.resultsnippets.Snippet13;
import com.hzya.frame.nifiapi.model.resultsnippets.SnippetResult13;
import com.hzya.frame.nifiapi.operation.BaseOperation;
import com.hzya.frame.nifiapi.service.NifiApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.operation.impl
* @Projectfw-nifi
* @nameBaseOperationImpl
* @Date2025/5/21 18:07
* @FilenameBaseOperationImpl
*/
@Repository(value = "BaseOperationImpl")
public class BaseOperationImpl implements BaseOperation {
@Autowired
private NifiApiService nifiApiService;
@Override
public String instantiateApp(String appProcessGroupId, String parentProcessGroupId, String copyTargetProcessGroupId) throws Exception {
String processGroups15Id = null;
try {
//1.创建流程组对应的片段得到片段id
//查询目标流程组版本
ProcessGroupsInfoResult9 processGroups = nifiApiService.getProcessGroups(appProcessGroupId);
Revision9 revision = processGroups.getRevision();
Map<String, String> processGroupsMap2 = new HashMap<>();
processGroupsMap2.put("version", revision.getVersion());//目标流程组版本号
Map<String, Map<String, String>> processGroupsMap = new HashMap<>();
processGroupsMap.put(appProcessGroupId, processGroupsMap2);//目标流程组id
Snippet snippet = new Snippet();
snippet.setParentGroupId(parentProcessGroupId);//目标流程组id的父流程组id
snippet.setProcessGroups(processGroupsMap);
SnippetsJoin snippetsJoin = new SnippetsJoin();
snippetsJoin.setSnippet(snippet);
SnippetResult13 snippets = nifiApiService.createSnippets(snippetsJoin);
Snippet13 snippet1 = snippets.getSnippet();
//2.将片段实例化到指定位置,得到实例化后的应用id
ProcessGroupsInfoResult9 processGroups2 = nifiApiService.getProcessGroups(copyTargetProcessGroupId);
Revision9 revision2 = processGroups2.getRevision();
Map<String, String> processGroupsMap3 = new HashMap<>();
processGroupsMap3.put("version", revision2.getVersion());//目标流程组版本号
Map<String, Map<String, String>> processGroupId = new HashMap<>();
processGroupId.put(copyTargetProcessGroupId, processGroupsMap3);//目标流程组id
SnippetInstanceJoin snippetInstanceJoin = new SnippetInstanceJoin();
snippetInstanceJoin.setSnippetId(snippet1.getId());
SnippetInstance15 snippetInstance = nifiApiService.createSnippetInstance(copyTargetProcessGroupId, snippetInstanceJoin);
Flow15 flow = snippetInstance.getFlow();
ProcessGroups15 processGroups15 = flow.getProcessGroups().get(0);
processGroups15Id = processGroups15.getId();
} catch (Exception e) {
throw new Exception(e);
}
return processGroups15Id;
}
}

View File

@ -1,77 +0,0 @@
package com.hzya.frame.nifiapi.operation.impl;
import com.hzya.frame.nifiapi.client.NifiClient;
import com.hzya.frame.nifiapi.model.joincreatemysqlapp.CreateMysqlApp;
import com.hzya.frame.nifiapi.model.joincreateoracleapp.CreateOracleApp;
import com.hzya.frame.nifiapi.model.joinsnippetinstance.SnippetInstanceJoin;
import com.hzya.frame.nifiapi.model.joinsnippets.Snippet;
import com.hzya.frame.nifiapi.model.joinsnippets.SnippetsJoin;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.Flow15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.ProcessGroups15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.SnippetInstance15;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.ProcessGroupsInfoResult9;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.Revision9;
import com.hzya.frame.nifiapi.model.resultsnippets.Snippet13;
import com.hzya.frame.nifiapi.model.resultsnippets.SnippetResult13;
import com.hzya.frame.nifiapi.operation.BaseOperation;
import com.hzya.frame.nifiapi.operation.NifiOperation;
import com.hzya.frame.nifiapi.service.NifiApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* NiFi 操作实现类封装通用操作
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.operation.impl
* @Projectfw-nifi
* @nameNifiOperationImpl
* @Date2025/5/21 17:06
* @FilenameNifiOperationImpl
*/
@Repository(value = "NifiOperationImpl")
public class NifiOperationImpl implements NifiOperation {
Logger logger = LoggerFactory.getLogger(NifiOperationImpl.class);
@Autowired
private NifiApiService nifiApiService;
@Autowired
private BaseOperation baseOperation;
@Override
public void createOracleApp(CreateOracleApp createOracleApp) throws Exception {
try {
//1.实例化Oracle应用
String appProcessGroupId = createOracleApp.getAppProcessGroupId();
String appProcessGroupId1 = createOracleApp.getParentProcessGroupId();
String copyTargetProcessGroupId = createOracleApp.getCopyTargetProcessGroupId();
String processId = baseOperation.instantiateApp(appProcessGroupId, appProcessGroupId1, copyTargetProcessGroupId);
logger.info("Oracle应用实例化后的流程组id:{}", processId);
//2.新增应用对应的上下文参数
} catch (Exception e) {
throw new Exception(e);
}
}
@Override
public void createMysqlApp(CreateMysqlApp createMysqlApp) throws Exception {
try {
//1.实例化Mysql应用
String appProcessGroupId = createMysqlApp.getAppProcessGroupId();
String appProcessGroupId1 = createMysqlApp.getParentProcessGroupId();
String copyTargetProcessGroupId = createMysqlApp.getCopyTargetProcessGroupId();
String processId = baseOperation.instantiateApp(appProcessGroupId, appProcessGroupId1, copyTargetProcessGroupId);
logger.info("Mysql应用实例化后的流程组id:{}", processId);
} catch (Exception e) {
throw new Exception(e);
}
}
}

View File

@ -1,8 +1,6 @@
package com.hzya.frame.nifiapi.service; package com.hzya.frame.nifiapi.service;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hzya.frame.nifiapi.client.NifiClient; import com.hzya.frame.nifiapi.client.NifiClient;
import com.hzya.frame.nifiapi.model.joinbindparametercontexts.BindParameterContextsJoin11; import com.hzya.frame.nifiapi.model.joinbindparametercontexts.BindParameterContextsJoin11;
import com.hzya.frame.nifiapi.model.joincontrollerenabled.EnOrDiControllerServices12; import com.hzya.frame.nifiapi.model.joincontrollerenabled.EnOrDiControllerServices12;
@ -11,8 +9,6 @@ import com.hzya.frame.nifiapi.model.joincreateconnections.CreateConnections18;
import com.hzya.frame.nifiapi.model.joincreatetemp.CreateTemplateJoin; import com.hzya.frame.nifiapi.model.joincreatetemp.CreateTemplateJoin;
import com.hzya.frame.nifiapi.model.joingetcontroller.ControllerService12; import com.hzya.frame.nifiapi.model.joingetcontroller.ControllerService12;
import com.hzya.frame.nifiapi.model.joinparametercontexts.ParameterContextsJoin; import com.hzya.frame.nifiapi.model.joinparametercontexts.ParameterContextsJoin;
import com.hzya.frame.nifiapi.model.joinprocessgroups.Component7;
import com.hzya.frame.nifiapi.model.joinprocessgroups.Position7;
import com.hzya.frame.nifiapi.model.joinprocessgroups.ProcessGroupsJoin; import com.hzya.frame.nifiapi.model.joinprocessgroups.ProcessGroupsJoin;
import com.hzya.frame.nifiapi.model.joinsnippetinstance.SnippetInstanceJoin; import com.hzya.frame.nifiapi.model.joinsnippetinstance.SnippetInstanceJoin;
import com.hzya.frame.nifiapi.model.joinsnippets.SnippetsJoin; import com.hzya.frame.nifiapi.model.joinsnippets.SnippetsJoin;
@ -21,9 +17,7 @@ import com.hzya.frame.nifiapi.model.joinupdateprocessor.RunStatusOrStop17;
import com.hzya.frame.nifiapi.model.nifitemplates.NifiTemplates; import com.hzya.frame.nifiapi.model.nifitemplates.NifiTemplates;
import com.hzya.frame.nifiapi.model.processgroupid.ProcessGroupsId; import com.hzya.frame.nifiapi.model.processgroupid.ProcessGroupsId;
import com.hzya.frame.nifiapi.model.processgrouproot.ProcessGroupsRoot; import com.hzya.frame.nifiapi.model.processgrouproot.ProcessGroupsRoot;
import com.hzya.frame.nifiapi.model.resultcreateprocessor.Component15;
import com.hzya.frame.nifiapi.model.resultcreateprocessor.CreateProcessorJoin15; import com.hzya.frame.nifiapi.model.resultcreateprocessor.CreateProcessorJoin15;
import com.hzya.frame.nifiapi.model.resultcreateprocessor.Position15;
import com.hzya.frame.nifiapi.model.resultcreateprocessors.CreateProcess16; import com.hzya.frame.nifiapi.model.resultcreateprocessors.CreateProcess16;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.SnippetInstance15; import com.hzya.frame.nifiapi.model.resultcreatesnippet.SnippetInstance15;
import com.hzya.frame.nifiapi.model.resultcreatetemplate.NewNifiTemplatete14; import com.hzya.frame.nifiapi.model.resultcreatetemplate.NewNifiTemplatete14;
@ -36,9 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -56,12 +47,9 @@ public class NifiApiService {
private final NifiClient client; private final NifiClient client;
private final ObjectMapper objectMapper;
@Autowired @Autowired
public NifiApiService(NifiClient client, ObjectMapper objectMapper) { public NifiApiService(NifiClient client) {
this.client = client; this.client = client;
this.objectMapper = objectMapper;
} }
/** /**
@ -131,11 +119,6 @@ public class NifiApiService {
* 创建流程组 * 创建流程组
*/ */
public ProcessgroupsResult createProcessGroups(String parentGroupId, ProcessGroupsJoin processGroupsJoin) throws Exception { public ProcessgroupsResult createProcessGroups(String parentGroupId, ProcessGroupsJoin processGroupsJoin) throws Exception {
Component7 component = processGroupsJoin.getComponent();
if (component != null && component.getPosition() == null) {
double[] doubles = calculatePosition(parentGroupId);
component.setPosition(new Position7(String.valueOf(doubles[0]), String.valueOf(doubles[1])));
}
return client.post(StrUtil.format("/process-groups/{}/process-groups", parentGroupId), processGroupsJoin, ProcessgroupsResult.class); return client.post(StrUtil.format("/process-groups/{}/process-groups", parentGroupId), processGroupsJoin, ProcessgroupsResult.class);
} }
@ -224,11 +207,6 @@ public class NifiApiService {
* 将代码片段实例化到指定位置 * 将代码片段实例化到指定位置
*/ */
public SnippetInstance15 createSnippetInstance(String groupId, SnippetInstanceJoin snippetInstanceJoin) throws Exception { public SnippetInstance15 createSnippetInstance(String groupId, SnippetInstanceJoin snippetInstanceJoin) throws Exception {
if (snippetInstanceJoin.getOriginX() == null || snippetInstanceJoin.getOriginY() == null) {
double[] doubles = calculatePosition(groupId);
snippetInstanceJoin.setOriginX(String.valueOf(doubles[0]));
snippetInstanceJoin.setOriginY(String.valueOf(doubles[1]));
}
return client.post(StrUtil.format("/process-groups/{}/snippet-instance", groupId), snippetInstanceJoin, SnippetInstance15.class); return client.post(StrUtil.format("/process-groups/{}/snippet-instance", groupId), snippetInstanceJoin, SnippetInstance15.class);
} }
@ -236,11 +214,6 @@ public class NifiApiService {
* 创建处理器nifi1.28.1版本有364个处理器并且每个入参都有差异所以创建之前可以先查询一遍处理器得到对应的参数进行修改调整 * 创建处理器nifi1.28.1版本有364个处理器并且每个入参都有差异所以创建之前可以先查询一遍处理器得到对应的参数进行修改调整
*/ */
public CreateProcess16 createProcessor(String groupId, CreateProcessorJoin15 createProcessorJoin15) throws Exception { public CreateProcess16 createProcessor(String groupId, CreateProcessorJoin15 createProcessorJoin15) throws Exception {
Component15 component = createProcessorJoin15.getComponent();
if (component != null && component.getPosition() == null) {
double[] doubles = calculatePosition(groupId);
component.setPosition(new Position15(String.valueOf(doubles[0]), String.valueOf(doubles[1])));
}
return client.post(StrUtil.format("/process-groups/{}/processors", groupId), createProcessorJoin15, CreateProcess16.class); return client.post(StrUtil.format("/process-groups/{}/processors", groupId), createProcessorJoin15, CreateProcess16.class);
} }
@ -278,58 +251,4 @@ public class NifiApiService {
public CreateConnection18 createProcessorConnections(String processGroupsId, CreateConnections18 createConnections17) throws Exception { public CreateConnection18 createProcessorConnections(String processGroupsId, CreateConnections18 createConnections17) throws Exception {
return client.post(StrUtil.format("/process-groups/{}/connections", processGroupsId), createConnections17, CreateConnection18.class); return client.post(StrUtil.format("/process-groups/{}/connections", processGroupsId), createConnections17, CreateConnection18.class);
} }
/**
* 计算新处理器或流程组的xy坐标
*
* @param parentGroupId 父流程组ID
* @return 包含X和Y坐标的数组
* @throws Exception 如果获取流程组信息失败
*/
public double[] calculatePosition(String parentGroupId) throws Exception {
String jsonString = client.getRaw(StrUtil.format("/flow/process-groups/{}", parentGroupId));
JsonNode json = objectMapper.readTree(jsonString);
//查找processGroupFlow.flow
JsonNode flow = json.path("processGroupFlow").path("flow");
List<double[]> positions = new ArrayList<>();
String[] componentTypes = {"processors", "processGroups", "funnels", "remoteProcessGroups", "inputPorts", "outputPorts", "labels"};
// 遍历所有组件类型,收集坐标
for (String type : componentTypes) {
JsonNode array = flow.path(type);
if (array.isArray()) {
for (JsonNode entity : array) {
JsonNode position = entity.path("component").path("position");
if (position.isMissingNode()) {
position = entity.path("position"); // 某些组件如端口可能直接包含 position
}
if (position.has("x") && position.has("y")) {
double x = position.get("x").asDouble();
double y = position.get("y").asDouble();
positions.add(new double[]{x, y});
}
}
}
}
// 如果没有子组件代表流程组为null返回默认坐标
if (positions.isEmpty()) {
return new double[]{100.0, 100.0};
}
// 计算新坐标基于最下方的组件向下偏移
double maxY = Double.MIN_VALUE;
double xAtMaxY = 0;
for (double[] pos : positions) {
if (pos[1] > maxY) {
maxY = pos[1];
xAtMaxY = pos[0];
}
}
double newX = xAtMaxY; // 与最下方组件保持相同X坐标
double newY = maxY + 260; // 向下偏移260像素
return new double[]{newX, newY};
}
} }

View File

@ -1,23 +0,0 @@
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;
}

View File

@ -1,14 +0,0 @@
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> {
}

View File

@ -1,26 +0,0 @@
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);
}
}

View File

@ -1,17 +0,0 @@
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 {
}

View File

@ -1,91 +0,0 @@
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;
/**
* 日志级别如INFOERROR
*/
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;
}

View File

@ -1,313 +0,0 @@
<?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>

View File

@ -1,25 +0,0 @@
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;
}

View File

@ -1,140 +0,0 @@
<?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>

View File

@ -1,14 +0,0 @@
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> {
}

View File

@ -1,14 +0,0 @@
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> {
}

View File

@ -1,29 +0,0 @@
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;
}
}

View File

@ -1,29 +0,0 @@
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;
}
}