mysql嵌套查询


AccountBillModel -->  UserModel 一对一
AccountBillModel -->  AccountBillDetailModel 一对多
    <resultMap id="AccountBillMap" type="com.blm.model.accountBill.AccountBillModel">
        <result column="billId" jdbcType="BIGINT" property="billId"/>
        <result column="billCode" jdbcType="VARCHAR" property="billCode"/>
        <result column="accountedStatus" jdbcType="INTEGER" property="accountedStatus"/>
        <result column="settleValid" jdbcType="INTEGER" property="settleValid"/>
        <result column="user_id" jdbcType="BIGINT" property="userId" />
        <association property="userModel" javaType="com.blm.model.user.UserModel">
            <result column="user_id" jdbcType="BIGINT" property="userId" />
            <result column="user_name" jdbcType="VARCHAR" property="userName" />
        </association>
        <collection javaType="ArrayList" ofType="com.blm.model.accountBill.AccountBillDetailModel"
                    property="accountBillDetailModel">
            <result column="orderId" jdbcType="BIGINT" property="orderId"/>
            <result column="orderCode" jdbcType="VARCHAR" property="orderCode"/>
            <result column="freightAmount" jdbcType="DECIMAL" property="freightAmount"/>
            <result column="incidentalAmount" jdbcType="DECIMAL" property="incidentalAmount"/>
            <result column="publishTime" jdbcType="TIMESTAMP" property="publishTime"/>
        </collection>
    </resultMap>

 property = “ ” 被维护实体在宿主实体中的属性名

javaType = " " 被维护实体的类型

ofType:指定映射到List集合的pojo的类型  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM