|
@@ -107,7 +107,9 @@
|
|
|
g.goods_pic AS goodsPic,
|
|
|
m.member_name AS memberName,
|
|
|
p.NAME AS equName,
|
|
|
- r.label AS equComName
|
|
|
+ r.label AS equComName,
|
|
|
+ o.order_specs AS specId,
|
|
|
+ s.spec_name AS specName
|
|
|
FROM bt_order o
|
|
|
LEFT JOIN bt_spe s ON o.order_specs = s.id
|
|
|
LEFT JOIN bt_goods g ON o.order_goods_id = g.id
|
|
@@ -118,154 +120,67 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getStatisticMap" parameterType="hashMap" resultType="java.util.Map">
|
|
|
- select sum(num1) as todayNum,
|
|
|
- sum(num2) as exceptNum,
|
|
|
- sum(num3) as errMsgNum,
|
|
|
- sum(num4) as todayAmount,
|
|
|
- sum(num5) as sevenNum,
|
|
|
- sum(num6) as sevenAmount,
|
|
|
- sum(num7) as deviceNum,
|
|
|
- sum(num8) as yesterdayAmount,
|
|
|
- sum(num9) as lackDevice
|
|
|
- from (
|
|
|
- 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, 0 as num9 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="now != null">
|
|
|
- and o.create_time >= #{now, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="nextDay != null">
|
|
|
- and o.create_time <![CDATA[ <= ]]> #{nextDay, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="id != null">
|
|
|
- and o.order_equ_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, 0 as num8, 0 as num9 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="id != null">
|
|
|
- and o.order_equ_id = #{id}
|
|
|
- </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, 0 as num8, 0 as num9 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="id != null">
|
|
|
- and o.order_equ_id = #{id}
|
|
|
- </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, 0 as num8, 0 as num9 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="now != null">
|
|
|
- and o.create_time >= #{now, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="nextDay != null">
|
|
|
- and o.create_time <![CDATA[ <= ]]> #{nextDay, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="id != null">
|
|
|
- and o.order_equ_id = #{id}
|
|
|
- </if>
|
|
|
- and o.order_status='6'
|
|
|
- union
|
|
|
- select 0,0,0,0,count(1) as num5,0, 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})
|
|
|
- </if>
|
|
|
- <if test="orgIds == null ">
|
|
|
- where 1 = 1
|
|
|
- </if>
|
|
|
- <if test="sevenAgo != null">
|
|
|
- and o.create_time >= #{sevenAgo, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="now != null">
|
|
|
- and o.create_time <![CDATA[ <= ]]> #{now, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="id != null">
|
|
|
- and o.order_equ_id = #{id}
|
|
|
- </if>
|
|
|
- and o.order_status='1'
|
|
|
- union
|
|
|
- select 0,0,0,0,0,sum(o.order_amount) as num6, 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})
|
|
|
- </if>
|
|
|
- <if test="orgIds == null ">
|
|
|
- where 1 = 1
|
|
|
- </if>
|
|
|
- <if test="sevenAgo != null">
|
|
|
- and o.create_time >= #{sevenAgo, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="now != null">
|
|
|
- and o.create_time <![CDATA[ <= ]]> #{now, jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="id != null">
|
|
|
- and o.order_equ_id = #{id}
|
|
|
- </if>
|
|
|
- and o.order_status = '6'
|
|
|
- union
|
|
|
- select 0,0,0,0,0,0, count(p.id) as num7, 0, 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 , 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 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.order_equ_id = #{id}
|
|
|
- </if>
|
|
|
- and o.order_status = '6'
|
|
|
- union
|
|
|
- select 0,0,0,0,0,0, 0, 0, count(distinct p.id) from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
|
|
|
- where p.status = '1' and b.residue_warn>=b.mtr_residue
|
|
|
- <if test="id != null">
|
|
|
- and p.id = #{id}
|
|
|
- </if>
|
|
|
- <if test="orgIds != null and orgIds != ''">
|
|
|
- and p.org_id in (${orgIds})
|
|
|
- </if>
|
|
|
- ) f
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN create_time >= date_format(current_date(),'%Y-%m-%d') THEN
|
|
|
+ 1
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS todayNum,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN create_time >= date_format(current_date(),'%Y-%m-%d') THEN
|
|
|
+ order_amount
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS todayAmount,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN create_time >= date_format(current_date()-7,'%Y-%m-%d') THEN
|
|
|
+ 1
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS sevenNum,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN create_time >= date_format(current_date()-7,'%Y-%m-%d') THEN
|
|
|
+ order_amount
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS sevenAmount,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN order_status='4' THEN
|
|
|
+ 1
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS exceptNum,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN order_status='4' THEN
|
|
|
+ 1
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS errMsgNum,
|
|
|
+ SUM(
|
|
|
+ CASE
|
|
|
+ WHEN create_time >= date_format(current_date()-1,'%Y-%m-%d') THEN
|
|
|
+ order_amount
|
|
|
+ ELSE
|
|
|
+ 0
|
|
|
+ END
|
|
|
+ ) AS yesterdayAmount,
|
|
|
+ (SELECT COUNT(1) FROM imcs_tenant_productionresource p where p.status = '1') AS deviceNum,
|
|
|
+ 0 AS lackDevice
|
|
|
+ FROM
|
|
|
+ bt_order;
|
|
|
</select>
|
|
|
</mapper>
|