28 lines
1.1 KiB
XML
28 lines
1.1 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.EquipmentMapper">
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.hcy.common.entity.client.Equipment">
|
|
</resultMap>
|
|
|
|
<select id="provinceEquipment" resultType="com.hcy.common.dto.largeDataDto.ClientLargeDataDto">
|
|
SELECT
|
|
dr.name as province,
|
|
COUNT( e.province_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_equipment AS e
|
|
JOIN la_dev_region as dr on e.province_id = dr.id
|
|
where
|
|
e.is_delete = 0
|
|
GROUP BY
|
|
e.province_id
|
|
ORDER BY
|
|
equipmentCount DESC
|
|
LIMIT 5;
|
|
|
|
</select>
|
|
</mapper>
|