Comments (5)
自己业务代码自己处理,不要什么都希望框架帮你做.
from mybatis-plus.
由于之前使用mongodb设计的原因,实体类中特殊类型都会重写get方法,导致有些字段永远不会为空,直接使用entity类型的更新容易出错,所以更多的是想要通过wrapper去主动精准地操作数据库。原本还想实现一个基于wrapper的批量修改插入的,但是想到批量校验需要在java中,通过wrapper直接校验对象是否符合条件,暂时没找到合适的办法,只能用MERGE INTO语句自定义注入器去实现基础功能,没法像mongodb的upsert那样方便。
from mybatis-plus.
from mybatis-plus.
自己业务代码自己处理,不要什么都希望框架帮你做.
@nieqiurong
第一个方法是基于wrapper批量更新,如果算个人业务我能理解。
但第二个批量更新插入,我感觉是框架代码的写法有问题,建议改掉。
原框架中serviceImpl的saveOrUpdateBatch那么慢,3.5.7的BaseMapper中InsertOrUpdate也没有改变写法,是用的人少才没人反馈吗?还是我的用法错了?
from mybatis-plus.
关于第一个方法,我是在想既然update(Wrapper ew)方法能有,updateBatchById(Collection entityList, int batchSize)也有,为啥不加一个updateBatch(Collection<Wrapper> ewList, int batchSize),我是觉得这个方法跟官方的比较搭才会捎带上,其他特别定制的自定义方法我就没放了。但我不是参与者,也还不熟练使用git,所以直接写好可行的代码建议官方能加进去。或者能否为我解惑一下,为啥不建议批量使用Wrapper更新吗?
from mybatis-plus.
Related Issues (20)
- 自动生成主键id在微软云上不生效 HOT 1
- 用同一个对象作为分页查询参数,后执行的分页查询结果会覆盖前一个的查询结果 HOT 5
- 版本兼容问题 HOT 1
- 自定义InsertBatchSomeColumn,Oracle数据库insert all 报错 HOT 3
- 使用分页插件时在SQL中使用了Group By 语句后 不管加不加Where 条件都会被拦截器拦截 非法SQL,必须要有where条件 HOT 3
- 严重问题: 查询条件全部丢失 HOT 9
- Occasionally occurs java.lang.NullPointerException,but retrying fixes it HOT 6
- 严重问题:3.5.7重写了deleteByIds,如果项目使用了乐观锁,做了空异常校验,会抛出异常
- QueryWrapper查询时,自动调用了TypeHandler对参数进行了加密 HOT 2
- 如何处理AMapper中某个函数初始化依赖BMapper某个函数的的查询结果中的数据 HOT 1
- 有支持Wrapper多表jion的计划吗 HOT 4
- IllegalSQLInnerInterceptor 和 BaseMapper.selectCount(Wrapper)+逻辑删除 冲突问题 HOT 7
- 映射的表实体类上使用多行注释使用注解@TableName调用mybatis-plus自动装配的SQL都会造成读取到多行注释的内容 HOT 1
- 逻辑删除插件导致Jsql解析错误 HOT 2
- mysql表主键 ID 重复 HOT 6
- 建议取消数据层的saveBatch等方法的@Transactional注解,交由业务层自行管理 HOT 5
- SqlServerQuery tablesSql 表描述乱码 HOT 1
- 在使用left join编写做多表联查时当我将从表中的字段作为查询条件的时候报错 HOT 1
- postgres uuid 自定义typehandler 和 自定义主键生成策略,主键赋值时出错。 HOT 5
- 关于官网指南中likeLeft、likeRight功能解释的错误
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybatis-plus.