Solo  当前访客:1 开始使用

多表映射xml写法


一、Code

<resultMap type="cn.g4b.cau.ent.asst.entity.order.EntServiceOrderDetail" id="EntServiceOrderDetailMap">  
    <association property="entServiceOrder" javaType="cn.g4b.cau.ent.asst.entity.order.EntServiceOrder">  
        <result property="id" column="order_id"/>  
        <result property="orderNo" column="order_no"/>  
        <result property="entId" column="ent_id"/>  
        <result property="busiType" column="busi_type"/>  
        <result property="totalPrice" column="total_price"/>  
        <result property="orderStatus" column="order_status"/>  
        <result property="processInsId" column="process_ins_id"/>  
        <result property="errorMsg" column="error_msg"/>  
        <result property="parentId" column="parent_id"/>  
        <result property="remark" column="remark"/>  
    </association>  
    <association property="entServiceProduct" javaType="cn.g4b.cau.ent.asst.entity.order.EntServiceProduct">  
        <result property="id" column="product_id"/>  
        <result property="prodCode" column="prod_code"/>  
        <result property="prodName" column="prod_name"/>  
        <result property="prodDesc" column="prod_desc"/>  
        <result property="prodStatus" column="prod_status"/>  
        <result property="prodPicPath" column="prod_pic_path"/>  
        <result property="prodPrice" column="prod_price"/>  
        <result property="onShelfTime" column="on_shelf_time"/>  
        <result property="offShelfTime" column="off_shelf_time"/>  
        <result property="deleted" column="deleted"/>  
        <result property="prodPriority" column="prod_priority"/>  
        <result property="parentId" column="parent_id"/>  
        <result property="prodPricePromotion" column="prod_price_promotion"/>  
        <result property="isPromotion" column="is_promotion"/>  
        <result property="promotionStart" column="promotion_start"/>  
        <result property="promotionEnd" column="promotion_end"/>  
        <result property="treeLevel" column="tree_level"/>  
        <result property="prodType" column="prod_type"/>  
    </association>  
    <association property="entServiceOrderProductMapping" javaType="cn.g4b.cau.ent.asst.entity.order.EntServiceOrderProductMapping">  
        <result property="id" column="id"/>  
        <result property="orderId" column="order_id"/>  
        <result property="productId" column="product_id"/>  
    </association>  
</resultMap>

二、说明:

resultmap可存在多个,查询写上对应的id即可

0 0