| <?xml version="1.0" encoding="UTF-8" ?> | 
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | 
| <mapper namespace="com.moral.mapper.OrganizationSensorUnitMapper" > | 
|   <resultMap id="BaseResultMap" type="com.moral.entity.OrganizationSensorUnit" > | 
|     <id column="id" property="id" jdbcType="INTEGER" /> | 
|     <result column="organization_id" property="organizationId" jdbcType="INTEGER" /> | 
|     <result column="sensor_unit_id" property="sensorUnitId" jdbcType="INTEGER" /> | 
|     <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | 
|     <association property="sensorUnit" javaType="com.moral.entity.SensorUnit"> | 
|       <id column="sensor_unit_id" property="id" jdbcType="INTEGER" /> | 
|       <result column="sut_sensor_id" property="sensorId" jdbcType="INTEGER" /> | 
|       <result column="sut_name" property="name" jdbcType="VARCHAR" /> | 
|       <result column="sut_rules" property="rules" jdbcType="VARCHAR" /> | 
|     </association> | 
|   </resultMap> | 
|   <sql id="Base_Column_List" > | 
|     id, organization_id, sensor_unit_id, create_time, update_time | 
|   </sql> | 
|   <select id="selectByOrgId" resultMap="BaseResultMap"> | 
|           SELECT  osu.*, | 
|           sut.sensor_id as sut_sensor_id, | 
|           sut.`name` as sut_name, | 
|           sut.`rules` as sut_rules | 
|           from organization_sensor_unit osu | 
|           left join sensor_unit sut on osu.sensor_unit_id = sut.id | 
|           where osu.organization_id = #{organizationId,jdbcType=INTEGER} | 
|   </select> | 
| </mapper> |