puzhibing
2023-03-11 b088628cf9be70c36e34032bb0d024548351541b
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml
@@ -8,7 +8,7 @@
        <result column="code" property="code" />
        <result column="userId" property="userId" />
        <result column="driverId" property="driverId" />
        <result column="source" property="source" />
        <result column="`source`" property="source" />
        <result column="agentId" property="agentId" />
        <result column="branchOfficeId" property="branchOfficeId" />
        <result column="startTime" property="startTime" />
@@ -27,7 +27,7 @@
        <result column="couponId" property="couponId" />
        <result column="payType" property="payType" />
        <result column="payTime" property="payTime" />
        <result column="state" property="state" />
        <result column="`state`" property="state" />
        <result column="status" property="status" />
        <result column="createTime" property="createTime" />
        <result column="startDistance" property="startLng" />
@@ -50,10 +50,58 @@
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, code, userId, driverId, source, agentId, branchOfficeId, startTime, startAddress, startLat, startLng, endAddress, endLat, endLng,
            boardingTime, getoffTime, estimatedPrice, orderMoney, payMoney, discountedPrice, couponId, payType, payTime, state, status, createTime,
        id, code, userId, driverId, `source`, agentId, branchOfficeId, startTime, startAddress, startLat, startLng, endAddress, endLat, endLng,
            boardingTime, getoffTime, estimatedPrice, orderMoney, payMoney, discountedPrice, couponId, payType, payTime, `state`, status, createTime,
            startDistance,startPrice,overDriveDistance,overDrivePrice,longDistance,longDistancePrice,overLongDistance,overLongDistancePrice,
waitTime,waitTimePrice,outWaitTime,outWaitTimePrice,badWeatherDistance,badWeatherPrice,overBadWeatherDistance,overBadWeatherPrice
    </sql>
    <sql id="Base_Column_Order">
        o.id, o.code, o.userId, o.driverId, o.`source`, o.agentId, o.branchOfficeId, o.startTime, o.startAddress, o.startLat, o.startLng, o.endAddress, o.endLat, o.endLng,
            o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime,
            o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice,
o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,a.nickname AS userName,
            a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone
    </sql>
    <select id="getOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
        select <include refid="Base_Column_Order"></include>
        from t_order o
        left join t_app_user a on o.userId = a.id
        left join t_driver d on o.driverId = d.id
        <where>
            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                AND o.createTime between #{startTime} and #{endTime}
            </if>
            <if test="code != null and code != ''">
                AND o.code LIKE concat('%',#{code},'%')
            </if>
            <if test="source != null">
                AND o.source = #{source}
            </if>
            <if test="userName != null and userName != ''">
                AND a.nickname LIKE concat('%',#{userName},'%')
            </if>
            <if test="userPhone != null and userPhone != ''">
                AND a.phone LIKE concat('%',#{userPhone},'%')
            </if>
            <if test="state != null">
                AND o.state = #{state}
            </if>
            <if test="driverName != null and driverName != ''">
                AND d.name LIKE concat('%',#{driverName},'%')
            </if>
            <if test="isException != null">
                AND a.is_exception = #{isException}
            </if>
            <if test="roleType != null and roleType == 2">
                AND o.branchOfficeId = #{objectId}
            </if>
            <if test="roleType != null and roleType == 3">
                AND o.agentId = #{objectId}
            </if>
        </where>
        ORDER BY o.createTime
    </select>
</mapper>