Newer
Older
huludao / src / main / resources / mapper / WaterQualityAndHydrologyMapper.xml
<?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.newfiber.api.pc.dao.WaterQualityAndHydrologyMapper">

    <resultMap id="acceptAllotMap" type="com.newfiber.api.pc.model.entity.WaterQualityAndHydrology">
        <result property="blackId" column="blackId"/>
        <result property="watermeter" column="watermeter"/>
        <result property="stCode" column="stCode"/>
        <result property="value" column="value"/>
        <result property="siteNoStatus" column="siteNoStatus"/>
        <result property="watermeterStatus" column="watermeterStatus"/>
        <result property="blackRiverName" column="blackRiverName"/>
    </resultMap>


    <select id="selectListBySiteRelevance" resultMap="acceptAllotMap">
        select
            br.black_id blackId,
            sc.st_code stCode,
            sc.`value`,
            b.watermeter,
            sb1.status as siteNoStatus,
            sb2.status as watermeterStatus,
            br.black_river_name as blackRiverName
        from
            (select black_id,site_no,watermeter from xinyang_main.black_river_site_relevance where watermeter is not null ) b
                left join
            nf_monitor.station_config sc
            on sc.st_code = b.site_no
                left join
            nf_monitor.station_base sb1
            on b.site_no = sb1.st_code
                left join
            nf_monitor.station_base sb2
            on b.watermeter = sb2.st_code
                left join xinyang_river.black_river br
                          on b.black_id = br.black_id
        where  sc.`key` = 'z'
    </select>




    <select id="selectBySiteData" resultMap="acceptAllotMap">
        select
            sc.st_code stCode,
            sc.`value`,
            b.watermeter,
            sb1.status as siteNoStatus,
            sb2.status as watermeterStatus,
            br.black_river_name as blackRiverName
        from
            (select black_id,site_no,watermeter from xinyang_main.black_river_site_relevance where watermeter = #{watermeter} ) b
                left join
            nf_monitor.station_config sc
            on sc.st_code = b.site_no
                left join
            nf_monitor.station_base sb1
            on b.site_no = sb1.st_code
                left join
            nf_monitor.station_base sb2
            on b.watermeter = sb2.st_code
                left join xinyang_river.black_river br
                          on b.black_id = br.black_id
        where  sc.`key` = 'z'
    </select>
</mapper>