In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I would like to share with you the relevant knowledge points about the method of QueryWrapper and or connection and paging in mybatis-plus. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
QueryWrapper and or is used in conjunction with paging Page rpage = baseMapper.selectPage (new Page (pageBean.getPageSize (), pageBean.getPageNum ()), new QueryWrapper () .eq ("siteid") Siteid) .and (wrapper-> wrapper .or () .lt ("createtime", updatetime) .or () .lt ("deletetime") Updatetime) .or () .lt ("operatetime", updatetime) .or () .lt ("updatetime", updatetime)) The result of and or spelling is new QueryWrapper () .eq ("siteid", siteid) .and (wrapper-> wrapper .or () .lt ("createtime"). Updatetime) .or () .lt ("deletetime", updatetime) .or () .lt ("operatetime", updatetime) .or () .lt ("updatetime" Updatetime)) SELECT * FROM t WHERE useflag = 1 AND (siteid =? AND (createtime
< ? OR deletetime < ? OR operatetime < ? OR updatetime < ?))使用or和and的问题 最近在使用MyBatis Plus,发现在拼接条件的时候,and和or会出问题 比如下面这种QueryWrapper userWrapper = new QueryWrapper();userWrapper.eq("name", name);userWrapper.eq("pwd", pwd).or().eq("phone", phone); 这种写法拼出来的SQL语句是这样的 select * from user where (name = ? and pwd= ? or phone = ?) 这样子是肯定不行的,于是去官网查询,发现正确的写法是这样的 QueryWrapper userWrapper = new QueryWrapper();userWrapper.eq("name", name);userWrapper.and(wrapper ->Wrapper.eq ("pwd", pwd). Or (). Eq ("phone", phone); select * from user where name =? And (pwd=? Or phone =?) These are all the contents of this article entitled "how to use QueryWrapper and or in mybatis-plus and realize paging". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.