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

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.DeviceEntity" id="deviceMap">
        <result property="deviceId" column="device_id"/>
        <result property="farmId" column="farm_id"/>
        <result property="pigstyId" column="pigsty_id"/>
        <result property="deleted" column="deleted"/>
        <result property="gmtCreate" column="mgt_create"/>
        <result property="gmtModified" column="mgt_modified"/>
    </resultMap>

    <select id="page" resultType="com.huimv.management.entity.vo.DeviceVo">
        SELECT
          device_id,
          device.farm_id,
          name farm_name,
          pigsty_id,
          number pigsty_name
        FROM
          mgt_device device
        LEFT JOIN mgt_farm farm ON device.farm_id = farm.id
        LEFT JOIN mgt_pigsty pigsty ON device.pigsty_id = pigsty.id
        ${ew.customSqlSegment}
    </select>


</mapper>