Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use queryWrapper in xml's join table query by mybatisplus

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the relevant knowledge of "how mybatisplus uses queryWrapper in xml's linked table query". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this article "mybatisplus how to use queryWrapper in xml's linked table query" can help you solve the problem.

The connected table query in xml uses queryWrapper to define the method List linkUserAndDept (@ Param ("ew1") Wrapper wrapper1, @ Param ("ew2") Wrapper wrapper2) in the mapper interface. In mapper xml, select u.name.u.agerecoveru.address D. * from user u left join dept d on u.deptid = d.deptid AND ${ew1.sqlSegment} AND ${ew2.sqlSegment} call the method QueryWrapper userWrapper = Wrappers.query () QueryWrapper deptWrapper = Wrappers.query (); userWrapper.eq ("u.name", "Zhang San"); userWrapper.setParamAlias ("ew1"); / / set an alias here, otherwise an exception / * deptWrapper.eq ("d.deptname", "Development Department"); deptWrapper.setParamAlias ("ew2"); * / List map = userMapper.linkUserAndDept (userWrapper,deptWrapper) will be reported. Mapper.xml works with queryWrapper to write the interface in mapper: IPage selectPosts (Page page, @ Param (Constants.WRAPPER) QueryWrapper wrapper); ${ew.customSqlSegment} in xml

Is the condition of querywrapper.

Select * from user_collection ${ew.customSqlSegment} about "how mybatisplus uses queryWrapper in xml's linked table query" ends here. Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report