<?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.TOrderTapeMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TOrderTape">
|
<id column="id" property="id" />
|
<result column="orderId" property="orderId" />
|
<result column="orderType" property="orderType" />
|
<result column="fileLink" property="fileLink" />
|
<result column="fileName" property="fileName" />
|
<result column="fileFormat" property="fileFormat" />
|
<result column="fileSize" property="fileSize" />
|
<result column="afterTime" property="afterTime" />
|
<result column="insertTime" property="insertTime" />
|
<result column="isDelete" property="isDelete" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id,orderId,orderType,fileLink,fileName,fileFormat,fileSize,afterTime,insertTime,isDelete
|
</sql>
|
<select id="getOrderTapeList" resultType="java.util.Map">
|
SELECT tot.id,tot.orderId,tot.orderType,tot.fileLink,tot.fileName,tot.fileFormat,tot.fileSize,tot.afterTime,tot.insertTime,tot.isDelete,o.orderNum,
|
(case when tot.afterTime <= now() then 2 when tot.afterTime >= now() then 1 end) as state
|
from t_order_tape tot
|
LEFT JOIN
|
(
|
SELECT id,orderNum,isDelete,1 as orderType from t_order_private_car
|
UNION ALL
|
SELECT id,orderNum,isDelete,3 as orderType from t_order_cross_city
|
UNION ALL
|
SELECT id,orderNum,isDelete,7 as orderType from t_order_transfer
|
) o
|
on tot.orderId = o.id
|
where tot.isDelete = 1 and o.isDelete = 1 and tot.orderType = o.orderType
|
<if test="beginTime != null and endTime != null">
|
and tot.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')
|
</if>
|
<if test="fileName != null and fileName != ''">
|
and tot.fileName like concat('%',#{fileName},'%')
|
</if>
|
<if test="orderNum != null and orderNum != ''">
|
and o.orderNum like concat('%',#{orderNum},'%')
|
</if>
|
<if test="state != null and state == 1">
|
and tot.afterTime >= now()
|
</if>
|
<if test="state != null and state == 2">
|
and tot.afterTime <= now()
|
</if>
|
</select>
|
|
</mapper>
|