@ -1138,20 +1138,10 @@
group by t.satisfaction_level
</select>
<!-- 执法检查数量排行 -->
<select id= "analysis_enterprisesIns" parameterType= "SixAnalysisParams" resultType= "integer" >
select
<if test= "uniteCheck == '1'.toString()" >
count(distinct union_no) as num
</if>
<if test= "uniteCheck == null or uniteCheck == '' or uniteCheck != '1'.toString()" >
count(1) as num
</if>
from enforcement_registration r
where r.bureau_dept_name is not null
<!-- 所有行政检查数量 -->
<select id= "analysis_enterprises_all" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT count(1) FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
@ -1161,26 +1151,43 @@
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "uniteCheck == '1'.toString()" > and (r.union_no is not null and r.union_no != '')</if>
<if test= "uniteCheck == '0'.toString()" > and (r.union_no is null or r.union_no = '')</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" > and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test= "endTime != null and endTime != ''" > and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
</select>
<select id= "analysis_enterprisesIns_rr" parameterType= "SixAnalysisParams" resultType= "double" >
select
<if test= "uniteCheck == '1'.toString()" >
count(distinct union_no) as num
<select id= "analysis_enterprises_all_rr" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT count(1) FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "uniteCheck == null or uniteCheck == '' or uniteCheck != '1'.toString()" >
count(1) as num
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)
</if>
from enforcement_registration r
where r.bureau_dept_name is not null
<if test= "endTime != null and endTime != ''" >
and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')
</if>
</select>
<select id= "analysis_enterprises_all_yoy" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT count(1) FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
@ -1190,12 +1197,85 @@
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d')
</if>
<if test= "endTime != null and endTime != ''" >
and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</select>
<!-- 所有非行政检查数量 -->
<select id= "analysis_enterprises_non_all" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT count(1) FROM non_enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.bureau_dept_id is not null
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" > and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test= "endTime != null and endTime != ''" > and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
</select>
<!-- 联合检查数量统计 -->
<select id= "analysis_enterprises_union" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT COUNT(1) AS _count
FROM (
SELECT 1
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" > and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test= "endTime != null and endTime != ''" > and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
GROUP BY union_no
HAVING COUNT(1) > 1
) AS t
</select>
<select id= "analysis_enterprises_union_rr" parameterType= "SixAnalysisParams" resultType= "double" >
SELECT COUNT(1) AS _count
FROM (
SELECT 1
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "uniteCheck == '1'.toString()" > and (r.union_no is not null and r.union_no != '')</if>
<if test= "uniteCheck == '0'.toString()" > and (r.union_no is null or r.union_no = '')</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)
@ -1203,17 +1283,47 @@
<if test= "endTime != null and endTime != ''" >
and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')
</if>
GROUP BY union_no
HAVING COUNT(1) > 1
) AS t
</select>
<select id= "analysis_enterprisesIns_yoy" parameterType= "SixAnalysisParams" resultType= "double" >
select
<if test= "uniteCheck == '1'.toString()" >
count(distinct union_no) as num
<select id= "analysis_enterprises_union_yoy" parameterType= "SixAnalysisParams" resultType= "double" >
SELECT COUNT(1) AS _count
FROM (
SELECT 1
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and (r.union_no IS NOT NULL and r.union_no != '')
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "uniteCheck == null or uniteCheck == '' or uniteCheck != '1'.toString()" >
count(1) as num
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d')
</if>
from enforcement_registration r
where r.bureau_dept_name is not null
<if test= "endTime != null and endTime != ''" >
and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
GROUP BY union_no
HAVING COUNT(1) > 1
) AS t
</select>
<!-- 单条检查数量统计 -->
<select id= "analysis_enterprises_single" parameterType= "SixAnalysisParams" resultType= "integer" >
SELECT count(1)
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
@ -1223,19 +1333,72 @@
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and r.has_union = 1
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "uniteCheck == '1'.toString()" > and (r.union_no is not null and r.union_no != '')</if>
<if test= "uniteCheck == '0'.toString()" > and (r.union_no is null or r.union_no = '')</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%'))</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" > and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test= "endTime != null and endTime != ''" > and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
</select>
<select id= "analysis_enterprises_single_rr" parameterType= "SixAnalysisParams" resultType= "double" >
SELECT count(1)
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and r.has_union = 1
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)
</if>
<if test= "endTime != null and endTime != ''" >
and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')
</if>
GROUP BY union_no
HAVING COUNT(1) > 1
) AS t;
</select>
<select id= "analysis_enterprises_single_yoy" parameterType= "SixAnalysisParams" resultType= "double" >
SELECT count(1)
FROM enforcement_registration r
WHERE r.bureau_dept_name is not null
and r.is_submit = 1
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
and r.has_union = 1
<if test= "params.zone != null and params.zone != ''" > and r.bureau_dept_id in (select dept_id from sys_dept where zone = #{params.zone}) </if>
<if test= "deptId != null and deptId != ''" >
and r.dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId})
</if>
<if test= "userId != null and userId != '' " > and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two like concat('%',#{userId}, '%')) </if>
<if test= "beginTime != null and beginTime != ''" >
and DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d')
</if>
<if test= "endTime != null and endTime != ''" >
and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
GROUP BY union_no
HAVING COUNT(1) > 1
) AS t;
</select>
<select id= "analysis_non_enterprisesIns" parameterType= "SixAnalysisParams" resultType= "integer" >