yanghb
2023-04-21 75a2623173bcc4a235aa1f99f7ef28519186160b
UserTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml
@@ -46,7 +46,6 @@
        <result column="longDistanceMoney" property="longDistanceMoney"/>
        <result column="parkMoney" property="parkMoney"/>
        <result column="roadTollMoney" property="roadTollMoney"/>
        <result column="holidayFee" property="holidayFee"/>
        <result column="redPacketMoney" property="redPacketMoney"/>
        <result column="couponMoney" property="couponMoney"/>
        <result column="redPacketId" property="redPacketId"/>
@@ -54,12 +53,8 @@
        <result column="discount" property="discount"/>
        <result column="discountMoney" property="discountMoney"/>
        <result column="activityId" property="activityId"/>
        <result column="taxiCardId" property="taxiCardId"/>
        <result column="userTaxiCardId" property="userTaxiCardId"/>
        <result column="discountAmount" property="discountAmount"/>
        <result column="companyId" property="companyId"/>
        <result column="payMoney" property="payMoney"/>
        <result column="thankYouFee" property="thankYouFee"/>
        <result column="substitute" property="substitute"/>
        <result column="passengers" property="passengers"/>
        <result column="passengersPhone" property="passengersPhone"/>
@@ -340,7 +335,6 @@
    <select id="queryMyOrderList" resultType="map">
        select
        id as orderId,
      rideType as rideType,
        DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as orderTime,
        DATE_FORMAT(travelTime, '%m月%d日 %H:%i') as time,
        startAddress as startAddress,
@@ -348,15 +342,14 @@
        driverId as driverId,
        (1) as orderType,
        state as state,
        oldState as oldState,
        thankYouFee
        oldState as oldState
        from t_order_private_car where userId = #{uid} order by insertTime desc limit #{pageNum}, #{size}
    </select>
    <select id="queryInvoiceOrder" resultType="map">
        select
        id as orderId,
        id as id,
        DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i') as time,
        startAddress as startAddress,
        endAddress as endAddress,
@@ -367,22 +360,16 @@
        (1) as orderType
        from t_order_private_car where state in (8, 9)
        <if test="type == 1">
            and (invoiceId is null or invoiceId in (select id from t_invoice where state = 3))
            and invoiceId is null and invoiceId in (select id from t_invoice where state != 2)
        </if>
        <if test="type == 2">
            and invoiceId in (select id from t_invoice where state = 2)
        </if>
        <if test="null != startTime">
            and travelTime >= #{startTime}
        <if test="null != startTime and null != endTime">
            and travelTime between #{startTime} and #{endTime}
        </if>
        <if test="null != startMoney">
            and payMoney >= #{startMoney}
        </if>
        <if test="null != endTime">
            and  #{endTime}>= travelTime
        </if>
        <if test="null != endMoney">
            and   #{endMoney}>=payMoney
        <if test="null != startMoney and null != endMoney">
            and payMoney between #{startMoney} and #{endMoney}
        </if>
        <if test="null !=uid">
            and userId = #{uid}
@@ -426,12 +413,9 @@
      a.payMoney as payMoney,
      a.reassignNotice as reassignNotice,
      a.oldState as oldState,
      a.rideType as rideType,
      a.pid as pid,
      b.headImgUrl as driverAvatar,
      b.`name` as driverName,
      c.carLicensePlate as licensePlate,
      a.peopleNum peopleNumber,a.driverCancle,
      c.carColor as carColor,
      CONCAT(f.`name`, d.`name`) as brand,
      ((select sum(fraction) from t_order_evaluate where driverId = a.driverId) / (select count(id) from t_order_evaluate where driverId = a.driverId)) as score,
@@ -449,13 +433,7 @@
      h.userType as cancelUserType,
      h.money as cancelMoney,
      h.reason as cancelReason,
      h.remark as cancelRemark,
      a.holidayFee,
      a.spellSuccess,
      a.waitRule,
      a.chargeRule,
      a.chargeRules,
      a.discountAmount as taxiCardMoney
      h.remark as cancelRemark
        from t_order_private_car a
      left join t_driver b on (a.driverId = b.id)
      left join t_car c on (a.carId = c.id)
@@ -564,85 +542,5 @@
        <foreach collection="state" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="queryOrderInfo2" resultType="map">
        select
        a.id as orderId,
        a.userId as userId,
        a.driverId as driverId,
        a.state as orderState,
        DATE_FORMAT(a.travelTime, '%m月%d日 %H:%i') as travelTime_,
        DATE_FORMAT(a.travelTime, '%Y-%m-%d %H:%i:%s') as travelTime,
        <choose>
            <when test="state==4">
                DATE_FORMAT(a.boardingTime, '%Y-%m-%d %H:%i:%s') as arriveTime,
            </when>
            <otherwise>
                DATE_FORMAT(a.getoffTime, '%Y-%m-%d %H:%i:%s') as arriveTime,
            </otherwise>
        </choose>
        a.startAddress as startAddress,
        a.endAddress as endAddress,
        a.startLon as startLon,
        a.startLat as startLat,
        a.endLon as endLon,
        a.endLat as endLat,
        a.orderMoney as orderMoney,
        a.payManner as payManner,
        a.thankYouFee,
        a.trackId as trackId,
        b.nickName as nickName,
        a.passengersPhone as phone,
        a.orderType as reservation,
        a.telX as telX,
        a.peopleNum as peopleNumber,
        a.bindId as bindId,
        (
        (select count(id) from t_order_private_car where userId = b.id and state in (8, 9)) +
        (select count(id) from t_order_taxi where userId = b.id and state in (8, 9)) +
        (select count(id) from t_order_cross_city where userId = b.id and state in (8, 9))
        ) as historyNum,
        (select phone from t_phone where companyId = a.companyId and `type` = 1) as emergencyCall,
        c.reason as cancelReason,
        c.remark as cancelRemark,
        c.money as cancelPayMoney,
        if(c.userType = 1, '用户取消', '平台取消') as cancelUser,
        (select isSpecialCar from t_sys_reformist where companyId = a.companyId) as reassign
        from t_order_private_car a
        left join t_user b on (a.userId = b.id)
        left join t_order_cancel c on (a.id = c.orderId and c.orderType = 1 and c.state = 2)
        where (a.id = #{orderId} or a.pid=#{orderId}) and a.state!=10
        <if test="state==4">
            order by a.insertTime
        </if>
        <if test="state==5">
            and 5>=a.state
            order by ROUND(
            6378.138 * 2 * ASIN(
            SQRT(
            POW(
            SIN((
            #{lat} * PI()/ 180-endLat * PI()/ 180
            )/ 2
            ),
            2
            )+ COS( #{lat} * PI()/ 180 )* COS( endLat * PI()/ 180 )* POW(
            SIN((
            #{lon} * PI()/ 180-endLon * PI()/ 180
            )/ 2
            ),
            2
            )))* 1000
            ) asc
        </if>
        <if test="state!=4 and state!=5">
            and a.state!=2
            and a.state!=3
            and a.state!=4
            and a.state!=5
            order by a.endServiceTime
        </if>
    </select>
</mapper>