<?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.OtNpermitUploadLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.crgs.transfor.entity.OtNpermitUploadLog">
        <id column="LOGID" property="logid" />
        <result column="BATCHID" property="batchid" />
        <result column="LICID" property="licid" />
        <result column="REGNO" property="regno" />
        <result column="UNISCID" property="uniscid" />
        <result column="ENTNAME" property="entname" />
        <result column="LICNO" property="licno" />
        <result column="LICNAME_CN" property="licnameCn" />
        <result column="VALFROM" property="valfrom" />
        <result column="VALTO" property="valto" />
        <result column="LICANTH" property="licanth" />
        <result column="LICITEM" property="licitem" />
        <result column="TYPE" property="type" />
        <result column="CANDATE" property="candate" />
        <result column="EQUPLECANREA" property="equplecanrea" />
        <result column="REVDATE" property="revdate" />
        <result column="SUGREVREASON" property="sugrevreason" />
        <result column="INVALIDDATE" property="invaliddate" />
        <result column="INVALIDREA" property="invalidrea" />
        <result column="DATADEPT" property="datadept" />
        <result column="UPLOADPROV" property="uploadprov" />
        <result column="TARGETPROV" property="targetprov" />
        <result column="OPFLAG" property="opflag" />
        <result column="IS_SUCCESS" property="isSuccess" />
        <result column="FAIL_REASON" property="failReason" />
        <result column="CREATE_TIME" property="createTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        LOGID, BATCHID, LICID, REGNO, UNISCID, ENTNAME, LICNO, LICNAME_CN, VALFROM, VALTO, LICANTH, LICITEM, TYPE, CANDATE, EQUPLECANREA, REVDATE, SUGREVREASON, INVALIDDATE, INVALIDREA, DATADEPT, UPLOADPROV, TARGETPROV, OPFLAG, IS_SUCCESS, FAIL_REASON, CREATE_TIME
    </sql>
    <select id="statisticUploadCount"
            resultType="com.chinaweal.aiccs.crgs.transfor.entity.dto.StatisticLoadDto">
        select TARGETPROV as areaCode, count(1) as totalCount
        from ot_npermit_upload_log
        where IS_SUCCESS = '1'
        <if test="startDate != null and startDate != ''">
            and CREATE_TIME &gt;= #{startDate}
        </if>
        <if test="endDate != null and endDate != ''">
            and CREATE_TIME &lt;= #{endDate}
        </if>
        group by TARGETPROV
    </select>

</mapper>
