init
parent
453bb5f60e
commit
364d7d23d5
@ -1,24 +0,0 @@
|
||||
package com.supervision.config;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MinioConfig {
|
||||
|
||||
/**
|
||||
* 创建基于Java端的MinioClient
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "minio",name = "url")
|
||||
public MinioClient minioClient(MinioProperties minioProperties) {
|
||||
return MinioClient.builder().endpoint(minioProperties.getUrl())
|
||||
.credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.supervision.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "minio")
|
||||
public class MinioProperties {
|
||||
|
||||
private String url;
|
||||
|
||||
private String accessKey;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
private String bucketName;
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.supervision</groupId>
|
||||
<artifactId>KBQA</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>kbqa-graph</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>knowledge-report</name>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.supervision</groupId>
|
||||
<artifactId>kbqa-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.nebula-contrib</groupId>
|
||||
<artifactId>ngbatis</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package com.supervision;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"com.supervision.**","org.nebula"})
|
||||
public class KnowledgeGraphApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(KnowledgeGraphApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.config;
|
||||
|
||||
// Copyright (c) 2022 All project authors. All rights reserved.
|
||||
//
|
||||
// This source code is licensed under Apache 2.0 License.
|
||||
|
||||
import org.nebula.contrib.ngbatis.PkGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 主键生成样例
|
||||
*
|
||||
* @author yeweicheng
|
||||
* @since 2022-06-14 12:32
|
||||
* <br>Now is history!
|
||||
*/
|
||||
@Configuration
|
||||
public class PkGeneratorConfig {
|
||||
|
||||
@Bean
|
||||
public PkGenerator pkGenerator() {
|
||||
return new SnowflakePKGenerator();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.supervision.config;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import org.nebula.contrib.ngbatis.PkGenerator;
|
||||
|
||||
public class SnowflakePKGenerator implements PkGenerator {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public <T> T generate(String tagName, Class<T> pkType) {
|
||||
if (pkType == String.class) {
|
||||
return (T) IdUtil.getSnowflakeNextIdStr();
|
||||
}
|
||||
return (T) Long.valueOf(IdUtil.getSnowflakeNextIdStr());
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.supervision.controller;
|
||||
|
||||
import com.supervision.ngbatis.dao.ItemBranchDao;
|
||||
import com.supervision.ngbatis.domain.ItemBranch;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("test")
|
||||
@RequiredArgsConstructor
|
||||
public class TestController {
|
||||
|
||||
@Resource
|
||||
private ItemBranchDao itemBranchDao;
|
||||
|
||||
@GetMapping("hello")
|
||||
public void hello() {
|
||||
ItemBranch itemBranch = new ItemBranch();
|
||||
itemBranch.setItemName("退休");
|
||||
itemBranchDao.insert(itemBranch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.supervision.ngbatis.dao;
|
||||
|
||||
import com.supervision.ngbatis.domain.ItemBranch;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface ItemBranchDao extends NebulaDaoBasic<ItemBranch,String> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.supervision.ngbatis.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "itemBranchTag")
|
||||
public class ItemBranch {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String itemName;
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.ngbatis.dao.ItemBranchDao">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue