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

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.PigstyEntity" id="pigstyMap">
        <result property="id" column="id"/>
        <result property="number" column="number"/>
        <result property="farmId" column="farm_id"/>
        <result property="feederId" column="feeder_id"/>
        <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.PigStyVo">
        select
          pigsty.id,
          pigsty.number,
          pigsty.farm_id,
          employee.name feederName
        from mgt_pigsty pigsty
         JOIN mgt_farm farm ON pigsty.farm_id = farm.id
         JOIN mgt_employee employee ON pigsty.feeder_id = employee.id
          ${ew.customSqlSegment}
    </select>

</mapper>