三张表 一对多 分页查询

   三张表 一对多 分页查询   

    <resultMap id="queryListMap" type="com.mtqg.identify.identifyServer.domain.Order"> 
         <result column="or_id" property="or_id"/>
        <result column="create_time" property="create_time"/>
        <result column="user_comment" property="user_comment"/>
        <result column="ordertype" property="ordertype"/>
        <result column="identifytype" property="identifytype"/>
        <association  property="user" javaType="com.mtqg.identify.identifyServer.domain.User"> 
            <id column="u_id" property="u_id"/>
            <result  column="u_name" property="u_name"/>  
            <result  column="u_head_img" property="u_head_img"/>  
        </association>
        <collection property="images" javaType="java.util.List" ofType="com.mtqg.identify.expertServer.domain.Image">  
            <id column="imid" property="imid"/>
            <result  column="image_url" property="image_url"/>  
        </collection>  
    </resultMap>

<!--首页订单列表    -->
    <select id="findOrderList" resultMap="queryListMap">
        select o.or_id,o.create_time,o.user_comment,o.ordertype,o.identifytype,i.image_url,u.u_name,u.u_head_img
        from (select a.or_id,a.user_id,a.create_time,a.user_comment,a.ordertype,a.identifytype from orders a order BY a.or_id DESC limit #{0},10) o
        left join images i on (i.or_id=o.or_id)
        left join users u on (u.u_id=o.user_id)
        order by o.or_id desc
    </select>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值