创建MyBatis-Plus版的后端查询项目

记得编码和maven库的检测!!!

1、maven库导入包

xml 复制代码
		<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
            <version>3.5.12</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-jsqlparser -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-jsqlparser</artifactId>
            <version>3.5.12</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </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>

2、配置文件

yaml 复制代码
spring:
  application:
    name: crm2026

  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
    url: jdbc:mysql://localhost:3306/demo02?characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true

mybatis-plus:
  configuration:
    log-prefix: mybatis.
    log-impl: org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl
    map-underscore-to-camel-case: true
    lazy-loading-enabled: true
  type-aliases-package: com.situ.crm2026.model
  mapper-locations: classpath*:/mapper/**/*.xml

server:
  port: 8080

logging:
  level:
    mybatis: debug

3、必要类

1、实体类

2、创建时间那、创建者啊,这些不变的数据单独封装

3、较为简单的 响应 封装类

4、后端传来时间范围时,用这个接受处理,而且继承了基础实体类

4、逻辑方面

1、dao层

要想成功分页,还需对分页功能进行配置

2、Service接口

3、api接口层

相关推荐
长安er16 小时前
LeetCode 62/64/5/1143多维动态规划核心题型总结
算法·leetcode·mybatis·动态规划
dazhong201218 小时前
Mybatis 敏感数据加解密插件完整实现方案
java·数据库·mybatis
努力的小郑21 小时前
MyBatis 两个隐蔽深坑实录:Arrays.asList() 与数字 0 的“离奇失踪”
java·面试·mybatis
cike_y1 天前
Mybatis增删改查&CURD
java·开发语言·tomcat·mybatis·安全开发
小鸡脚来咯1 天前
Redis与MySQL双写一致性(实战解决方案)
spring·oracle·mybatis
小鸡脚来咯2 天前
Redis三大问题:穿透、击穿、雪崩(实战解析)
java·spring·mybatis
陌路202 天前
redis缓存雪崩,击穿,穿透
redis·缓存·mybatis
学习编程的Kitty3 天前
Redis(1)——持久化
数据库·redis·mybatis
利刃大大3 天前
【Mybatis】Mybatis入门 && 基础操作 && XML配置文件开发 && 多表查询 && 注入问题 && 数据库连接池
xml·数据库·mybatis
野蛮人6号3 天前
黑马微服务报错以及解决前23节课
spring boot·微服务·mybatis