<?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.boco.nbd.wios.flow.mapper.def.ReportStatisticsMapper"> <sql id="Base_Column_Country"> <if test="installSupplierId != null "> and install_supplier_id in <foreach collection="installSupplierId" item="installSupplierId" open="(" separator="," close=")"> #{installSupplierId} </foreach> </if> <if test="regionId != null "> and country_id in <foreach collection="regionId" item="regionId" open="(" separator="," close=")"> #{regionId} </foreach> </if> <if test="startTime != null and startTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} </if> <if test="endTime != null and endTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} </if> </sql> <!--全国流转和归档订单总量--> <select id="getCountryOrderCount" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select country_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and (node_flag!=199 and status=64)=false and install_supplier_name is not null and country_name is not null <include refid="Base_Column_Country" /> group by country_name, install_supplier_name </select> <!--全国正常归档订单总量--> <select id="getCountryOrderCountNodeFlag199" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDurationStatisticsBO"> select country_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and country_name is not null and node_flag = '199' <include refid="Base_Column_Country" /> group by country_name, install_supplier_name </select> <!--全国拒接数量--> <select id="getCountryRefuseTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select country_name region, install_supplier_name installSupplierName, count(*) refuseTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and country_name is not null and refuse_order_reason is not null <include refid="Base_Column_Country" /> group by country_name, install_supplier_name; </select> <!--全国安装失败数量--> <select id="getCountryInstallationFailedTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select country_name region, install_supplier_name installSupplierName, count(*) installationFailedTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and country_name is not null and install_start_time is not null and install_end_time is null <include refid="Base_Column_Country" /> group by country_name, install_supplier_name; </select> <!--全国安装完成数量--> <select id="getCountryInstallationCompleteTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select a.region,a.installSupplierName,sum(a.installationCompleteTotal) installationCompleteTotal from (select country_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and status!=64 and install_supplier_name is not null and country_name is not null and node_flag in ('113','114') <include refid="Base_Column_Country" /> group by country_name, install_supplier_name union select country_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and status = 64 and install_supplier_name is not null and country_name is not null <include refid="Base_Column_Country" /> group by country_name, install_supplier_name )a group by a.region, a.installSupplierName </select> <sql id="Base_Column_Area"> <if test="installSupplierId != null "> and install_supplier_id in <foreach collection="installSupplierId" item="installSupplierId" open="(" separator="," close=")"> #{installSupplierId} </foreach> </if> <if test="regionId != null "> and area_id in <foreach collection="regionId" item="regionId" open="(" separator="," close=")"> #{regionId} </foreach> </if> <if test="startTime != null and startTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} </if> <if test="endTime != null and endTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} </if> </sql> <!--区域流转和归档订单总量--> <select id="getAreaOrderCount" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select area_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and (node_flag!=199 and status=64)=false and install_supplier_name is not null and area_name is not null <include refid="Base_Column_Area" /> group by area_name, install_supplier_name </select> <!--区域正常归档订单总量--> <select id="getAreaOrderCountNodeFlag199" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDurationStatisticsBO"> select area_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and area_name is not null and node_flag = '199' <include refid="Base_Column_Country" /> group by area_name, install_supplier_name </select> <!--区域拒接数量--> <select id="getAreaRefuseTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select area_name region, install_supplier_name installSupplierName, count(*) refuseTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and area_name is not null and refuse_order_reason is not null <include refid="Base_Column_Area" /> group by area_name, install_supplier_name </select> <!--区域安装失败数量--> <select id="getAreaInstallationFailedTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select area_name region, install_supplier_name installSupplierName, count(*) installationFailedTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and area_name is not null and install_start_time is not null and install_end_time is null <include refid="Base_Column_Area" /> group by area_name, install_supplier_name </select> <!--区域安装完成数量--> <select id="getAreaInstallationCompleteTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select a.region,a.installSupplierName,sum(a.installationCompleteTotal) installationCompleteTotal from (select area_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and area_name is not null and node_flag in ('113','114') <include refid="Base_Column_Area" /> group by area_name, install_supplier_name union select area_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and status = 64 and install_supplier_name is not null and area_name is not null <include refid="Base_Column_Area" /> group by area_name, install_supplier_name )a group by a.region, a.installSupplierName </select> <sql id="Base_Column_Province"> <if test="installSupplierId != null "> and install_supplier_id in <foreach collection="installSupplierId" item="installSupplierId" open="(" separator="," close=")"> #{installSupplierId} </foreach> </if> <if test="regionId != null "> and province_id in <foreach collection="regionId" item="regionId" open="(" separator="," close=")"> #{regionId} </foreach> </if> <if test="startTime != null and startTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} </if> <if test="endTime != null and endTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} </if> </sql> <!--省份流转和归档订单总量--> <select id="getProvinceOrderCount" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select province_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and (node_flag!=199 and status=64)=false and install_supplier_name is not null and province_name is not null <include refid="Base_Column_Province" /> group by province_name, install_supplier_name </select> <!--省份正常归档订单总量--> <select id="getProvinceOrderCountNodeFlag199" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDurationStatisticsBO"> select province_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and province_name is not null and node_flag = '199' <include refid="Base_Column_Country" /> group by province_name, install_supplier_name </select> <!--省份拒接数量--> <select id="getProvinceRefuseTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select province_name region, install_supplier_name installSupplierName, count(*) refuseTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and province_name is not null and refuse_order_reason is not null <include refid="Base_Column_Province" /> group by province_name, install_supplier_name </select> <!--省份安装失败数量--> <select id="getProvinceInstallationFailedTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select province_name region, install_supplier_name installSupplierName, count(*) installationFailedTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and province_name is not null and install_start_time is not null and install_end_time is null <include refid="Base_Column_Province" /> group by province_name, install_supplier_name </select> <!--省份安装完成数量--> <select id="getProvinceInstallationCompleteTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select a.region,a.installSupplierName,sum(a.installationCompleteTotal) installationCompleteTotal from (select province_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and province_name is not null and node_flag in ('113','114') <include refid="Base_Column_Province" /> group by province_name, install_supplier_name union select province_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and status = 64 and install_supplier_name is not null and province_name is not null <include refid="Base_Column_Province" /> group by province_name, install_supplier_name )a group by a.region, a.installSupplierName </select> <sql id="Base_Column_Region"> <if test="installSupplierId != null "> and install_supplier_id in <foreach collection="installSupplierId" item="installSupplierId" open="(" separator="," close=")"> #{installSupplierId} </foreach> </if> <if test="regionId != null "> and region_id in <foreach collection="regionId" item="regionId" open="(" separator="," close=")"> #{regionId} </foreach> </if> <if test="startTime != null and startTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} </if> <if test="endTime != null and endTime != ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} </if> </sql> <!--地市流转和归档订单总量--> <select id="getRegionOrderCount" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select region_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and (node_flag!=199 and status=64)=false and install_supplier_name is not null and region_name is not null <include refid="Base_Column_Region" /> group by region_name, install_supplier_name </select> <!--地市正常归档订单总量--> <select id="getRegionOrderCountNodeFlag199" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDurationStatisticsBO"> select region_name region, install_supplier_name installSupplierName, count(*) ordersTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and region_name is not null and node_flag = '199' <include refid="Base_Column_Country" /> group by region_name, install_supplier_name </select> <!--地市拒接数量--> <select id="getRegionRefuseTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select region_name region, install_supplier_name installSupplierName, count(*) refuseTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and region_name is not null and refuse_order_reason is not null <include refid="Base_Column_Region" /> group by region_name, install_supplier_name </select> <!--地市安装失败数量--> <select id="getRegionInstallationFailedTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select region_name region, install_supplier_name installSupplierName, count(*) installationFailedTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and region_name is not null and install_start_time is not null and install_end_time is null <include refid="Base_Column_Region" /> group by region_name, install_supplier_name </select> <!--地市安装完成数量--> <select id="getRegionInstallationCompleteTotal" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO"> select a.region,a.installSupplierName,sum(a.installationCompleteTotal) installationCompleteTotal from (select region_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and region_name is not null and node_flag in ('113','114') <include refid="Base_Column_Region" /> group by region_name, install_supplier_name union select region_name region, install_supplier_name installSupplierName, count(*) installationCompleteTotal from t_order where type=1 and process_ins_id is not null and install_supplier_name is not null and region_name is not null <include refid="Base_Column_Region" /> group by region_name, install_supplier_name )a group by a.region, a.installSupplierName </select> <!--节点订单查询--> <select id="getOrderByNodeFlag" resultType="java.lang.String"> select process_ins_id from t_order where type=1 and process_ins_id is not null and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} <if test='regionLevel == "1"'> and country_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "2"'> and area_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "3"'> and province_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "4"'> and region_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='type == "1"'> and node_flag > '112' </if> <if test='type == "2"'> and node_flag = '199' </if> </select> <!--安装完成安装数量(安装入场时间,安装离场时间均不为空的工单个数)--> <select id="getInstallationCompleteTotal" resultType="java.lang.Integer"> select count(*) from t_order where type=1 and process_ins_id is not null and install_start_time is not null and install_end_time is not null and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} <if test='regionLevel == "1"'> and country_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "2"'> and area_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "3"'> and province_name = #{region} and install_supplier_name = #{installSupplierName} </if> <if test='regionLevel == "4"'> and region_name = #{region} and install_supplier_name = #{installSupplierName} </if> </select> <select id="getOrderFiled" parameterType="com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO" resultType="com.boco.nbd.wios.flow.entity.po.OrderPO"> select * from t_order where type=1 and process_ins_id is not null and node_flag = '199' <if test='regionLevel == "1"'> <include refid="Base_Column_Country" /> </if> <if test='regionLevel == "2"'> <include refid="Base_Column_Area" /> </if> <if test='regionLevel == "3"'> <include refid="Base_Column_Province" /> </if> <if test='regionLevel == "4"'> <include refid="Base_Column_Region" /> </if> <if test='regionLevel == "4"'> <include refid="Base_Column_Region" /> </if> <if test="oemId != null and oemId != ''"> and oem_id = #{oemId} </if> <if test="regionLevel == null or regionLevel == ''"> and DATE_FORMAT(create_time,'%Y-%m-%d')>= #{startTime} and DATE_FORMAT(create_time,'%Y-%m-%d')<= #{endTime} <if test="installSupplierId != null "> and install_supplier_id in <foreach collection="installSupplierId" item="installSupplierId" open="(" separator="," close=")"> #{installSupplierId} </foreach> </if> </if> <if test="electricExpand != null and electricExpand != ''"> and electric_expand = #{electricExpand} </if> </select> </mapper>