Giter Club home page Giter Club logo

Comments (5)

nieqiurong avatar nieqiurong commented on July 19, 2024 1

自己业务代码自己处理,不要什么都希望框架帮你做.

from mybatis-plus.

sgps000 avatar sgps000 commented on July 19, 2024

由于之前使用mongodb设计的原因,实体类中特殊类型都会重写get方法,导致有些字段永远不会为空,直接使用entity类型的更新容易出错,所以更多的是想要通过wrapper去主动精准地操作数据库。原本还想实现一个基于wrapper的批量修改插入的,但是想到批量校验需要在java中,通过wrapper直接校验对象是否符合条件,暂时没找到合适的办法,只能用MERGE INTO语句自定义注入器去实现基础功能,没法像mongodb的upsert那样方便。

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 19, 2024

#6229

from mybatis-plus.

sgps000 avatar sgps000 commented on July 19, 2024

自己业务代码自己处理,不要什么都希望框架帮你做.

@nieqiurong
第一个方法是基于wrapper批量更新,如果算个人业务我能理解。
但第二个批量更新插入,我感觉是框架代码的写法有问题,建议改掉。
原框架中serviceImpl的saveOrUpdateBatch那么慢,3.5.7的BaseMapper中InsertOrUpdate也没有改变写法,是用的人少才没人反馈吗?还是我的用法错了?
image

from mybatis-plus.

sgps000 avatar sgps000 commented on July 19, 2024

关于第一个方法,我是在想既然update(Wrapper ew)方法能有,updateBatchById(Collection entityList, int batchSize)也有,为啥不加一个updateBatch(Collection<Wrapper> ewList, int batchSize),我是觉得这个方法跟官方的比较搭才会捎带上,其他特别定制的自定义方法我就没放了。但我不是参与者,也还不熟练使用git,所以直接写好可行的代码建议官方能加进去。或者能否为我解惑一下,为啥不建议批量使用Wrapper更新吗?

from mybatis-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.