<?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.unis.financialSupervision.modular.fsstoragesubsidysettle.mapper.FsStorageSubsidySettleMapper">

    <select id="getOrgAndKcSum" resultType="java.util.Map">
        SELECT DISTINCT
            UnitID,
            nf,
            count(yf) ys,
            sum(ROUND(qmkc/10000, 2)) AS qmkc
        FROM
            depot_qh.data_kcgl_kcyjd_default
        where pz!=7144 and nf=#{Year} and UnitID=#{orgId}
        GROUP BY
            nf,
            UnitID

    </select>
    <select id="getStaetAndEnd" resultType="java.util.Map">
        SELECT
            a.rotation_start 	rotationStart,
            a.rotation_end rotationEnd,
            SUM(ROUND((a.planned_quantity - a.remaining_quantity) / 10000.0, 2)) AS quantity
        FROM
            province_all.biz_pss_storage_empty_period a
        left join depot_qh.business_rp_report b on a.rp_report_id =b.id and plan_type=1
        where a.org_id=#{orgId} and a.plan_year =#{Year} and a.rotation_status=1
        GROUP BY a.org_id

    </select>
    <select id="getOrgAndYlKcSum" resultType="java.util.Map">
        SELECT DISTINCT
            UnitID,
            nf,
            count(yf),
            sum(ROUND(qmkc/10000, 2)) AS qmkc
        FROM
            depot_qh.data_kcgl_kcyjd_default
        where pz=7144 and nf=#{Year}
        GROUP BY
            nf,
            UnitID


    </select>
    <select id="selectOrgInfo" resultType="java.util.Map">
        select DISTINCT org_id AS orgId from depot_qh.org_info ORDER By org_id DESC

    </select>
</mapper>