mybatis-plus中的@Select注解里面写sql语句的in

阅读 47

2023-08-04

@Select("<script>" +

       "select \n" +

       "email \n" +

       "from sys_user\n" +

       "where id in \n" +

       "    <foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>" +

       "       #{item}" +

       "    </foreach>" +

       "</script>"

)

   List<String> listEmailByIdBatch(@Param("ids") List<String> ids);

比葫芦画瓢就成,注意ids的集合为String类型。


精彩评论(0)

0 0 举报