| <dependencies> |
| <dependency> |
| <groupId>org.springframework.boot</groupId> |
| <artifactId>spring-boot-starter-test</artifactId> |
| <version>2.6.1</version> |
| <scope>test</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.springframework.boot</groupId> |
| <artifactId>spring-boot-starter-webflux</artifactId> |
| <version>2.6.1</version> |
| </dependency> |
| <dependency> |
| <groupId>com.baomidou</groupId> |
| <artifactId>mybatis-plus-boot-starter</artifactId> |
| <version>3.4.0</version> |
| </dependency> |
| <dependency> |
| <groupId>mysql</groupId> |
| <artifactId>mysql-connector-java</artifactId> |
| <version>8.0.27</version> |
| </dependency> |
| <dependency> |
| <groupId>org.projectlombok</groupId> |
| <artifactId>lombok</artifactId> |
| <version>1.18.18</version> |
| <scope>provided</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.assertj</groupId> |
| <artifactId>assertj-core</artifactId> |
| <version>3.21.0</version> |
| <scope>compile</scope> |
| </dependency> |
| </dependencies> |
| server: |
| port: 8080 |
| |
| spring: |
| application: |
| name: demo01 |
| datasource: |
| driver-class-name: com.mysql.cj.jdbc.Driver |
| url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8 |
| username: root |
| password: 123456 |
| main: |
| allow-circular-references: true |
| devtools: |
| restart: |
| enabled: true |
| |
| mybatis: |
| configuration: |
| map-underscore-to-camel-case: true |
| mybatis-plus: |
| type-enums-package: org.example.demo01.enums |
| configuration: |
| |
| |
| |
| default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler |
| logging: |
| level: |
| org: |
| example: |
| demo01: debug |
| @Configuration |
| @MapperScan("org.example.demo01.mapper") |
| public class MybatisPlusConfig { |
| |
| } |
| public enum AgeEnum implements IEnum<Integer> { |
| ONE(1, "一岁"), |
| TWO(2, "二岁"), |
| THREE(3, "三岁"); |
| |
| private int value; |
| private String desc; |
| |
| AgeEnum(final int value, final String desc) { |
| this.value = value; |
| this.desc = desc; |
| } |
| |
| @Override |
| public Integer getValue() { |
| return value; |
| } |
| } |
| @Getter |
| public enum GradeEnum { |
| |
| PRIMARY(1, "小学"), |
| SECONDORY(2, "中学"), |
| HIGH(3, "高中"); |
| |
| GradeEnum(int code, String descp) { |
| this.code = code; |
| this.descp = descp; |
| } |
| |
| @EnumValue |
| private final int code; |
| private final String descp; |
| |
| } |
| # 如下方式为注解处理 |
| public enum GradeEnum { |
| |
| PRIMARY(1, "小学"), SECONDORY(2, "中学"), HIGH(3, "高中"); |
| |
| GradeEnum(int code, String descp) { |
| this.code = code; |
| this.descp = descp; |
| } |
| |
| @EnumValue |
| @JsonValue |
| private final int code; |
| } |
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术