commit 66eed59a3a71052f98971f287757bcba0ed03ded Author: liyuxin <1579178744@qq.com> Date: Wed Aug 7 19:03:12 2024 +0800 提交 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +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/ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..834ddd2 --- /dev/null +++ b/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + com.bwie + system + 0.0.1-SNAPSHOT + system + system + + 1.8 + UTF-8 + UTF-8 + 2.6.13 + + + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + org.springframework.boot + spring-boot-starter-web + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.2 + + + + com.mysql + mysql-connector-j + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + UTF-8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.bwie.system.SystemApplication + true + + + + repackage + + repackage + + + + + + + + diff --git a/src/main/java/com/bwie/system/SystemApplication.java b/src/main/java/com/bwie/system/SystemApplication.java new file mode 100644 index 0000000..6c52807 --- /dev/null +++ b/src/main/java/com/bwie/system/SystemApplication.java @@ -0,0 +1,13 @@ +package com.bwie.system; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SystemApplication { + + public static void main(String[] args) { + SpringApplication.run(SystemApplication.class, args); + } + +} diff --git a/src/main/java/com/bwie/system/admin/Stu.java b/src/main/java/com/bwie/system/admin/Stu.java new file mode 100644 index 0000000..59c7dbb --- /dev/null +++ b/src/main/java/com/bwie/system/admin/Stu.java @@ -0,0 +1,12 @@ +package com.bwie.system.admin; + +import lombok.Data; + +@Data +public class Stu { + + private Integer stuId; + private String stuName; + private String stuSex; + private String stuAge; +} diff --git a/src/main/java/com/bwie/system/controller/StuController.java b/src/main/java/com/bwie/system/controller/StuController.java new file mode 100644 index 0000000..5cf9556 --- /dev/null +++ b/src/main/java/com/bwie/system/controller/StuController.java @@ -0,0 +1,22 @@ +package com.bwie.system.controller; + +import com.bwie.system.admin.Stu; +import com.bwie.system.service.StuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +public class StuController { + + + @Autowired + private StuService stuService; + + @PostMapping("/findStuList") + public List findStuList(){ + return stuService.findStuList(); + } +} diff --git a/src/main/java/com/bwie/system/mapper/StuMapper.java b/src/main/java/com/bwie/system/mapper/StuMapper.java new file mode 100644 index 0000000..3e82f99 --- /dev/null +++ b/src/main/java/com/bwie/system/mapper/StuMapper.java @@ -0,0 +1,12 @@ +package com.bwie.system.mapper; + +import com.bwie.system.admin.Stu; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface StuMapper { + List findStuList(); + +} diff --git a/src/main/java/com/bwie/system/service/Impl/StuServiceImpl.java b/src/main/java/com/bwie/system/service/Impl/StuServiceImpl.java new file mode 100644 index 0000000..643f3f9 --- /dev/null +++ b/src/main/java/com/bwie/system/service/Impl/StuServiceImpl.java @@ -0,0 +1,21 @@ +package com.bwie.system.service.Impl; + +import com.bwie.system.admin.Stu; +import com.bwie.system.mapper.StuMapper; +import com.bwie.system.service.StuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class StuServiceImpl implements StuService { + + @Autowired + private StuMapper stuMapper; + + @Override + public List findStuList() { + return stuMapper.findStuList(); + } +} diff --git a/src/main/java/com/bwie/system/service/StuService.java b/src/main/java/com/bwie/system/service/StuService.java new file mode 100644 index 0000000..30df7c6 --- /dev/null +++ b/src/main/java/com/bwie/system/service/StuService.java @@ -0,0 +1,10 @@ +package com.bwie.system.service; + +import com.bwie.system.admin.Stu; + +import java.util.List; + +public interface StuService { + List findStuList(); + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..c924331 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,28 @@ +# 服务器相关 + +server: + port: 8080 + +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + datasource: + driver-class-name: com.mysql.jdbc.Driver + url: jdbc:mysql://111.229.181.183:3306/h6_test14?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false + username: root + password: '@lyx8023' + + + +# mybatis +mybatis: + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + mapper-locations: classpath*:mapper/*Mapper.xml + global-config: + db-config: + id-type: auto + + diff --git a/src/main/resources/com/bawei/mapper/StuMapper.xml b/src/main/resources/com/bawei/mapper/StuMapper.xml new file mode 100644 index 0000000..76e495a --- /dev/null +++ b/src/main/resources/com/bawei/mapper/StuMapper.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html new file mode 100644 index 0000000..89bb8ba --- /dev/null +++ b/src/main/resources/static/index.html @@ -0,0 +1,6 @@ + + +

hello word!!!

+

this is a html page

+ + \ No newline at end of file diff --git a/src/test/java/com/bwie/system/SystemApplicationTests.java b/src/test/java/com/bwie/system/SystemApplicationTests.java new file mode 100644 index 0000000..6c16135 --- /dev/null +++ b/src/test/java/com/bwie/system/SystemApplicationTests.java @@ -0,0 +1,13 @@ +package com.bwie.system; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SystemApplicationTests { + + @Test + void contextLoads() { + } + +}