Kaynağa Gözat

first commit

longwangshan11 5 ay önce
işleme
148d99540f

+ 120 - 0
pom.xml

@@ -0,0 +1,120 @@
+<?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>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>3.2.5</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>com.ecnu</groupId>
+	<artifactId>smart-port-platform</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>smart-port-platform</name>
+	<description>smart port platform</description>
+	<properties>
+		<java.version>17</java.version>
+		<spring-boot.version>3.2.5</spring-boot.version>
+	</properties>
+
+	<repositories>
+		<repository>
+			<id>aliyun</id>
+			<name>aliyun</name>
+			<url>https://maven.aliyun.com/repository/public</url>
+			<releases>
+				<enabled>true</enabled>
+			</releases>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+
+	<dependencies>
+<!--		<dependency>-->
+<!--			<groupId>org.springframework.boot</groupId>-->
+<!--			<artifactId>spring-boot-starter</artifactId>-->
+<!--		</dependency>-->
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+			<version>3.2.5</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.mysql</groupId>
+			<artifactId>mysql-connector-j</artifactId>
+			<scope>runtime</scope>
+		</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.mybatis.spring.boot</groupId>
+			<artifactId>mybatis-spring-boot-starter</artifactId>
+			<version>3.0.3</version>
+		</dependency>
+
+	</dependencies>
+
+	<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.phq.PortAgvStarter</mainClass>
+					<layout>JAR</layout>
+				</configuration>
+				<executions>
+					<execution>
+						<id>repackage</id>
+						<goals>
+							<goal>repackage</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+<!--	<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>

+ 13 - 0
src/main/java/com/ecnu/platform/SmartPortPlatformApplication.java

@@ -0,0 +1,13 @@
+package com.ecnu.platform;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SmartPortPlatformApplication {
+
+	public static void main(String[] args) {
+		SpringApplication.run(SmartPortPlatformApplication.class, args);
+	}
+
+}

+ 29 - 0
src/main/java/com/ecnu/platform/controller/TestController.java

@@ -0,0 +1,29 @@
+package com.ecnu.platform.controller;
+
+import com.ecnu.platform.mapper.UserMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Description:
+ * @Auther: phq
+ * @Date: 2024/04/20/19:44
+ */
+
+@RestController
+@RequestMapping("/test")
+@Slf4j
+public class TestController {
+
+    @Autowired
+    UserMapper userMapper;
+
+    @RequestMapping(value = "/getAllUsers",method = RequestMethod.POST)
+    public Object queryAllUsers(){
+        log.info("query users----");
+        return userMapper.getAllUser();
+    }
+}

+ 29 - 0
src/main/java/com/ecnu/platform/entity/User.java

@@ -0,0 +1,29 @@
+package com.ecnu.platform.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @Auther: phq
+ * @Date: 2024/02/05/06:42
+ */
+
+//pojo
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class User implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 4758543875414932163L;
+    private String name;
+    private Integer age;
+
+}

+ 22 - 0
src/main/java/com/ecnu/platform/mapper/UserMapper.java

@@ -0,0 +1,22 @@
+package com.ecnu.platform.mapper;
+
+import com.ecnu.platform.entity.User;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Auther: phq
+ * @Date: 2024/02/05/06:50
+ */
+
+@Mapper
+@Component
+public interface UserMapper {
+    @Select("select * from user")
+    List<User> getAllUser();
+
+}

+ 11 - 0
src/main/resources/application.yml

@@ -0,0 +1,11 @@
+server:
+  port: 2001
+
+spring:
+  application:
+    name: smart-port-platform
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    username: pagv
+    password: pagv
+    url: jdbc:mysql://yuerantec.com:2603/portagv

+ 13 - 0
src/test/java/com/ecnu/platform/SmartPortPlatformApplicationTests.java

@@ -0,0 +1,13 @@
+package com.ecnu.platform;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class SmartPortPlatformApplicationTests {
+
+	@Test
+	void contextLoads() {
+	}
+
+}