Compare commits
3 Commits
d5125993c0
...
0ea29f9ceb
| Author | SHA1 | Date |
|---|---|---|
|
|
0ea29f9ceb | |
|
|
7393716069 | |
|
|
e48b2c58bf |
|
|
@ -17,6 +17,7 @@ public class DeptEquipmentConfig extends BaseEntity {
|
||||||
private String equipmentId;
|
private String equipmentId;
|
||||||
private List<ConfigEntity> configs;
|
private List<ConfigEntity> configs;
|
||||||
private String configStatus;
|
private String configStatus;
|
||||||
|
private String jijuType;
|
||||||
|
|
||||||
@Excel(name = "配置值")
|
@Excel(name = "配置值")
|
||||||
private String configValue;
|
private String configValue;
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@
|
||||||
config_value,
|
config_value,
|
||||||
config_rate,
|
config_rate,
|
||||||
config_description,
|
config_description,
|
||||||
|
jiju_type,
|
||||||
remark
|
remark
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
@ -75,6 +76,7 @@
|
||||||
#{item.basicConfig},
|
#{item.basicConfig},
|
||||||
#{item.configurationRate},
|
#{item.configurationRate},
|
||||||
#{item.configurationDescription},
|
#{item.configurationDescription},
|
||||||
|
#{jijuType},
|
||||||
#{remark}
|
#{remark}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
|
|
@ -99,16 +99,44 @@
|
||||||
mt.type_id AS equipmentId,
|
mt.type_id AS equipmentId,
|
||||||
mt2.type_name AS equipmentName,
|
mt2.type_name AS equipmentName,
|
||||||
mt.type_name AS equipmenttype,
|
mt.type_name AS equipmenttype,
|
||||||
|
mt.jiju_type as jijuType,
|
||||||
CASE
|
CASE
|
||||||
WHEN MAX(mdc.config_value) IS NOT NULL AND MAX(mdc.config_value) != '' THEN '已配置'
|
|
||||||
ELSE '未配置'
|
WHEN MAX( mdc.config_value ) IS NOT NULL
|
||||||
|
AND MAX( mdc.config_value ) != '' THEN
|
||||||
|
'已配置' ELSE '未配置'
|
||||||
END AS configStatus
|
END AS configStatus
|
||||||
FROM ma_type mt
|
FROM
|
||||||
|
ma_type mt
|
||||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
LEFT JOIN ma_dept_config mdc
|
LEFT JOIN ma_dept_config mdc ON mdc.type_id = mt.type_id
|
||||||
ON mdc.type_id = mt.type_id
|
|
||||||
AND mdc.dept_id = #{deptId}
|
AND mdc.dept_id = #{deptId}
|
||||||
WHERE mt.level = 3
|
WHERE
|
||||||
|
mt.LEVEL =5
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id,
|
||||||
|
mt2.type_name,
|
||||||
|
mt.type_name
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
mt.type_id AS equipmentId,
|
||||||
|
mt2.type_name AS equipmentName,
|
||||||
|
mt.type_name AS equipmenttype,
|
||||||
|
mt.jiju_type as jijuType,
|
||||||
|
CASE
|
||||||
|
|
||||||
|
WHEN MAX( mdc.config_value ) IS NOT NULL
|
||||||
|
AND MAX( mdc.config_value ) != '' THEN
|
||||||
|
'已配置' ELSE '未配置'
|
||||||
|
END AS configStatus
|
||||||
|
FROM
|
||||||
|
tool_type mt
|
||||||
|
LEFT JOIN tool_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN ma_dept_config mdc ON mdc.type_id = mt.type_id
|
||||||
|
AND mdc.dept_id = #{deptId}
|
||||||
|
WHERE
|
||||||
|
mt.LEVEL =4
|
||||||
<if test="equipmentName != null and equipmentName != ''">
|
<if test="equipmentName != null and equipmentName != ''">
|
||||||
AND mt.type_name LIKE CONCAT('%', #{equipmentName}, '%')
|
AND mt.type_name LIKE CONCAT('%', #{equipmentName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -159,6 +187,7 @@
|
||||||
SUM(config_value) AS config_value,
|
SUM(config_value) AS config_value,
|
||||||
SUM(if(config_rate='/',0,config_rate)) AS config_rate
|
SUM(if(config_rate='/',0,config_rate)) AS config_rate
|
||||||
FROM ma_dept_config
|
FROM ma_dept_config
|
||||||
|
where jiju_type =1
|
||||||
GROUP BY dept_id, type_id, config_type
|
GROUP BY dept_id, type_id, config_type
|
||||||
) grouped
|
) grouped
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = grouped.dept_id
|
LEFT JOIN sys_dept sd ON sd.dept_id = grouped.dept_id
|
||||||
|
|
@ -168,8 +197,8 @@
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
sd.dept_id AS dept_id,
|
sd.dept_id AS dept_id,
|
||||||
mt2.type_id AS parent_type_id,
|
mt.type_id AS parent_type_id,
|
||||||
COUNT(md.ma_id) AS order_count
|
COUNT(md.num) AS order_count
|
||||||
FROM
|
FROM
|
||||||
ma_order_details md
|
ma_order_details md
|
||||||
LEFT JOIN ma_order_info moi ON md.order_id = moi.order_id
|
LEFT JOIN ma_order_info moi ON md.order_id = moi.order_id
|
||||||
|
|
@ -177,10 +206,56 @@
|
||||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
LEFT JOIN sys_dept sd ON moi.buyer_company = sd.dept_id
|
LEFT JOIN sys_dept sd ON moi.buyer_company = sd.dept_id
|
||||||
GROUP BY sd.dept_id, mt2.type_id
|
where devType =0
|
||||||
|
GROUP BY sd.dept_id, mt.type_id
|
||||||
) order_stat
|
) order_stat
|
||||||
ON order_stat.dept_id = grouped.dept_id
|
ON order_stat.dept_id = grouped.dept_id
|
||||||
AND order_stat.parent_type_id = grouped.type_id
|
AND order_stat.parent_type_id = grouped.type_id
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
my.type_name AS deptName,
|
||||||
|
my.type_id AS typeId,
|
||||||
|
sd.dept_name AS companyName,
|
||||||
|
grouped.dept_id AS companyId,
|
||||||
|
grouped.config_type AS configType,
|
||||||
|
grouped.config_value AS configValue,
|
||||||
|
if(grouped.config_rate='/',0,grouped.config_rate) AS configRate,
|
||||||
|
IFNULL(order_stat.order_count, 0) AS orderCount
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
dept_id,
|
||||||
|
type_id,
|
||||||
|
config_type,
|
||||||
|
SUM(config_value) AS config_value,
|
||||||
|
SUM(if(config_rate='/',0,config_rate)) AS config_rate
|
||||||
|
FROM ma_dept_config
|
||||||
|
where jiju_type =2
|
||||||
|
GROUP BY dept_id, type_id, config_type
|
||||||
|
) grouped
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = grouped.dept_id
|
||||||
|
LEFT JOIN tool_type my ON my.type_id = grouped.type_id
|
||||||
|
|
||||||
|
-- 设备订单数量子查询
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
sd.dept_id AS dept_id,
|
||||||
|
mt.type_id AS parent_type_id,
|
||||||
|
COUNT(md.num) AS order_count
|
||||||
|
FROM
|
||||||
|
ma_order_details md
|
||||||
|
LEFT JOIN ma_order_info moi ON md.order_id = moi.order_id
|
||||||
|
LEFT JOIN ma_dev_info mdi ON md.ma_id = mdi.ma_id
|
||||||
|
LEFT JOIN tool_type mt ON mdi.type_id = mt.type_id
|
||||||
|
LEFT JOIN tool_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN sys_dept sd ON moi.buyer_company = sd.dept_id
|
||||||
|
where devType =1
|
||||||
|
GROUP BY sd.dept_id, mt.type_id
|
||||||
|
) order_stat
|
||||||
|
ON order_stat.dept_id = grouped.dept_id
|
||||||
|
AND order_stat.parent_type_id = grouped.type_id;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptConfigTypeSummary" resultType="com.bonus.material.equipment.domain.DeptConfigTypeSummary">
|
<select id="selectDeptConfigTypeSummary" resultType="com.bonus.material.equipment.domain.DeptConfigTypeSummary">
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
SELECT
|
SELECT
|
||||||
md.on_company AS companyId,
|
md.on_company AS companyId,
|
||||||
sd.dept_name as companyName,
|
sd.dept_name as companyName,
|
||||||
mt2.type_name AS maName,
|
mt.type_name AS maName,
|
||||||
mt2.type_id as typeId,
|
|
||||||
|
mt.type_id as typeId,
|
||||||
COUNT(*) AS maNum
|
COUNT(*) AS maNum
|
||||||
FROM
|
FROM
|
||||||
ma_dev_info md
|
ma_dev_info md
|
||||||
|
|
@ -104,7 +105,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
md.is_active = '1'
|
md.is_active = '1'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
md.on_company,
|
md.on_company,
|
||||||
mt2.type_id
|
mt.type_id
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
md.company_id AS companyId,
|
||||||
|
sd.dept_name as companyName,
|
||||||
|
mt2.type_name AS maName,
|
||||||
|
|
||||||
|
mt2.type_id as typeId,
|
||||||
|
COUNT(*) AS maNum
|
||||||
|
FROM
|
||||||
|
tool_ledger md
|
||||||
|
LEFT JOIN tool_type mt ON mt.type_id = md.type_id
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = md.company_id
|
||||||
|
LEFT JOIN tool_type mt2 on mt.parent_id = mt2.type_id
|
||||||
|
WHERE
|
||||||
|
md.`status` in (0,1,2)
|
||||||
|
GROUP BY
|
||||||
|
md.company_id,
|
||||||
|
mt2.type_id;
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue