<?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.goldenwater.slaj.hidd.mapper.TBusiHiddCountMapper">
    <resultMap type="com.goldenwater.slaj.hidd.domain.TBusiHiddCount" id="TBusiHiddCountResult">
        <result property="guid" column="guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="createTime" column="create_time"/>
        <result property="pcl" column="pcl"/>
        <result property="oengOrg" column="oeng_org"/>
        <result property="hiddOrg" column="hidd_org"/>
        <result property="engNum" column="eng_num"/>
        <result property="hiddEng" column="hidd_eng"/>
        <result property="hiddZgl" column="hidd_zgl"/>
        <result property="ybZgl" column="yb_zgl"/>
        <result property="ybHidd" column="yb_hidd"/>
        <result property="zgYbHidd" column="zg_yb_hidd"/>
        <result property="zdZgl" column="zd_zgl"/>
        <result property="zdHidd" column="zd_hidd"/>
        <result property="zgZdHidd" column="zg_zd_hidd"/>
    </resultMap>
    <sql id="selectTBusiHiddCountVo">
        select guid, org_guid, create_time, pcl, oeng_org, hidd_org, eng_num, hidd_eng,
               hidd_zgl, yb_zgl, yb_hidd, zg_yb_hidd, zd_zgl, zd_hidd, zg_zd_hidd
        from t_busi_hidd_count
    </sql>
    <select id="selectTBusiHiddCountById" parameterType="String" resultMap="TBusiHiddCountResult">
        <include refid="selectTBusiHiddCountVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiHiddCountList" parameterType="com.goldenwater.slaj.hidd.domain.TBusiHiddCount" resultMap="TBusiHiddCountResult">
        <include refid="selectTBusiHiddCountVo"/>
        <where>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="createTime != null and createTime != ''">AND create_time = #{createTime}</if>
        </where>
    </select>
    <insert id="insertTBusiHiddCount" parameterType="com.goldenwater.slaj.hidd.domain.TBusiHiddCount">
        insert into t_busi_hidd_count (guid, org_guid, create_time, pcl, oeng_org, hidd_org, eng_num, hidd_eng, hidd_zgl, yb_zgl, yb_hidd, zg_yb_hidd, zd_zgl, zd_hidd, zg_zd_hidd)
        values (#{guid}, #{orgGuid}, #{createTime}, #{pcl}, #{oengOrg}, #{hiddOrg}, #{engNum}, #{hiddEng}, #{hiddZgl}, #{ybZgl}, #{ybHidd}, #{zgYbHidd}, #{zdZgl}, #{zdHidd}, #{zgZdHidd})
    </insert>
    <update id="updateTBusiHiddCount" parameterType="com.goldenwater.slaj.hidd.domain.TBusiHiddCount">
        update t_busi_hidd_count
        <set>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="pcl != null">pcl = #{pcl},</if>
            <if test="oengOrg != null">oeng_org = #{oengOrg},</if>
            <if test="hiddOrg != null">hidd_org = #{hiddOrg},</if>
            <if test="engNum != null">eng_num = #{engNum},</if>
            <if test="hiddEng != null">hidd_eng = #{hiddEng},</if>
            <if test="hiddZgl != null">hidd_zgl = #{hiddZgl},</if>
            <if test="ybZgl != null">yb_zgl = #{ybZgl},</if>
            <if test="ybHidd != null">yb_hidd = #{ybHidd},</if>
            <if test="zgYbHidd != null">zg_yb_hidd = #{zgYbHidd},</if>
            <if test="zdZgl != null">zd_zgl = #{zdZgl},</if>
            <if test="zdHidd != null">zd_hidd = #{zdHidd},</if>
            <if test="zgZdHidd != null">zg_zd_hidd = #{zgZdHidd},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiHiddCountById" parameterType="String">
        delete from t_busi_hidd_count where guid = #{guid}
    </delete>
    <delete id="deleteTBusiHiddCountByIds" parameterType="String">
        delete from t_busi_hidd_count where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>

    <select id="selectReportRateChart" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
        select c.org_guid as orgGuid,
               c.pcl as rateData,
               c.create_time as repTime
        from t_busi_hidd_count c
        <where>
            <if test="repTime != null and repTime != ''">AND c.create_time = #{repTime}</if>
        </where>
        order by c.pcl desc
    </select>

    <select id="selectRectifyRateChart" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
        select c.org_guid as orgGuid,
               c.hidd_zgl as rateData,
               c.create_time as repTime
        from t_busi_hidd_count c
        <where>
            <if test="repTime != null and repTime != ''">AND c.create_time = #{repTime}</if>
        </where>
        order by c.hidd_zgl desc
    </select>
</mapper>
