<?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.uml.tech.njhyMapper.FarmWorkNjhyMapper">

    <select id="selectWorkTask" resultType="com.uml.tech.bean.FarmWorkTask">
        SELECT a.task_id, DATE_FORMAT(a.start_time,'%Y%m%d%H%i%s') start_time,DATE_FORMAT(a.end_time,'%Y%m%d%H%i%s') end_time, a.land_id, b.land_polygon
        from sys_work_task a
                 join sys_landinfo b on a.land_id = b.land_id
        where
         <![CDATA[
              start_time < ${jobStartTime}
          and end_time > ${jobStartTime}
          and ABS(max_lon + min_lon - ${leftLon} - ${rightLon}) <
              (ABS(max_lon - min_lon) + ABS(${leftLon} - ${rightLon}))
          and ABS(max_lat + min_lat - ${topLat} - ${bottomLat}) <
              (ABS(max_lat - min_lat) + ABS(${topLat} - ${bottomLat}))
        ]]>

    </select>
</mapper>
