<?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.DrinkingWaterDao">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.DrinkingWaterEntity" id="drinkingWaterMap">
        <result property="id" column="id"/>
        <result property="date" column="date" />
        <result property="farmId" column="farm_id" />
        <result property="pigstyId" column="pigsty_id"/>
        <result property="drinkingWaterQuality" column="drinking_water_quality"/>
        <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.DrinkingWaterVo">
        SELECT
          water.id,
          water.date,
          water.farm_id,
          farm.name farmName,
          water.pigsty_id,
          pigsty.number pigstyName,
          water.drinking_water_quality,
          water.collect_time
        FROM mgt_drinking_water water
          JOIN mgt_farm farm ON water.farm_id = farm.id
          JOIN mgt_pigsty pigsty ON water.pigsty_id = pigsty.id
        ${ew.customSqlSegment}
    </select>


</mapper>