MyBatis查詢結果集,返回List的對象集合


MyBatis查詢結果集,返回List的對象集合
TestMapper(springBoot放在resources下mapper目錄下)

<mapper namespace="com.baosight.dao.TestMapper">
    <resultMap id="resultListTimeRange" type="com.baosight.pojo.TimeRange">
        <id column="F1ON"  property="F1ON" />
        <id column="F1OFF" property="F1OFF" />
    </resultMap>
    <select id="query"  resultMap="resultListTimeRange">
        select F1ON,F1OFF from ap.SCC_FMSTRIP fetch first 2 rows only
    </select>
</mapper>

application.properties

#mybatis
mybatis.typeAliasesPackage=com.baosight.pojo
mybatis.mapperLocations=classpath:mapper/*.xml
mybatis.configuration.mapUnderscoreToCamelCase=true
mybatis.configuration.cacheEnabled=false
logging.level.com.baosight.service.AP.dao=debug

各類請求和返回數據類型

${unit}=DC	沒有引號

#{coilId}='002641870100' 

parameterType="hashmap"

 	<update id="updateIFREAD_UNITStatus_SENDCHECK"  parameterType="hashmap">
        update AP.SENDCHECK_LEN
        SET ${unit}=1
        WHERE PIECENO=#{coilId}
    </update>

resultType="integer" parameterType="string"

	<select id="queryIFREAD_R1_SENDCHECK"  resultType="integer" parameterType="string">
        select IFREAD_R1
        from AP.SENDCHECK_LEN
        WHERE PIECENO=#{coilId}
    </select>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。