mybatis注解版in查询

 

@Select({"<script> " +
            " select * "+
            " from business_threat bt \n" +
            " join abnormal_event_type aet on bt.event_type_id = aet.id " +
            " where 1=1 " +
            " <if test = ' ids != null'> " +
            " and bt.id in " +
            " <foreach item = 'item' index = 'index' collection = 'ids' open = '(' separator = ',' close = ')' > " +
            " #{item} " +
            " </foreach> " +
            " </if> " +
            "</script>"})
    List<BusinessThreatVO> getByBusinessThreadId(@Param("ids") List<Long> ids);

 

上一篇:20210408-学习随笔


下一篇:2021-05-31