<?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.huimv.management.dao.IndoorEnvironmentDao">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.IndoorEnvironmentEntity" id="indoorEnvironmentMap">
        <result property="id" column="id"/>
        <result property="pigstyId" column="pigsty_id"/>
        <result property="type" column="type"/>
        <result property="value" column="value"/>
        <result property="collectTime" column="collect_time"/>
        <result property="deleted" column="deleted"/>
        <result property="gmtCreate" column="gmt_create"/>
        <result property="gmtModified" column="gmt_modified"/>
    </resultMap>


    <select id="page" resultType="com.huimv.management.entity.vo.IndoorEnvironmentVo">
        SELECT
          env.id,
          env.farm_id,
          farm.name farmName,
          env.pigsty_id,
          pigsty.number pigstyName,
          env.type,
          env.value,
          env.collect_time
        FROM mgt_indoor_environment env
          JOIN mgt_farm farm ON env.farm_id = farm.id
          JOIN mgt_pigsty pigsty ON env.pigsty_id = pigsty.id
        ${ew.customSqlSegment}
    </select>


</mapper>