1.lombok的使用

2.Spring-mybatis-增删改查准备工作
This commit is contained in:
2025-09-25 14:34:50 +08:00
parent c49a7571f6
commit 4040b06ab8
11 changed files with 255 additions and 64 deletions

View File

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

View File

@@ -0,0 +1,8 @@
package com.inmind.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EmpMapper {
}

View File

@@ -0,0 +1,26 @@
package com.inmind.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Emp {
private Integer id;//ID
private String username;//用户名
private String password;//密码
private String name;//姓名
private Short gender;//性别 1:男 2
private String image; //头像URL
private String job; // 职位 1:班主任 2:讲师 3:学工主管 4:教研主管 5:咨询师
private LocalDate entrydate; // 入职日期
private Integer deptId; // 部门ID
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,14 @@
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
mybatis.mapper-locations=classpath:mappers/*xml
#指定Mybatis的实体目录
mybatis.type-aliases-package=com.inmind.mybatis.entity
#驱动类名称
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#数据库连接的url
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis
#连接数据库的用户名
spring.datasource.username=root
#连接数据库的密码
spring.datasource.password=1234

View File

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