Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwujing committed Sep 15, 2023
1 parent 4d7694e commit 5181a95
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 2 deletions.
16 changes: 16 additions & 0 deletions springboot-prometheus-canal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.2.0</version>
</dependency>

<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>compile</defaultGoal>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<CanalDO, Long> {
}
Original file line number Diff line number Diff line change
@@ -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;



}
Original file line number Diff line number Diff line change
@@ -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<CanalDO> query(CanalDO canalDO);

}
Original file line number Diff line number Diff line change
@@ -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<CanalDO> query(CanalDO canalDO) {
return canalRepository.findAll();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring.port = 8787
server.port= 8787
spring.application.name=springboot-prometheus-canal
# /health端点 暴露详细信息
management.endpoint.health.show-details=always
Expand All @@ -18,6 +18,9 @@ [email protected]@
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


0 comments on commit 5181a95

Please sign in to comment.