diff --git a/pom.xml b/pom.xml index e118f32a78275ddafe9d49066fc10b48bce44471..d545cc00c459e2e302c74a07b7f53ea22551e512 100644 --- a/pom.xml +++ b/pom.xml @@ -5,6 +5,7 @@ pom swpu-spring-projects-boot + swpu-spring-projects-testify org.springframework.boot @@ -55,17 +56,17 @@ org.springframework.boot spring-boot-starter-web - - - - - + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.0 + - - - - - + + mysql + mysql-connector-java + runtime + org.projectlombok lombok @@ -78,21 +79,4 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - diff --git a/swpu-spring-projects-boot/pom.xml b/swpu-spring-projects-boot/pom.xml index de9b59bba2247cc7da4d3fc8cdf25f4e4d58af38..615cf599d2a32de9b9b6c2fefaacfb2e3fdb7014 100644 --- a/swpu-spring-projects-boot/pom.xml +++ b/swpu-spring-projects-boot/pom.xml @@ -16,4 +16,21 @@ 11 + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + diff --git a/swpu-spring-projects-boot/src/main/java/com/swpu/controller/SwpuUserController.java b/swpu-spring-projects-boot/src/main/java/com/swpu/controller/SwpuUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..29b84f32b1120d1f883b032b899f9d3c4f878818 --- /dev/null +++ b/swpu-spring-projects-boot/src/main/java/com/swpu/controller/SwpuUserController.java @@ -0,0 +1,24 @@ +package com.swpu.controller; + +import com.swpu.dao.SwpuUserDao; +import com.swpu.entity.SwpuUserEntity; +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; +import java.util.List; + +@RestController +@RequestMapping(value = "/swpu/user") +public class SwpuUserController { + + @Resource + private SwpuUserDao swpuUserDao; + + @GetMapping(value = "/findAll") + public Object findAll() { + List list = swpuUserDao.findAll(); + return list; + } +} diff --git a/swpu-spring-projects-boot/src/main/java/com/swpu/dao/SwpuUserDao.java b/swpu-spring-projects-boot/src/main/java/com/swpu/dao/SwpuUserDao.java new file mode 100644 index 0000000000000000000000000000000000000000..ebcc2e61bba308a94d45833afe4f3f7483efcf1b --- /dev/null +++ b/swpu-spring-projects-boot/src/main/java/com/swpu/dao/SwpuUserDao.java @@ -0,0 +1,19 @@ +package com.swpu.dao; + +import com.swpu.entity.SwpuUserEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface SwpuUserDao { + + SwpuUserEntity findById(@Param("id") String id); + + List findAll(); + + int insert(SwpuUserEntity entity); + + int update(SwpuUserEntity entity); + + int delete(@Param("id") String id); +} diff --git a/swpu-spring-projects-boot/src/main/java/com/swpu/entity/SwpuUserEntity.java b/swpu-spring-projects-boot/src/main/java/com/swpu/entity/SwpuUserEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..9c6a0ab0c6cd609ab840540fc076be5d2cc7d461 --- /dev/null +++ b/swpu-spring-projects-boot/src/main/java/com/swpu/entity/SwpuUserEntity.java @@ -0,0 +1,23 @@ +package com.swpu.entity; + +import lombok.Data; + +import java.util.Date; + +@Data +public class SwpuUserEntity { + + private String id; + + private int departmentId; + + private int jobLevelId; + + private int posId; + + private String engageForm; + + private String specialty; + + private String school; +} diff --git a/swpu-spring-projects-boot/src/main/resources/application.yml b/swpu-spring-projects-boot/src/main/resources/application.yml index 8594e42f053f2b7211225506f283f83395a9fabc..aa844e56a1fa00386376f024e9bdcf201ab58de8 100644 --- a/swpu-spring-projects-boot/src/main/resources/application.yml +++ b/swpu-spring-projects-boot/src/main/resources/application.yml @@ -1,5 +1,17 @@ spring: application: name: swpu-spring-projects + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/swpu_db + username: swpu_user + password: '123456789' + type: com.zaxxer.hikari.HikariDataSource + hikari: + maximum-pool-size: 10000 + + server: port: 20000 +mybatis: + mapper-locations: diff --git a/swpu-spring-projects-boot/src/main/resources/mapper/SwpuUserMapper.xml b/swpu-spring-projects-boot/src/main/resources/mapper/SwpuUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2c568bf83e87931bf03799332a1578de8acbf93 --- /dev/null +++ b/swpu-spring-projects-boot/src/main/resources/mapper/SwpuUserMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + insert into swpu_user (id, department_id, job_level_id, pos_id, engage_form, specialty, school) + values (#{id, javaType = String}, #{departmentId, javaType = Integer}, #{jobLevelId, javaType = Integer}, + #{posId, javaType = Integer}, #{engageForm, javaType = String}, + #{specialty, javaType = String}, #{school, javaType = String}) + + + + insert into swpu_user ( + + id, + department_id, job_level_id, pos_id, engage_form, specialty, school) + values ( + + #{id, javaType = String}, + + #{departmentId, javaType = Integer}, #{jobLevelId, javaType = Integer}, + #{posId, javaType = Integer}, #{engageForm, javaType = String}, + #{specialty, javaType = String}, #{school, javaType = String} + ) + + + + update swpu_user + set ( + department_id = #{departmentId, javaType = Integer}, + job_level_id = #{jobLevelId, javaType = Integer}, + pos_id = #{posId, javaType = Integer}, engage_form = #{engageForm, javaType = String}, + specialty = #{specialty, javaType = String}, school = #{school, javaType = String} + ) + where id = #{id, javaType = String} + + + + update swpu_user + set ( + + department_id = #{departmentId, javaType = Integer}, + + job_level_id = #{jobLevelId, javaType = Integer}, + pos_id = #{posId, javaType = Integer}, engage_form = #{engageForm, javaType = String}, + specialty = #{specialty, javaType = String}, school = #{school, javaType = String} + ) where id = #{id, javaType = String} + + + + delete + from swpu_user su + where 1 = 1 + and su.id = #{id, javaType = String} + + + + diff --git a/swpu-spring-projects-testify/pom.xml b/swpu-spring-projects-testify/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b04dee2d403ae01a6c864f055ecca89bfbc57a35 --- /dev/null +++ b/swpu-spring-projects-testify/pom.xml @@ -0,0 +1,37 @@ + + + + swpu-spring-projects + com.swpu + 0.0.1-SNAPSHOT + + 4.0.0 + + swpu-spring-projects-testify + pom + + + 11 + 11 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/swpu-spring-projects-testify/src/main/java/com/swpu/SwpuSpringProjectsTestifyAppliaction.java b/swpu-spring-projects-testify/src/main/java/com/swpu/SwpuSpringProjectsTestifyAppliaction.java new file mode 100644 index 0000000000000000000000000000000000000000..4f853b654dc43c9f14298505d39a1578a6ca6afb --- /dev/null +++ b/swpu-spring-projects-testify/src/main/java/com/swpu/SwpuSpringProjectsTestifyAppliaction.java @@ -0,0 +1,17 @@ +package com.swpu; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author wales + * + * Testify 入口类 主函数 + */ +@SpringBootApplication +public class SwpuSpringProjectsTestifyAppliaction { + + public static void main(String[] args) { + SpringApplication.run(SwpuSpringProjectsTestifyAppliaction.class, args); + } +}