用户登录
用户注册

分享至

mybatis in long

  • 作者: 尛女人尛情緒
  • 来源: 51数据库
  • 2020-09-30
mybatis中的updateByExampleSelective方法怎么使用。
sendDetailMapper.updateByExampleSelective(sendDetail, m);
参数m怎么传



  updatebyexampleselective(@param("record") xxx record, @param("example") xxxexample example);
第一个参数 是要修改的部分值组成的对象,其中有些属性为null则表示该项不修改。
第二个参数 是一个对应的查询条件的类, 通过这个类可以实现 order by 和一部分的where 条件。
使用方法大概如下:

xxxexample example = new xxxexample();
criteria criteria = example.createcriteria();
// 这个内部类中有对应xxx的每个属性的条件方法 .
// 假如 xxx 包含id 属性.
// 那它就有 andid(属性)equalto(sql里的各种标准条件语句, =、!=、<、>、in、like、not之类的)的方法.
criteria.andidequalto(paramid).andagein(arrays.aslist({10,20,30}));
xxxmapper.updatebyexampleselective(xx,example);
软件
前端设计
程序设计
Java相关