mybatis@select动态sql

版权声明:本文为wcuu原创文章。 https://blog.csdn.net/wcuuchina/article/details/87791284

 根据条件进行模糊查询

@Select("({ +" +
            "<script>" +
            "select" +
            "*" +
            "from chat_history" +
            "where 1 = 1 AND content like " +
            "<if test=search_key != null>" +
            "#{search_key}" +
            "</if> and (to_id = #{user_id} or send_id = #{user_id}) AND del_flag = 0" +
            "</script>" +
            "})")
    List<Map> findMessages(Map params);

猜你喜欢

转载自blog.csdn.net/wcuuchina/article/details/87791284