|  |  | 
 |  |  |                             LEFT JOIN xzx_user_info e ON e.user_id = a.receiver | 
 |  |  |                     WHERE | 
 |  |  |                         a.create_user_id=#{userId} | 
 |  |  |                         and a.order_status in (4,5,7) | 
 |  |  |                     GROUP BY | 
 |  |  |                         a.order_id | 
 |  |  |                 ) | 
 |  |  | 
 |  |  |                             LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id | 
 |  |  |                     WHERE | 
 |  |  |                         a.user_id = #{userId} | 
 |  |  |                         and a.status = 3 | 
 |  |  |                     GROUP BY | 
 |  |  |                         a.id | 
 |  |  |                 ) | 
 |  |  | 
 |  |  |                         '1' type, | 
 |  |  |                         ifnull(sum(d.money), 0) money, | 
 |  |  |                         '0' score, | 
 |  |  |                         a.address address, | 
 |  |  |                         CONCAT(a.address_area, a.address) address, | 
 |  |  |                         ifnull(sum(d.weight), 0) weight, | 
 |  |  |                         e. NAME NAME, | 
 |  |  |                         e.NAME name, | 
 |  |  |                         a.create_time createTime | 
 |  |  |                     FROM | 
 |  |  |                         xzx_order_info a | 
 |  |  | 
 |  |  |                             LEFT JOIN xzx_user_info e ON e.user_id = a.receiver | 
 |  |  |                     WHERE | 
 |  |  |                         a.create_user_id = #{userId} | 
 |  |  |                       and a.order_status in (4,5,7) | 
 |  |  |                     GROUP BY | 
 |  |  |                         a.order_id | 
 |  |  |                 ) | 
 |  |  |                 UNION | 
 |  |  |                 ( | 
 |  |  |                     SELECT | 
 |  |  |                         a.id orderId, | 
 |  |  |                         a.order_no orderId, | 
 |  |  |                         a. STATUS STATUS, | 
 |  |  |                         '2' type, | 
 |  |  |                         '0' money, | 
 |  |  |                         ifnull(sum(d.score), 0) score, | 
 |  |  |                         a.address address, | 
 |  |  |                         CONCAT(a.area, a.address) address, | 
 |  |  |                         ifnull(sum(d.weight), 0) weight, | 
 |  |  |                         a.username NAME, | 
 |  |  |                         e.username name, | 
 |  |  |                         a.CREATED_TIME createTime | 
 |  |  |                     FROM | 
 |  |  |                         xzx_jhy_order a | 
 |  |  |                             LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id | 
 |  |  |                             LEFT JOIN xzx_jhy_info e ON a.jhy_id = e.user_id | 
 |  |  |                     WHERE | 
 |  |  |                         a.user_id = #{userId} | 
 |  |  |                     and a.status = 3 | 
 |  |  |                     GROUP BY | 
 |  |  |                         a.id | 
 |  |  |                 ) | 
 |  |  | 
 |  |  |             a.status != '5' | 
 |  |  |             and a.user_id = #{userId} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectOrderByUserId" resultType="com.xzx.gc.entity.OrderInfo"> | 
 |  |  |         SELECT | 
 |  |  |             a.* | 
 |  |  |         FROM | 
 |  |  |             xzx_order_info a | 
 |  |  |         WHERE | 
 |  |  |             a.order_status != '6' | 
 |  |  |             and a.create_user_id = #{userId} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectListByOrderId" resultType="com.xzx.gc.user.vo.CategaryVo"> | 
 |  |  |         SELECT | 
 |  |  |             b.title | 
 |  |  |         FROM | 
 |  |  |             xzx_order_item_info a | 
 |  |  |                 LEFT JOIN xzx_sys_environmental_info b ON a.item_type = b.item_type | 
 |  |  |         where  a.order_id = #{orderId} | 
 |  |  |           and a.weight >0 | 
 |  |  |         GROUP BY a.item_type | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectJHYListByOrderId" resultType="com.xzx.gc.user.vo.CategaryVo"> | 
 |  |  |  | 
 |  |  |         SELECT | 
 |  |  |             a.title title | 
 |  |  |         FROM | 
 |  |  |             xzx_jhy_order_items a | 
 |  |  |         WHERE  a.order_id = (select b.id from xzx_jhy_order b where b.order_no = #{orderId}) | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="selectTGRMobileByPhone" resultType="java.lang.String"> | 
 |  |  |  | 
 |  |  |         SELECT | 
 |  |  |             a.mobile_phone tgrPhone | 
 |  |  |         FROM | 
 |  |  |             xzx_user_share_info a | 
 |  |  |         WHERE  a.register_mobile_phone = #{mobilePhone} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | </mapper> |