Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
knowledge-graph
Commits
e6351ce8
Commit
e6351ce8
authored
Feb 25, 2026
by
wujipeng
Browse files
init
parents
Pipeline
#317
failed with stages
in 0 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
e6351ce8
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
pom.xml
0 → 100644
View file @
e6351ce8
<?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>
<groupId>
com.ruzhoukj
</groupId>
<artifactId>
knowledge-graph
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<properties>
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<spring-boot.version>
2.7.6
</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.postgresql
</groupId>
<artifactId>
postgresql
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring-boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
<encoding>
UTF-8
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
${spring-boot.version}
</version>
<configuration>
<mainClass>
com.ruzhoukj.knowledgegraph.KnowledgeGraphApplication
</mainClass>
<skip>
true
</skip>
</configuration>
<executions>
<execution>
<id>
repackage
</id>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
src/main/java/com/ruzhoukj/knowledgegraph/KnowledgeGraphApplication.java
0 → 100644
View file @
e6351ce8
package
com.ruzhoukj.knowledgegraph
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
KnowledgeGraphApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
KnowledgeGraphApplication
.
class
,
args
);
}
}
src/main/java/com/ruzhoukj/knowledgegraph/controller/SqlController.java
0 → 100644
View file @
e6351ce8
package
com.ruzhoukj.knowledgegraph.controller
;
import
com.ruzhoukj.knowledgegraph.result.Response
;
import
com.ruzhoukj.knowledgegraph.service.SqlExecutionService
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/sql"
)
@Validated
public
class
SqlController
{
@Resource
private
SqlExecutionService
sqlExecutionService
;
@GetMapping
(
"/execute"
)
public
Response
<
List
<
Map
<
String
,
Object
>>>
executeQuery
(
@RequestParam
(
name
=
"sql"
)
String
sql
)
{
return
Response
.
success
(
sqlExecutionService
.
executeQuery
(
sql
));
}
}
\ No newline at end of file
src/main/java/com/ruzhoukj/knowledgegraph/result/Response.java
0 → 100644
View file @
e6351ce8
package
com.ruzhoukj.knowledgegraph.result
;
public
class
Response
<
T
>
{
private
boolean
success
;
private
String
message
;
private
T
data
;
private
Integer
total
;
public
Response
()
{
}
public
Response
(
boolean
success
,
String
message
,
T
data
)
{
this
.
success
=
success
;
this
.
message
=
message
;
this
.
data
=
data
;
}
public
static
<
T
>
Response
<
T
>
success
(
T
data
)
{
return
new
Response
<>(
true
,
"操作成功"
,
data
);
}
public
static
<
T
>
Response
<
T
>
success
(
T
data
,
int
total
)
{
Response
<
T
>
response
=
new
Response
<>(
true
,
"操作成功"
,
data
);
response
.
setTotal
(
total
);
return
response
;
}
public
static
<
T
>
Response
error
(
String
message
)
{
return
new
Response
<>(
false
,
message
,
null
);
}
// Getters and Setters
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getData
()
{
return
data
;
}
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
}
public
Integer
getTotal
()
{
return
total
;
}
public
void
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
}
}
\ No newline at end of file
src/main/java/com/ruzhoukj/knowledgegraph/service/SqlExecutionService.java
0 → 100644
View file @
e6351ce8
package
com.ruzhoukj.knowledgegraph.service
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author : wujipeng
* @date : 2026/2/25 11:26
* @Version: 1.0
* @Desc : 描述信息
*/
public
interface
SqlExecutionService
{
List
<
Map
<
String
,
Object
>>
executeQuery
(
String
sql
);
}
src/main/java/com/ruzhoukj/knowledgegraph/service/impl/SqlExecutionServiceImpl.java
0 → 100644
View file @
e6351ce8
package
com.ruzhoukj.knowledgegraph.service.impl
;
import
com.ruzhoukj.knowledgegraph.service.SqlExecutionService
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
SqlExecutionServiceImpl
implements
SqlExecutionService
{
@Resource
private
JdbcTemplate
jdbcTemplate
;
@Override
public
List
<
Map
<
String
,
Object
>>
executeQuery
(
String
sql
)
{
return
jdbcTemplate
.
queryForList
(
sql
);
}
}
\ No newline at end of file
src/main/resources/application.yml
0 → 100644
View file @
e6351ce8
server
:
port
:
8080
spring
:
datasource
:
driver-class-name
:
org.postgresql.Driver
username
:
postgres
password
:
123456
url
:
jdbc:postgresql://119.3.152.139:5432/postgres
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment