首先声明我不是很喜欢用foreach,所以我的代码中很少出现foreach。不废话了,上代码:
in的用法:
我的id是Long类型的
service方法,有一个Long的集合:
public List<RbacMenu> listByPackageId(List<Long> ids, String systemCode) { String idsStr = String.join(",",ids);
实体类.xml
select * from xxx where
<if test="ids != null"> FIND_IN_SET(id,#{idsStr}) </if>
not in的用法
service方法,有一个Long的集合:
public List<RbacMenu> listByPackageId(List<Long> ids, String systemCode) { String notids = String.join(",",ids);
实体类.xml
select * from xxx where
<if test="notids != null"> NOT FIND_IN_SET(id,#{notids}) </if>
最后
以上就是强健高跟鞋最近收集整理的关于myabtis中使用not in与 in的写法的全部内容,更多相关myabtis中使用not内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复