05mybatis的resultType和resultMap

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zw524362419/article/details/78966463

mybatis的resultType和resultMap

  1. resultType
    2.1 输出简单类型
    <select id="findCntByName" parameterType="java.lang.String"
        resultType="int">
        select count(*) from business_apply where name = #{value}
    </select>

2.2 输出pojo类型

    <select id="findIdByBa" parameterType="com.cmhy.model.BusinessApply"
        resultType="com.cmhy.model.BusinessApply">
        select * from business_apply where city = #{address.city}
    </select>

2.3 输出pojo列表:与 输出pojo类型区别是mapper.java的输出参数是list

    <select id="findIdByBa" parameterType="com.cmhy.model.BusinessApply"
        resultType="com.cmhy.model.BusinessApply">
        select * from business_apply where city = #{address.city}
    </select>

猜你喜欢

转载自blog.csdn.net/zw524362419/article/details/78966463