|
@@ -124,9 +124,10 @@
|
|
|
sum(num4) as todayAmount,
|
|
|
sum(num5) as sevenNum,
|
|
|
sum(num6) as sevenAmount,
|
|
|
- sum(num7) as deviceNum
|
|
|
+ sum(num7) as deviceNum,
|
|
|
+ sum(num8) as yesterdayAmount
|
|
|
from (
|
|
|
- select count(1) as num1 ,0 as num2,0 as num3,0 as num4,0 as num5,0 as num6, 0 as num7 from bt_order o
|
|
|
+ select count(1) as num1 ,0 as num2,0 as num3,0 as num4,0 as num5,0 as num6, 0 as num7, 0 as num8 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
@@ -144,7 +145,7 @@
|
|
|
and o.id = #{id}
|
|
|
</if>
|
|
|
union
|
|
|
- select 0 as num1, count(1) as num2 ,0 as num3,0 as num4,0 as num5,0 as num6, 0 as num7 from bt_order o
|
|
|
+ select 0 as num1, count(1) as num2 ,0 as num3,0 as num4,0 as num5,0 as num6, 0 as num7, 0 as num8 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
@@ -157,7 +158,7 @@
|
|
|
</if>
|
|
|
and o.order_status='4'
|
|
|
union
|
|
|
- select 0 as num1,0 as num2,count(1) as num3,0 as num4,0 as num5,0 as num6, 0 as num7 from bt_order o
|
|
|
+ select 0 as num1,0 as num2,count(1) as num3,0 as num4,0 as num5,0 as num6, 0 as num7, 0 as num8 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
@@ -170,7 +171,7 @@
|
|
|
</if>
|
|
|
and o.order_status='4'
|
|
|
union
|
|
|
- select 0 as num1,0 as num2,0 as num3,sum(o.order_amount) as num4,0 as num5,0 as num6, 0 as num7 from bt_order o
|
|
|
+ select 0 as num1,0 as num2,0 as num3,sum(o.order_amount) as num4,0 as num5,0 as num6, 0 as num7, 0 as num8 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
@@ -182,13 +183,13 @@
|
|
|
and o.create_time >= #{now, jdbcType=TIMESTAMP}
|
|
|
</if>
|
|
|
<if test="nextDay != null">
|
|
|
- and o.create_time <![CDATA[ <= ]]> #{sevenAgo, jdbcType=TIMESTAMP}
|
|
|
+ and o.create_time <![CDATA[ <= ]]> #{nextDay, jdbcType=TIMESTAMP}
|
|
|
</if>
|
|
|
<if test="id != null">
|
|
|
and o.id = #{id}
|
|
|
</if>
|
|
|
union
|
|
|
- select 0,0,0,0,count(1) as num5,0, 0 from bt_order o
|
|
|
+ select 0,0,0,0,count(1) as num5,0, 0, 0 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
@@ -206,13 +207,13 @@
|
|
|
and o.id = #{id}
|
|
|
</if>
|
|
|
union
|
|
|
- select 0,0,0,0,0,sum(o.order_amount) as num6, 0 from bt_order o
|
|
|
+ select 0,0,0,0,0,sum(o.order_amount) as num6, 0, 0 from bt_order o
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
where p.org_id in (${orgIds})
|
|
|
</if>
|
|
|
<if test="orgIds == null ">
|
|
|
- where o.order_status = '1'
|
|
|
+ where 1 = 1
|
|
|
</if>
|
|
|
<if test="sevenAgo != null">
|
|
|
and o.create_time >= #{sevenAgo, jdbcType=TIMESTAMP}
|
|
@@ -223,14 +224,34 @@
|
|
|
<if test="id != null">
|
|
|
and o.id = #{id}
|
|
|
</if>
|
|
|
+ and o.order_status = '1'
|
|
|
union
|
|
|
- select 0,0,0,0,0,0, count(p.id) as num7 from imcs_tenant_productionresource p where p.status = '1'
|
|
|
+ select 0,0,0,0,0,0, count(p.id) as num7, 0 from imcs_tenant_productionresource p where p.status = '1'
|
|
|
<if test="id != null">
|
|
|
and p.id = #{id}
|
|
|
</if>
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
and p.org_id in (${orgIds})
|
|
|
</if>
|
|
|
+ union
|
|
|
+ select 0,0,0,0,0,0, 0, sum(o.order_amount) as num8 from bt_order o
|
|
|
+ <if test="orgIds != null and orgIds != ''">
|
|
|
+ left join imcs_tenant_productionresource p on o.order_equ_id = p.id
|
|
|
+ where p.org_id in (${orgIds})
|
|
|
+ </if>
|
|
|
+ <if test="orgIds == null ">
|
|
|
+ where 1 = 1
|
|
|
+ </if>
|
|
|
+ <if test="yesterday != null">
|
|
|
+ and o.create_time >= #{yesterday, jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="now != null">
|
|
|
+ and o.create_time <![CDATA[ <= ]]> #{now, jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="id != null">
|
|
|
+ and o.id = #{id}
|
|
|
+ </if>
|
|
|
+ and o.order_status = '1'
|
|
|
) f
|
|
|
</select>
|
|
|
|