<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.stylefeng.guns.modular.system.dao.TCancelOrderMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCancelOrder">
|
<id column="id" property="id" />
|
<result column="orderId" property="orderId" />
|
<result column="userType" property="userType" />
|
<result column="userId" property="userId" />
|
<result column="cause" property="cause" />
|
<result column="status" property="status" />
|
<result column="createTime" property="createTime" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, orderId, userType, userId, cause, status, createTime
|
</sql>
|
|
<sql id="Base_Column_Order">
|
co.id, co.orderId, co.userType, co.userId, co.cause, co.status, co.createTime,o.code, o.`source`, o.startAddress, o.endAddress,o.createTime AS placeTime,
|
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="orderExceptionList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
|
select
|
o.id,
|
o.createTime,
|
o.code,
|
o.source,
|
o.startTime,
|
o.userName,
|
o.userPhone,
|
o.startAddress,
|
o.endAddress,
|
d.name as driverName,
|
d.phone as driverPhone,
|
o.estimatedPrice,
|
a.cancelCount,
|
o.state,
|
a.status AS userStatus
|
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>
|
a.cancelCount >= 3
|
<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="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>
|
|
|
|
<select id="getCancelOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
|
select <include refid="Base_Column_Order"></include>
|
from t_cancel_order co
|
left join t_order o on co.orderId = o.id
|
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 co.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="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 co.createTime
|
</select>
|
<select id="userCancelOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
|
select co.createTime,o.code,o.startAddress,o.endAddress
|
from t_cancel_order co
|
left join t_order o on co.orderId = o.id
|
<where>
|
<if test="userId != null">
|
AND co.userId = #{userId}
|
</if>
|
<if test="orderId != null">
|
AND co.orderId = #{orderId}
|
</if>
|
AND co.userType = 1
|
</where>
|
ORDER BY co.createTime DESC
|
</select>
|
|
</mapper>
|