puzhibing
2023-03-18 c0f0b2825ed3dbef86b381c2490277164446dc10
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
@@ -116,4 +116,60 @@
        left join t_app_user b on (a.userId = b.id)
        where a.id = #{orderId}
    </select>
    <select id="queryDriverOrderList" resultType="com.supersavedriving.driver.modular.system.warpper.DriverOrderListWarpper">
        select
        id,
        '超省新代驾订单' as title,
        UNIX_TIMESTAMP(createTime) * 1000 as createTime,
        startAddress,
        endAddress,
        state,
        source
        from t_order where status = 1 and driverId = #{driverId}
        <if test="null != state and 107 == state">
            and state = #{state}
        </if>
        <if test="null != state and 109 == state">
            and state in (108, 109)
        </if>
        <if test="null != state and 301 == state">
            and state = #{state}
        </if>
        order by createTime desc limit #{pageNum}, #{pageSize}
    </select>
    <select id="queryInviteList" resultType="com.supersavedriving.driver.modular.system.warpper.InviteListWarpper">
        select * from (
        select
        a.id,
        a.nickname,
        min(UNIX_TIMESTAMP(b.createTime) * 1000) as time,
        1 as type
        from t_app_user a
        left join t_order b on (a.id = b.userId)
        where a.`status` = 1 and a.inviterType = 2 and a.inviterId = #{driverId}
        <if test="null != time and '' != time">
            and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time}
        </if>
        group by a.id, a.nickname
        union all
        select
        a.id,
        a.`name`,
        min(UNIX_TIMESTAMP(b.createTime) * 1000) as time,
        2 as type
        from t_driver a
        left join t_order b on (a.id = b.driverId)
        where a.`status` = 1 and a.approvalStatus = 2 and a.inviterType = 2 and a.inviterId = #{driverId}
        <if test="null != time and '' != time">
            and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time}
        </if>
        group by a.id, a.`name`
        ) as aa where aa.time is not null order by aa.time desc limit #{pageNum}, #{pageSize}
    </select>
</mapper>