積分等級規則表sql
其中字段score_range爲int4range類型,表示範圍。mybatis
check是否在範圍內sql:dom
select grade_id from gh_score_grade t where score_range @> #{scoreTotal}
update範圍值,mybatis代碼:test
<update id="update" parameterType="com.bootdo.score.domain.ScoreGradeDO"> update gh_score_grade <set> <if test="gradeId != null">grade_id = #{gradeId},</if> <if test="gradeName != null">grade_name = #{gradeName},</if> <if test="scoreRange != null">score_range = #{scoreRange} :: int4range</if> </set> where id = #{id} </update>