<?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.newfiber.api.pc.dao.WaterQuality.StandardScaleInfoDao"> <select id="getList" parameterType="String" resultType="com.newfiber.api.pc.model.WaterQuality.StandardScaleInfo"> select max(case when grade = '1' then thresholdValue else null end) as gradeOne, max(case when grade = '2' then thresholdValue else null end) as gradeTwo, max(case when grade = '3' then thresholdValue else null end) as gradeThree, max(case when grade = '4' then thresholdValue else null end) as gradeFour, max(case when grade = '5' then thresholdValue else null end) as gradeFive,fieldNo from standard_scale_info WHERE standardNo = #{standardNo} GROUP BY fieldNo </select> </mapper>