puzhibing
2023-04-07 eaa20cb58afc80e3612fd6e93d6f27e181a027e7
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml
@@ -58,6 +58,7 @@
        <result column="startWaitTime" property="startWaitTime"/>
        <result column="state" property="state" />
        <result column="oldState" property="oldState"/>
        <result column="isInvoice" property="isInvoice"/>
        <result column="status" property="status" />
        <result column="createTime" property="createTime" />
    </resultMap>
@@ -74,6 +75,7 @@
        a.endAddress,
        a.endLat,
        a.endLng,
        b.id as driverId,
        b.avatar as driverAvatar,
        b.`name` as driverName,
        b.phone as driverPhone,
@@ -81,9 +83,48 @@
        (DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y')) as driverAge,
        (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber,
        b.score as driverScore,
        a.state
        a.state,
        UNIX_TIMESTAMP(a.createTime) * 1000 as createTime,
        c.score as evaluationScore,
        c.evaluate as evaluationContent
        from t_order a
        left join t_driver b on (a.driverId = b.id)
        left join t_evaluate c on (a.id = c.orderId)
        where a.id = #{orderId}
    </select>
    <select id="queryMyOrder" resultType="com.supersavedriving.user.modular.system.warpper.OrderListWarpper">
        select
        id,
        '超省新代驾' as title,
        startAddress,
        endAddress,
        state,
        UNIX_TIMESTAMP(createTime) * 1000 as createTime
        from t_order
        where `status` = 1 and userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize}
    </select>
    <select id="queryNotInvoiceOrder" resultType="com.supersavedriving.user.modular.system.warpper.OrderListWarpper">
        select
        id,
        '超省新代驾' as title,
        startAddress,
        endAddress,
        state,
        UNIX_TIMESTAMP(createTime) * 1000 as createTime,
        payMoney as amount
        from t_order
        where `status` = 1 and isInvoice != 1 and state in (108, 109) and userId = #{uid}
        <if test="null != notInvoiceOrder.startTime and '' != notInvoiceOrder.startTime and null != notInvoiceOrder.endTime and '' != notInvoiceOrder.endTime">
            and DATE_FORMAT(createTime, '%Y-%m-%d') between #{notInvoiceOrder.startTime} and #{notInvoiceOrder.endTime}
        </if>
        <if test="null != notInvoiceOrder.startAmount and null != notInvoiceOrder.endAmount">
            and payMoney between #{notInvoiceOrder.startAmount} and #{notInvoiceOrder.endAmount}
        </if>
        order by createTime desc limit #{notInvoiceOrder.pageNum}, #{notInvoiceOrder.pageSize}
    </select>
</mapper>