CASE WHEN (ISNULL(fe.position3d) || LENGTH(trim(fe.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fe.position3d,',', 1),',"y":',substring_index(substring_index(fe.position3d,',', -2), ',', 1),',"z":',substring_index(fe.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE fe.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fe.floor3d,'"}') config,
fe.create_date,
NOW(),
fe.create_by,
fe.create_by,
'\0' is_delete,
null data_level,
fe.`code` data_code,
(select GROUP_CONCAT(cast(eq.`name` as char(50)) SEPARATOR ',') from f_equipment_fire_equipment fre join f_equipment eq on fre.equipment_id = eq.id where fre.fire_equipment_id = fe.id) protect_obj_name,
null route_name,
0 frequency
from f_fire_equipment fe
where
<choose>
<whentest="feId !=null">
fe.id = #{feId}
</when>
<otherwise>
fe.equip_classify in (0,2,3) and not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type in ('fireEquipment','video','monitorEquipment') and bn.oid = fe.`id`) ;