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

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.PeriodEntity" id="periodMap">
        <result property="id" column="id"/>
        <result property="number" column="number"/>
        <result property="farmId" column="farm_id"/>
        <result property="pigstyId" column="pigsty_id"/>
        <result property="unitId" column="uint_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.PeriodVo">
        SELECT
          period.id,
          period.number,
          period.pigsty_id,
          pigsty.number pigsty_name,
          period.unit_id,
          unit.number unit_name
        FROM mgt_period period
        JOIN mgt_pigsty pigsty ON period.pigsty_id = pigsty.id
        JOIN mgt_unit unit ON period.unit_id = unit.id
        ${ew.customSqlSegment}
    </select>


</mapper>