<?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.ruoyi.report.mapper.RzlIpcStatisticsInfoMapper">

    <select id="queryTotalNum" resultType="com.ruoyi.report.domain.RzlIpcStatisticsInfo">
        SELECT IFNULL( SUM( higher_school ), 0 ) higher_school,
        IFNULL( SUM( research_institute ), 0 ) research_institute,
        IFNULL( SUM( enterprise ), 0 ) enterprise,
        IFNULL( SUM( institutions ), 0 ) institutions,
        IFNULL( SUM( individual ), 0 ) individual,
        IFNULL( SUM( number ), 0 ) number
        FROM rzl_ipc_statistics_info
        <where>
            AND city_name IS NOT NULL AND city_name !=''
            <if test="patentTypes!=null and patentTypes !=''">and patent_type IN (${patentTypes})</if>
            <if test="applicantTypes!=null and applicantTypes !=''">and applicant_type IN (${applicantTypes})</if>
            <if test="year!=null and year !=''">AND year = #{year}</if>
            <if test="cityCode!=null and cityCode !=''">AND city_code = #{cityCode}</if>
            <if test="month!=null and month !=''">AND month = #{month}</if>
        </where>
        ORDER BY id DESC
    </select>
</mapper>