SpringBoot3.0后有一些改动
<dependency>
<groupId>org.projectlombokgroupId>
<artifactId>lombokartifactId>
<version>1.18.20version>
dependency>
<dependency>
<groupId>jakarta.servletgroupId>
<artifactId>jakarta.servlet-apiartifactId>
<version>6.0.0version>
<scope>providedscope>
dependency>
<dependency>
<groupId>com.alibaba.fastjson2groupId>
<artifactId>fastjson2-extension-spring6artifactId>
<version>2.0.24version>
dependency>
<dependency>
<groupId>com.baomidougroupId>
<artifactId>mybatis-plus-boot-starterartifactId>
<version>3.5.3version>
dependency>
// mybatis-plus的ServiceImpl
save(entity):保存实体对象到数据库,null的属性也会保存,不会使用数据库默认值
saveBatch(entityList):批量保存实体对象列表到数据库。
saveOrUpdate(entity):保存或更新实体对象到数据库,根据主键判断是执行保存还是更新操作。
saveOrUpdateBatch(entityList):批量保存或更新实体对象列表到数据库。
removeById(id):根据主键删除数据库中的记录。
removeByMap(columnMap):根据条件删除数据库中的记录。
remove(queryWrapper):根据条件删除数据库中的记录。
removeByIds(ids):根据主键列表批量删除数据库中的记录。
updateById(entity):根据主键更新数据库中的记录。
update(entity, updateWrapper):根据条件更新数据库中的记录。
getById(id):根据主键查询数据库中的记录。
getOne(queryWrapper):根据条件查询数据库中的一条记录。
list(queryWrapper):根据条件查询数据库中的记录列表。
page(page, queryWrapper):根据条件进行分页查询,返回分页结果。
<if test="ew.nonEmptyOfWhere">
and ${ew.sqlSegment}
if>