CASE WHEN COUNT(*) = 0 THEN 0 ELSE ROUND((COUNT(CASE WHEN ci.next_inspection_date <![CDATA[<]]> now() THEN 1 END) * 100.0 / COUNT(*)), 2) END AS expiredRate
CASE WHEN COUNT(*) = 0 THEN 0 ELSE ROUND((COUNT(CASE WHEN ci.next_inspection_date <![CDATA[<=]]> now() THEN 1 END) * 100.0 / COUNT(*)), 2) END AS expiredRate
FROM
FROM
"tz_cylinder_inspection" ci
"tz_cylinder_inspection" ci
LEFT JOIN tz_cylinder_unit cu on ci.app_id = cu.app_id
LEFT JOIN tz_cylinder_unit cu on ci.app_id = cu.app_id
<where>
<where>
cu.unit_status = '1210'
<iftest="regionCode != null and regionCode != ''">
<iftest="regionCode != null and regionCode != ''">
cu.region_code like concat('%', #{regionCode}, '%')
and cu.region_code like concat('%', #{regionCode}, '%')
</if>
</if>
<iftest="appId != null and appId != ''">
<iftest="appId != null and appId != ''">
cu.app_id = #{appId}
and cu.app_id = #{appId}
</if>
</if>
</where>
</where>
</select>
</select>
...
@@ -42,11 +60,12 @@
...
@@ -42,11 +60,12 @@
"tz_cylinder_inspection" ci
"tz_cylinder_inspection" ci
LEFT JOIN tz_cylinder_unit cu on ci.app_id = cu.app_id
LEFT JOIN tz_cylinder_unit cu on ci.app_id = cu.app_id
<where>
<where>
cu.unit_status = '1210'
<iftest="regionCode != null and regionCode != ''">
<iftest="regionCode != null and regionCode != ''">
cu.region_code like concat('%', #{regionCode}, '%')
and cu.region_code like concat('%', #{regionCode}, '%')
select count(1) from tz_cylinder_filling_check r where date_format(r.inspection_date,'%Y-%m-%d') = date_format(#{time},'%Y-%m-%d') and app_id = #{appId}
select count(1) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m-%d') = date_format(#{time},'%Y-%m-%d') and app_id = #{appId}