'123'
This commit is contained in:
parent
e7d6580e74
commit
61e74d35c8
|
@ -587,26 +587,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectHandleTime" resultType="String">
|
||||
select ROUND(sum(secDiff)/ 3600.00 /count(1), 2) diff from (
|
||||
select case when a.dayDiff = 0 then a.secDiff
|
||||
select a.quot_code,
|
||||
<!--询价时间不超过11:30 并且 报价时间超过13:00 报价时间-询价时间-1.5h -->
|
||||
case when a.dayDiff = 0 and a.secDiff1 <![CDATA[>=]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff1+a.secDiff2
|
||||
<!--询价时间超过11:30 并且 不超过13:00 并且 报价时间超过13:00 报价时间-1点 -->
|
||||
when a.dayDiff = 0 and a.secDiff1 <![CDATA[<]]> 0 and a.secDiff3 <![CDATA[<]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff2
|
||||
<!--报价时间不超过11:30 报价时间-询价时间-->
|
||||
<!--询价时间超过13:00 报价时间-询价时间 -->
|
||||
when a.dayDiff = 0 then a.secDiff
|
||||
<!--跨一天 减14个小时 -->
|
||||
when a.dayDiff = 1 then a.secDiff-14*3600
|
||||
when a.dayDiff > 1 then a.secDiff-(a.dayDiff-1)*24*3600
|
||||
<!--跨n,n>1天 减(n-1)*24个小时 -->
|
||||
when a.dayDiff <![CDATA[>]]> 1 then a.secDiff-(a.dayDiff-1)*24*3600
|
||||
else 0 end secDiff
|
||||
from (
|
||||
select quot_inquiry_date, quot_quotation_date,
|
||||
select quot_code,quot_inquiry_date, quot_quotation_date,
|
||||
<!-- 询价时间与11:30的差值 -->
|
||||
datediff(second,quot_inquiry_date,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '11:30:00')) secDiff1,
|
||||
<!-- 报价时间与13:00的差值 -->
|
||||
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_quotation_date,111) + ' ' + '13:00:00'),quot_quotation_date) secDiff2,
|
||||
<!-- 询价时间与13:00的差值 -->
|
||||
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '13:00:00'),quot_inquiry_date) secDiff3,
|
||||
datediff(day,quot_inquiry_date,quot_quotation_date) dayDiff,
|
||||
datediff(second,quot_inquiry_date,quot_quotation_date) secDiff
|
||||
from quot a
|
||||
<where>
|
||||
and quot_approval_status = '2' and quot_jsxz_approval_status='0'
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and datediff(d, quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and datediff(d, quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
|
||||
</if>
|
||||
</where>
|
||||
from quot a
|
||||
<where>
|
||||
and quot_approval_status = '2' and quot_jsxz_approval_status='0'
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and datediff(d, quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and datediff(d, quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
|
||||
</if>
|
||||
</where>
|
||||
)a
|
||||
)a
|
||||
)a
|
||||
</select>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue