<!--根据公司ID获取旗下全部楼宇.--><resultMapid="BuildingByCompanyMap"type="com.bootdo.tank.domain.ChemistryTankVO"><idcolumn="ID"property="id"jdbcType="BIGINT"/><resultcolumn="TANK_NAME"property="tankName"jdbcType="VARCHAR"/><resultcolumn="TANK_CODE"property="tankCode"jdbcType="VARCHAR"/><collectionproperty="tankValueDOList"javaType="java.util.ArrayList"ofType="com.bootdo.tank.domain.TankValueDO"select="getTankValue"column="{id = id}"/></resultMap><selectid="getTankRealTimeValue"resultMap="BuildingByCompanyMap">
SELECT
ID,
TANK_NAME,
TANK_CODE
FROM
gds_tank_management
WHERE
CREATE_COMPANY_ID =#{companyId}//自己的条件
</select><selectid="getTankValue"resultType="com.bootdo.tank.domain.TankValueDO">
SELECT
m.equipmentId,
m.levels,
m.equipment_type,
MAX(m.id) id
FROM
(
SELECT DISTINCT
equipmentId,
id,
levels,
equipment_type
FROM
hxl_real_time_date_new
WHERE
equipmentId = #{id}
AND equipment_type IS NOT NULL
ORDER BY
id DESC
) m
GROUP BY
m.equipment_type
</select>
```在 column="{id = id}" 单个条件可以直接写:column=" id"
多条件 column="{id = id,name=name}" id =id 第一个是子查询 的传入值 也就是#{值}里的值 第二个是 上级查询查出的值 id