于紫祥_1901
2020-08-12 ad89f4965a05d37aeea1481c4ab53e21ab85ca2f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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>