思路就是QueryWrapper中的getCustomSqlSegment()这个函数,其实在Mybatis的xml文件中${ew.customSqlSegment}的customSqlSegment也是用的这个函数
Mybatis-plus子查询的一个思路
思路
思路就是QueryWrapper中的getCustomSqlSegment()这个函数,其实在Mybatis的xml文件中${ew.customSqlSegment}的customSqlSegment也是用的这个函数,使用这个函数可以做一个小的QueryWrapper然后getCustomSqlSegment()转为字符串,最后替换其中的#{}(忘了是什么了,后面补上),然后在大的QueryWrapper里用inSql函数添加这个转换后的字符串
伪代码(后面补上完整的)
1 | QueryWrapper<Test> queryWrapper = new QueryWrapper<>(); |
此为博主副博客,留言请去主博客,转载请注明出处:https://www.baby7blog.com/myBlog/85.html