zoukankan      html  css  js  c++  java
  • 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的类型  

  • 相关阅读:
    2015多校1006.First One
    2015多校.MZL's endless loop(欧拉回路的机智应用 || 构造)
    LUXURY 8
    矩阵快速幂模板
    博弈入门
    cf558c(bfs)
    LUXURY 7
    dfs序 + RMQ = LCA
    双端队列
    UVa-401 Palindromes
  • 原文地址:https://www.cnblogs.com/yang218/p/9436047.html
Copyright © 2011-2022 走看看