<?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="org.jeecg.modules.warning.mapper.FzqkMapper">

    <select id="getWellData" parameterType="hashMap" resultType="org.jeecg.modules.warning.entity.ALLDModel">
        select * from
        (select jh, rq, js, dgfh, ly, zs, ckmd, ckdd, zctj, ckll
        from mv_azy01
        <where>
            <if test="jh != null and jh != ''">
                and jh = #{jh}
            </if>
            <if test="realTime != 'Y'.toString()">
                and js &lt;= #{js}
            </if>
        </where>
        order by js desc)
        where rownum &lt;= 20
        order by rownum desc
    </select>
    <select id="getAzj01ByJh" parameterType="Object" resultType="org.jeecg.modules.warning.entity.WellPosition">
        select * from mv_azj01 where jh = #{jh}
    </select>
    <select id="getHistoryData" parameterType="hashMap" resultType="org.jeecg.modules.warning.entity.ALLDModel">
        select a.jh,
        a.albh,
        a.js,
        a.dgfh,
        a.ly,
        a.zs,
        a.ckmd,
        a.ckdd,
        a.zctj,
        a.ckll,
        c.name mc
        from azy01 a
        left join jsra b
        on a.jh = b.jh
        and a.albh = b.sgxh
        left join Text_cl c
        on b.sglbid = c.id
        <if test="zbX!=null and zbY!=null">
            left join (select *
            from jjbxx
            where sqrt(power((sjjwzzbx - #{zbX}), 2) +
            power((sjjwhzby - #{zbY}), 2)) &lt; #{radius}) d
            on d.jh = a.jh
        </if>
        where c.name is not null
        <if test="zbX!=null and zbY!=null">
            and d.jh is not null
        </if>
        order by a.jh, albh, js
    </select>
</mapper>