hanfucheng 10 months ago
parent
commit
ef32e34d28

+ 2 - 1
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionViewMapper.xml

@@ -8,7 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
         select
             a.enterprise_name enterpriseName,
             a.enterprise_name enterpriseName,
             IFNULL(sum( CASE WHEN state = 'state_4' THEN 1 ELSE 0 END ),0) inUse,
             IFNULL(sum( CASE WHEN state = 'state_4' THEN 1 ELSE 0 END ),0) inUse,
-            IFNULL(sum( CASE WHEN state != 'state_4' THEN 1 ELSE 0 END ),0) toUse
+            IFNULL(sum( CASE WHEN state != 'state_4' THEN 1 ELSE 0 END ),0) toUse,
+            IFNULL(round(IFNULL(sum( CASE WHEN state = 'state_4' THEN 1 ELSE 0 END ),0)/IFNULL(sum( CASE WHEN state != 'state_4' THEN 1 ELSE 0 END ),0),2),0) useRate
         from centerdata_t_housingconstruction_enterprise a
         from centerdata_t_housingconstruction_enterprise a
         left join centerdata_t_housingconstruction_steelcylinder b on a.id = b.enterprise_id
         left join centerdata_t_housingconstruction_steelcylinder b on a.id = b.enterprise_id
         LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
         LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id