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

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.WarningInfoEntity" id="warningInfoMap">
        <result property="id" column="id"/>
        <result property="nowDate" column="now_date"/>
        <result property="farmId" column="farm_id"/>
        <result property="pigstyId" column="pigsty_id"/>
        <result property="unitId" column="unit_id" />
        <result property="earTag" column="ear_tag" />
        <result property="warningType" column="warning_type"/>
        <result property="nowValue" column="now_value"/>
        <result property="warningTime" column="warning_time"/>
        <result property="verifyStatus" column="verify_status"/>
        <result property="verifyUser" column="verify_user"/>
    </resultMap>


    <select id="page" resultType="com.huimv.management.entity.vo.WarningInfoVo">
        SELECT
          warn.id,
          warn.now_date,
          warn.farm_id,
          farm.name farm_name,
          warn.pigsty_id,
          pigsty.number pigsty_name,
          warn.unit_id,
          unit.number unit_name,
          warn.ear_tag,
          warn.warning_type,
          warn.belong_to,
          warn.now_value,
          warn.warning_time,
          warn.verify_user,
          warn.verify_description,
          warn.verify_time
        FROM mgt_warning_info warn
        LEFT JOIN mgt_farm farm ON warn.farm_id = farm.id
        LEFT JOIN mgt_pigsty pigsty ON warn.pigsty_id = pigsty.id
        LEFT JOIN mgt_unit unit ON warn.unit_id = unit.id
        ${ew.customSqlSegment}
    </select>


</mapper>