import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.rules.DbType; import com.baomidou.mybatisplus.genera
由于由hibernate切换到了mybatisplus,导致主键的生成方式变化,使用Mybatisplus的代码生成器,自动生成的ID是BigDecimal 1 2 @TableId("ID") privateBigDecimal id; 在使用Swagger接口文档中(http://xxx/swagger-ui/index.html)测试过程中发现BigDecimal 精度丢失,于是开始进行类型兼容(PS:接口文档id入参全改成String,...
[自动填充功能官网](自动填充功能 | MyBatis-Plus (baomidou.com)) 配置类 package com.caq.servicebase.handle; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; import java.util.D...
gc.setSwagger2(true);//是否开启swaggergc.setActiveRecord(true);//【不懂】 活动记录 不需要ActiveRecord特性的请改为false 是否支持AR模式gc.setEnableCache(false);//XML 二级缓存gc.setBaseResultMap(true);//【不懂】 XML ResultMap xml映射文件的配置gc.setBaseColumnList(false);//【不懂】 XML columL...
<mybatisPlus.version>3.4.1</mybatisPlus.version> <druid.version>1.0.9</druid.version> <swagger.version>2.9.2</swagger.version> <hutool.version>5.5.8</hutool.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> ...
enableSwagger() //开启 swagger 模式 .disableOpenDir(); //禁止打开输出目录,默认打开 }) //3、包配置 .packageConfig(builder -> { builder.parent(parent) // 设置父包名 .moduleName(module) //设置模块包名 .entity("entity") //pojo 实体类包名 .service("service") //Service 包名 .serviceImpl(...
mp代替mybatisplus 按照本文目录结构即可快速开发一套完整的CRUD接口,包括后面的Swagger测试 快速开发套路 这一套东西就是写接口对吧,所以写接口也就是写业务类,写业务类有个小口诀 建表写sql 定义实体类 dao与mapper service和impl controller 那么我们用boot写微服务模块也有个小套路 ...
生成的表设置生成的包,指定了基础包,Service类的包指定xml生成:执行生成:运行之后,代码生成五、SwaggerSwagger引入的Maven:Swagger包配置扫描Controller:Swagger加入后查看Swagger地址http://127.0.0.1:8091/swagger-ui.htmlSwagger集成完毕六、总结这篇文档讲述了Eureka、Feign、断路器、Swagger、MyBatis-Plus等工具与Spring...
5、controller 代码语言:javascript 代码运行次数:0 运行 AI代码解释 // 省略 import@RestController @RequestMapping("/common")@EnableSwagger2publicclassCommonController{@Autowired QuestionService questionService;@Autowired StudentService studentService;@GetMapping("/getAllQuestionByPage/{page}/{size}")publicMap...
一、mybatis-plus-generator实操 接下来来实际操作一下mybatis-plus-generator的使用。 1.1 添加依赖mybatis-plus-generator AutoGenerator 是MyBatis-Plus 的代码生成器,通过 AutoGenerator 可以快速生成 Entity、Mapper、Mapper XML、Service、Controller 等各个模块的代码。 MyBatis-Plus 从 3.0.3 之后移除了代码生成...