find_in_set

MP中使用find_in_set函数

LambdaQueryWrapper<TAuthGroup> group = Wrappers.lambdaQuery();
group.apply("FIND_IN_SET({0}, parent_ids)",tmp);
List<TAuthGroup> list = this.list(group);

网上看很多人使用如下方式查询:

queryWrapper.apply( 入参 != null,"FIND_IN_SET ('"+ 入参 +"', 字段名 )");

上面这段代码涉及到sql注入,所以最好使用第一种方式。

		List<Entity> lstPo = this.list(Wrappers.<Entity>query()
		.eq("is_del",0).apply("find_in_set(dept_id,{0})",deptFullIds));
posted @ 2024-06-20 09:54  寒冷的雨呢  阅读(2)  评论(0编辑  收藏  举报