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删除。