<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tangguo.mapper.BbsGradeMapper">
	
	<select id="selectGradeByPoints" resultType="com.tangguo.domain.BbsGrade">
		SELECT
			*
		FROM
			bbs_grade g
		WHERE
			(g.min_points &lt;= #{points} AND g.max_points >= #{points}) OR (#{points} > g.max_points)
		ORDER BY
			g.max_points DESC
		LIMIT
			1
	</select>
	
</mapper>
