<?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.chinaweal.aiccs.crgs.transfor.mapper.OtNcaseDownloadLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.crgs.transfor.entity.OtNcaseDownloadLog">
        <id column="LOGID" property="logid" />
        <result column="FILEPATH" property="filepath" />
        <result column="CASEID" property="caseid" />
        <result column="REGNO" property="regno" />
        <result column="UNISCID" property="uniscid" />
        <result column="ENTNAME" property="entname" />
        <result column="PENDECNO" property="pendecno" />
        <result column="ILLEGACTTYPE" property="illegacttype" />
        <result column="PENTYPE" property="pentype" />
        <result column="PENTYPE_CN" property="pentypeCn" />
        <result column="PENAM" property="penam" />
        <result column="FORFAM" property="forfam" />
        <result column="PENCONTENT" property="pencontent" />
        <result column="JUDAUTH" property="judauth" />
        <result column="PENDECISSDATE" property="pendecissdate" />
        <result column="Remark" property="remark" />
        <result column="PublicDate" property="publicDate" />
        <result column="DATADEPT" property="datadept" />
        <result column="UPLOADPROV" property="uploadprov" />
        <result column="TARGETPROV" property="targetprov" />
        <result column="OPFLAG" property="opflag" />
        <result column="IS_DOWNLOAD" property="isDownload" />
        <result column="CREATE_TIME" property="createTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        LOGID, FILEPATH, CASEID, REGNO, UNISCID, ENTNAME, PENDECNO, ILLEGACTTYPE, PENTYPE, PENTYPE_CN, PENAM, FORFAM, PENCONTENT, JUDAUTH, PENDECISSDATE, Remark, PublicDate, DATADEPT, UPLOADPROV, TARGETPROV, OPFLAG, IS_DOWNLOAD, CREATE_TIME
    </sql>
    <select id="statisticDownloadCount"
            resultType="com.chinaweal.aiccs.crgs.transfor.entity.dto.StatisticLoadDto">
        select UPLOADPROV as areaCode, count(1) totalCount, IS_DOWNLOAD as flag
        from ot_ncase_download_log
        <where>
            <if test="startDate != null and startDate != ''">
                and CREATE_TIME &gt;= #{startDate}
            </if>
            <if test="endDate != null and endDate != ''">
                and CREATE_TIME &lt;= #{endDate}
            </if>
        </where>
        group by UPLOADPROV, IS_DOWNLOAD
    </select>

</mapper>
