guyue
3 天以前 0fc5865ab5f1df62cb948fbb97c2207b5bd855f9
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml
@@ -259,4 +259,171 @@
        SELECT  IFNULL(amount,0) amount,b.`name`  FROM  t_order_additional_fee a   LEFT JOIN t_additional_fee b ON a.additionalFeeId=b.id  WHERE a.orderId=#{id} AND a.orderType=#{orderType} AND a.id>1 AND amount>0
    </select>
    <select id="promotionInfo" resultType="java.util.Map">
select  * from (
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_private_car t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        union all
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_taxi t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        union all
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_cross_city t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        ) as t5 order by t5.successTime desc
    </select>
    <select id="promotionInfoExport" resultType="java.util.Map">
        select  * from (
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_private_car t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        union all
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_taxi t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        union all
        select t1.orderNum,t1.promotionMoney,t1.successTime,t1.payMoney money,t2.activityTitle name,t3.name driverName,t4.nickName userName
        from t_order_cross_city t1
        LEFT JOIN t_driver_promotion_activity t2 ON t1.promotionActivityId = t2.id
        LEFT JOIN t_driver t3 ON t1.promotionDriverId = t3.id
        LEFT JOIN t_user t4 ON t1.userId = t4.id
        where t1.promotionActivityId is not null
        <if test="orderNum != null and orderNum != ''">
            and t1.orderNum  =#{orderNum}
        </if>
        <if test="beginTime != null and endTime != null">
            and t1.successTime  between #{beginTime} and #{endTime}
        </if>
        <if test="userName != null and userName != ''">
            and t4.nickName  like CONCAT('%',#{userName},'%')
        </if>
        <if test="name != null and name != ''">
            and t2.activityTitle  like CONCAT('%',#{name},'%')
        </if>
        <if test="driverName != null and driverName != ''">
            and t3.name  like CONCAT('%',#{driverName},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType != 1">
            and t1.companyId = #{objectId}
        </if>
        ) as t5 order by t5.successTime desc
    </select>
</mapper>