|  |  |  | 
|---|
|  |  |  | <id column="id" property="id" /> | 
|---|
|  |  |  | <result column="name" property="name" /> | 
|---|
|  |  |  | <result column="mac" property="mac" /> | 
|---|
|  |  |  | <result column="guid" property="guid" /> | 
|---|
|  |  |  | <result column="operate_ids" property="operateIds" /> | 
|---|
|  |  |  | <result column="organization_id" property="organizationId" /> | 
|---|
|  |  |  | <result column="device_version_id" property="deviceVersionId" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <result column="is_delete" property="isDelete" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap id="querySpecialDeviceUnitAlarmInfoMap" type="com.moral.api.entity.SpecialDevice"> | 
|---|
|  |  |  | <id column="d.id" property="id"/> | 
|---|
|  |  |  | <result column="d.name" property="name"/> | 
|---|
|  |  |  | <result column="d.mac" property="mac"/> | 
|---|
|  |  |  | <result column="d.operate_ids" property="operateIds"/> | 
|---|
|  |  |  | <result column="d.monitor_point_id" property="monitorPointId"/> | 
|---|
|  |  |  | <result column="d.organization_id" property="organizationId"/> | 
|---|
|  |  |  | <result column="oua.version_id" property="deviceVersionId"/> | 
|---|
|  |  |  | <association property="version" column="d.device_version_id" javaType="com.moral.api.entity.Version"> | 
|---|
|  |  |  | <id column="v.id" property="id"></id> | 
|---|
|  |  |  | <result column="v.name" property="name"></result> | 
|---|
|  |  |  | <collection column="d.device_version_id" property="sensors" ofType="com.moral.api.entity.Sensor"> | 
|---|
|  |  |  | <result column="oua.sensor_code" property="code" ></result> | 
|---|
|  |  |  | <result column="oua.unit_key" property="unitKey"></result> | 
|---|
|  |  |  | <result column="oua.show_unit_key" property="showUnitKey"></result> | 
|---|
|  |  |  | <result column="oua.alarm_level" property="alarmLevel" javaType="String" ></result> | 
|---|
|  |  |  | </collection> | 
|---|
|  |  |  | </association> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="querySpecialDeviceUnitAlarmInfo" resultMap="querySpecialDeviceUnitAlarmInfoMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | d.id as `d.id`, | 
|---|
|  |  |  | d.mac as `d.mac`, | 
|---|
|  |  |  | d.name as `d.name`, | 
|---|
|  |  |  | d.operate_ids as `d.operate_ids`, | 
|---|
|  |  |  | d.organization_id as `d.organization_id`, | 
|---|
|  |  |  | oua.version_id as `oua.version_id`, | 
|---|
|  |  |  | oua.sensor_code as `oua.sensor_code`, | 
|---|
|  |  |  | oua.unit_key as `oua.unit_key`, | 
|---|
|  |  |  | oua.show_unit_key as `oua.show_unit_key`, | 
|---|
|  |  |  | oua.alarm_level as `oua.alarm_level`, | 
|---|
|  |  |  | v.id as `v.id`, | 
|---|
|  |  |  | v.name as `v.name` | 
|---|
|  |  |  | from | 
|---|
|  |  |  | special_device d | 
|---|
|  |  |  | join | 
|---|
|  |  |  | version v | 
|---|
|  |  |  | on | 
|---|
|  |  |  | v.`id` = d.`device_version_id` and v.`is_delete` = 0 | 
|---|
|  |  |  | join | 
|---|
|  |  |  | organization_unit_alarm oua | 
|---|
|  |  |  | on | 
|---|
|  |  |  | d.`device_version_id` = oua.`version_id`   and d.`organization_id` = oua.`organization_id` and oua.`is_delete` = 0 | 
|---|
|  |  |  | where | 
|---|
|  |  |  | d.`is_delete` = 0; | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectOrgByMac" resultType="com.moral.api.entity.Organization"> | 
|---|
|  |  |  | SELECT area_code, city_code | 
|---|
|  |  |  | FROM organization | 
|---|
|  |  |  | WHERE id = (SELECT organization_id FROM special_device WHERE mac = #{mac}) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|