From 5181a95316c65dbbec3456a8793f9e9c43ab124b Mon Sep 17 00:00:00 2001
From: pancm <1060589146@qq.com>
Date: Fri, 15 Sep 2023 18:02:06 +0800
Subject: [PATCH] update
---
springboot-prometheus-canal/pom.xml | 16 +++++++++
.../java/com/pancm/dao/CanalRepository.java | 9 +++++
.../main/java/com/pancm/domain/CanalDO.java | 36 +++++++++++++++++++
.../java/com/pancm/service/ICanalService.java | 21 +++++++++++
.../pancm/service/impl/CanalServiceImpl.java | 34 ++++++++++++++++++
.../src/main/resources/application.properties | 7 ++--
6 files changed, 121 insertions(+), 2 deletions(-)
create mode 100644 springboot-prometheus-canal/src/main/java/com/pancm/dao/CanalRepository.java
create mode 100644 springboot-prometheus-canal/src/main/java/com/pancm/domain/CanalDO.java
create mode 100644 springboot-prometheus-canal/src/main/java/com/pancm/service/ICanalService.java
create mode 100644 springboot-prometheus-canal/src/main/java/com/pancm/service/impl/CanalServiceImpl.java
diff --git a/springboot-prometheus-canal/pom.xml b/springboot-prometheus-canal/pom.xml
index 3a6b9ce..43b3418 100644
--- a/springboot-prometheus-canal/pom.xml
+++ b/springboot-prometheus-canal/pom.xml
@@ -65,6 +65,22 @@
lombok
1.16.18
+
+ com.baomidou
+ mybatis-plus-extension
+ 3.2.0
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.2.0
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
compile
diff --git a/springboot-prometheus-canal/src/main/java/com/pancm/dao/CanalRepository.java b/springboot-prometheus-canal/src/main/java/com/pancm/dao/CanalRepository.java
new file mode 100644
index 0000000..9956fb1
--- /dev/null
+++ b/springboot-prometheus-canal/src/main/java/com/pancm/dao/CanalRepository.java
@@ -0,0 +1,9 @@
+package com.pancm.dao;
+
+import com.pancm.domain.CanalDO;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CanalRepository extends JpaRepository {
+}
\ No newline at end of file
diff --git a/springboot-prometheus-canal/src/main/java/com/pancm/domain/CanalDO.java b/springboot-prometheus-canal/src/main/java/com/pancm/domain/CanalDO.java
new file mode 100644
index 0000000..5296fa7
--- /dev/null
+++ b/springboot-prometheus-canal/src/main/java/com/pancm/domain/CanalDO.java
@@ -0,0 +1,36 @@
+package com.pancm.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.sql.Date;
+
+/**
+ * @author pancm
+ * @Title: springBoot-study
+ * @Description:
+ * @Version:1.0.0
+ * @Since:jdk1.8
+ * @date 2023/9/15
+ */
+@Data
+@Entity
+@Table(name = "business_monitoring_original_data")
+public class CanalDO {
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
+ private Date createTime;
+ private Date updateTime;
+ private String binlogName;
+ private String dbName;
+ private String tableName;
+ private String event_type;
+ private String keyName;
+ private String keyValue;
+ private String timeIndex;
+ private String gatherTime;
+
+
+
+}
diff --git a/springboot-prometheus-canal/src/main/java/com/pancm/service/ICanalService.java b/springboot-prometheus-canal/src/main/java/com/pancm/service/ICanalService.java
new file mode 100644
index 0000000..26def3d
--- /dev/null
+++ b/springboot-prometheus-canal/src/main/java/com/pancm/service/ICanalService.java
@@ -0,0 +1,21 @@
+package com.pancm.service;
+
+import com.pancm.domain.CanalDO;
+
+import java.util.List;
+
+/**
+ * @author pancm
+ * @Title: springBoot-study
+ * @Description:
+ * @Version:1.0.0
+ * @Since:jdk1.8
+ * @date 2023/8/25
+ */
+public interface ICanalService {
+
+ CanalDO save(CanalDO canalDO);
+
+ List query(CanalDO canalDO);
+
+}
diff --git a/springboot-prometheus-canal/src/main/java/com/pancm/service/impl/CanalServiceImpl.java b/springboot-prometheus-canal/src/main/java/com/pancm/service/impl/CanalServiceImpl.java
new file mode 100644
index 0000000..fac6fad
--- /dev/null
+++ b/springboot-prometheus-canal/src/main/java/com/pancm/service/impl/CanalServiceImpl.java
@@ -0,0 +1,34 @@
+package com.pancm.service.impl;
+
+import com.pancm.dao.CanalRepository;
+import com.pancm.domain.CanalDO;
+import com.pancm.service.ICanalService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author pancm
+ * @Title: springBoot-study
+ * @Description:
+ * @Version:1.0.0
+ * @Since:jdk1.8
+ * @date 2023/9/15
+ */
+@Service
+public class CanalServiceImpl implements ICanalService {
+
+ @Resource
+ private CanalRepository canalRepository;
+
+ @Override
+ public CanalDO save(CanalDO canalDO) {
+ return canalRepository.save(canalDO);
+ }
+
+ @Override
+ public List query(CanalDO canalDO) {
+ return canalRepository.findAll();
+ }
+}
diff --git a/springboot-prometheus-canal/src/main/resources/application.properties b/springboot-prometheus-canal/src/main/resources/application.properties
index ab9a9fe..9ce957c 100644
--- a/springboot-prometheus-canal/src/main/resources/application.properties
+++ b/springboot-prometheus-canal/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-spring.port = 8787
+server.port= 8787
spring.application.name=springboot-prometheus-canal
# /health¶Ëµã ±©Â¶ÏêϸÐÅÏ¢
management.endpoint.health.show-details=always
@@ -18,6 +18,9 @@ info.app.name=@project.name@
info.app.description=@project.description@
info.app.version=@project.version@
-
+spring.datasource.url=jdbc:mysql://localhost:3306/canal?useUnicode=true&characterEncoding=utf8
+spring.datasource.username=root
+spring.datasource.password=123456
+spring.datasource.driverClassName=com.mysql.jdbc.Driver