26 lines
1.0 KiB
XML
26 lines
1.0 KiB
XML
|
<?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.hcy.common.mapper.client.ClientMapper">
|
||
|
<!-- 通用查询映射结果 -->
|
||
|
<resultMap id="BaseResultMap" type="com.hcy.common.entity.client.Client">
|
||
|
</resultMap>
|
||
|
|
||
|
<select id="clientEquipmentList" resultType="com.hcy.common.dto.largeDataDto.ClientLargeDataDto">
|
||
|
SELECT
|
||
|
c.client_no,c.client_name,COUNT(e.client_id) AS equipmentCount,
|
||
|
SUM(CASE WHEN e.device_status = 1 THEN 1 ELSE 0 END) AS normalCount,
|
||
|
SUM(CASE WHEN e.device_status = 2 THEN 1 ELSE 0 END) AS underOverhaulCount,
|
||
|
SUM(CASE WHEN e.device_status = 3 THEN 1 ELSE 0 END) AS underWarrantyCount
|
||
|
FROM
|
||
|
la_client as c
|
||
|
JOIN
|
||
|
la_equipment as e ON e.client_id = c.id
|
||
|
where c.is_delete = 0 and e.is_delete = 0
|
||
|
GROUP BY
|
||
|
c.id
|
||
|
ORDER BY
|
||
|
equipmentCount DESC
|
||
|
LIMIT 5;
|
||
|
</select>
|
||
|
</mapper>
|