一句簡單的SQL----模糊 查詢

模糊查詢 

@Select("select  * from u_user u WHERE u.nickname LIKE CONCAT ('%',#{email},'%')" +
            " OR u.email LIKE CONCAT ('%',#{email},'%')")
    List<Uuser> selectAccount(String email);

帶分頁的模糊查詢

 

/**
     *  模糊查詢分頁
     * @param email
     * @param index
     * @param currentCount
     * @return
     */
    @Select("SELECT * FROM u_user u WHERE u.nickname LIKE CONCAT ('%',#{email},'%') " +
            "OR u.email LIKE CONCAT ('%',#{email},'%') LIMIT #{index},#{currentCount}")
    List<Uuser>  limitLike(@Param("email") String email,@Param("index") int index,@Param("currentCount") int currentCount);
相關文章
相關標籤/搜索