|
|
|
@ -132,8 +132,8 @@ |
|
|
|
<include refid="selectScanDataSituationAreaSql"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectScanDataSituationAreaDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<!-- 各区扫码情况明细 --> |
|
|
|
<sql id="selectScanDataSituationAreaDetailsSql"> |
|
|
|
select |
|
|
|
street_code as streetCode, |
|
|
|
street_name as streetName, |
|
|
|
@ -157,90 +157,90 @@ |
|
|
|
dashboard_area_info t3 |
|
|
|
<!-- 两类执法数据各扫描一次,地址匹配街道名,同时得到执法数量与去重后的执法企业数 --> |
|
|
|
left join ( |
|
|
|
select |
|
|
|
code, |
|
|
|
SUM(is_xz) as xz_cnt, |
|
|
|
SUM(1 - is_xz) as fxz_cnt, |
|
|
|
COUNT(DISTINCT enterprise_key) as ent_cnt |
|
|
|
from |
|
|
|
( |
|
|
|
select |
|
|
|
t4.code as code, |
|
|
|
1 as is_xz, |
|
|
|
COALESCE(NULLIF(TRIM(t1.enterprise_number),''), NULLIF(TRIM(t1.enterprise_name),'')) as enterprise_key |
|
|
|
from |
|
|
|
enforcement_registration t1 |
|
|
|
join dashboard_area_info t4 on |
|
|
|
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|
|
|
where |
|
|
|
t1.is_delete = 0 |
|
|
|
and t1.is_submit = 1 |
|
|
|
and t1.enterprise_name is not null |
|
|
|
and t1.enterprise_number is not null |
|
|
|
and t4.level = 4 |
|
|
|
and t4.is_delete = '0' |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND t1.enforcement_time >= STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d') |
|
|
|
AND t1.enforcement_time < DATE_ADD(STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d'), INTERVAL 1 YEAR) |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t1.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND t1.enforcement_time >= DATE(#{bo.startTime}) |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND t1.enforcement_time < DATE_ADD(DATE(#{bo.endTime}), INTERVAL 1 DAY) |
|
|
|
</if> |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t4.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
union all |
|
|
|
select |
|
|
|
t4.code as code, |
|
|
|
0 as is_xz, |
|
|
|
COALESCE(NULLIF(TRIM(t1.enterprise_number),''), NULLIF(TRIM(t1.enterprise_name),'')) as enterprise_key |
|
|
|
from |
|
|
|
non_enforcement_registration t1 |
|
|
|
join dashboard_area_info t4 on |
|
|
|
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|
|
|
where |
|
|
|
t1.has_delete = 0 |
|
|
|
and t4.level = 4 |
|
|
|
and t4.is_delete = '0' |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND t1.enforcement_time >= STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d') |
|
|
|
AND t1.enforcement_time < DATE_ADD(STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d'), INTERVAL 1 YEAR) |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t1.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND t1.enforcement_time >= DATE(#{bo.startTime}) |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND t1.enforcement_time < DATE_ADD(DATE(#{bo.endTime}), INTERVAL 1 DAY) |
|
|
|
</if> |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t4.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
) u |
|
|
|
group by |
|
|
|
code |
|
|
|
) agg on |
|
|
|
t3.code = agg.code |
|
|
|
select |
|
|
|
code, |
|
|
|
SUM(is_xz) as xz_cnt, |
|
|
|
SUM(1 - is_xz) as fxz_cnt, |
|
|
|
COUNT(DISTINCT enterprise_key) as ent_cnt |
|
|
|
from |
|
|
|
( |
|
|
|
select |
|
|
|
t4.code as code, |
|
|
|
1 as is_xz, |
|
|
|
COALESCE(NULLIF(TRIM(t1.enterprise_number),''), NULLIF(TRIM(t1.enterprise_name),'')) as enterprise_key |
|
|
|
from |
|
|
|
enforcement_registration t1 |
|
|
|
join dashboard_area_info t4 on |
|
|
|
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|
|
|
where |
|
|
|
t1.is_delete = 0 |
|
|
|
and t1.is_submit = 1 |
|
|
|
and t1.enterprise_name is not null |
|
|
|
and t1.enterprise_number is not null |
|
|
|
and t4.level = 4 |
|
|
|
and t4.is_delete = '0' |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND t1.enforcement_time >= STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d') |
|
|
|
AND t1.enforcement_time < DATE_ADD(STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d'), INTERVAL 1 YEAR) |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t1.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND t1.enforcement_time >= DATE(#{bo.startTime}) |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND t1.enforcement_time < DATE_ADD(DATE(#{bo.endTime}), INTERVAL 1 DAY) |
|
|
|
</if> |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t4.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
union all |
|
|
|
select |
|
|
|
t4.code as code, |
|
|
|
0 as is_xz, |
|
|
|
COALESCE(NULLIF(TRIM(t1.enterprise_number),''), NULLIF(TRIM(t1.enterprise_name),'')) as enterprise_key |
|
|
|
from |
|
|
|
non_enforcement_registration t1 |
|
|
|
join dashboard_area_info t4 on |
|
|
|
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|
|
|
where |
|
|
|
t1.has_delete = 0 |
|
|
|
and t4.level = 4 |
|
|
|
and t4.is_delete = '0' |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND t1.enforcement_time >= STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d') |
|
|
|
AND t1.enforcement_time < DATE_ADD(STR_TO_DATE(CONCAT(#{bo.year},'-01-01'),'%Y-%m-%d'), INTERVAL 1 YEAR) |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t1.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND t1.enforcement_time >= DATE(#{bo.startTime}) |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND t1.enforcement_time < DATE_ADD(DATE(#{bo.endTime}), INTERVAL 1 DAY) |
|
|
|
</if> |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t4.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
) u |
|
|
|
group by |
|
|
|
code |
|
|
|
) agg on |
|
|
|
t3.code = agg.code |
|
|
|
where |
|
|
|
t3.level = 4 |
|
|
|
and t3.is_delete = '0' |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t3.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|
|
|
and t3.parent_code =#{bo.districtCode} |
|
|
|
</if> |
|
|
|
) base |
|
|
|
<!-- 排序:与区域列表一致,走白名单,避免 MyBatis-Plus 再追加排序字段 --> |
|
|
|
order by |
|
|
|
@ -255,9 +255,18 @@ |
|
|
|
<otherwise>xzzfslpm</otherwise> |
|
|
|
</choose> |
|
|
|
<if test="bo.isAsc == 'desc'">desc</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="selectScanDataSituationAreaDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<include refid="selectScanDataSituationAreaDetailsSql"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectScanDataSituationAreaDetailsList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<include refid="selectScanDataSituationAreaDetailsSql"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 各领域扫码情况 --> |
|
|
|
<sql id="selectScanDataSituationDomainSql"> |
|
|
|
select |
|
|
|
domain_id as domainId, |
|
|
|
@ -388,8 +397,8 @@ |
|
|
|
<include refid="selectScanDataSituationDomainSql"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectScanDataSituationDomainDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<!-- 各领域扫码情况明细 --> |
|
|
|
<sql id="selectScanDataSituationDomainDetailsSql"> |
|
|
|
select |
|
|
|
domain_id as domainId, |
|
|
|
domain_name as domainName, |
|
|
|
@ -402,82 +411,82 @@ |
|
|
|
rank() over (order by fxzzf_count desc ) as fxzzfslpm, |
|
|
|
ROUND(fxzzf_count * 100.0 / nullif(SUM(fxzzf_count)over(), 0), 2) as fxzzfslzb, |
|
|
|
(xzzf_count + fxzzf_count) as totalCount |
|
|
|
from |
|
|
|
( |
|
|
|
select |
|
|
|
t1.domain_id, |
|
|
|
t1.domain_name, |
|
|
|
t1.dept_id, |
|
|
|
t1.dept_name, |
|
|
|
coalesce(xz.xz_cnt, 0) as xzzf_count, |
|
|
|
coalesce(fxz.fxz_cnt, 0) as fxzzf_count |
|
|
|
from |
|
|
|
( |
|
|
|
select |
|
|
|
t1.domain_id, |
|
|
|
t1.domain_name, |
|
|
|
t1.dept_id, |
|
|
|
t1.dept_name, |
|
|
|
coalesce(xz.xz_cnt, 0) as xzzf_count, |
|
|
|
coalesce(fxz.fxz_cnt, 0) as fxzzf_count |
|
|
|
from |
|
|
|
dashboard_domain_dept t1 |
|
|
|
dashboard_domain_dept t1 |
|
|
|
<!-- 1) 行政执法数量:按子领域(bureau_dept_id)聚合--> |
|
|
|
left join ( |
|
|
|
select |
|
|
|
t2.bureau_dept_id as dept_id, |
|
|
|
COUNT(1) as xz_cnt |
|
|
|
from |
|
|
|
enforcement_registration t2 |
|
|
|
<where> |
|
|
|
t2.is_delete = 0 |
|
|
|
and t2.is_submit = 1 |
|
|
|
and t2.enterprise_name is not null |
|
|
|
and t2.enterprise_number is not null |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND YEAR(t2.enforcement_time) = #{bo.year} |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t2.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
group by |
|
|
|
select |
|
|
|
t2.bureau_dept_id as dept_id, |
|
|
|
COUNT(1) as xz_cnt |
|
|
|
from |
|
|
|
enforcement_registration t2 |
|
|
|
<where> |
|
|
|
t2.is_delete = 0 |
|
|
|
and t2.is_submit = 1 |
|
|
|
and t2.enterprise_name is not null |
|
|
|
and t2.enterprise_number is not null |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND YEAR(t2.enforcement_time) = #{bo.year} |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t2.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
group by |
|
|
|
t2.bureau_dept_id |
|
|
|
) xz on t1.dept_id = xz.dept_id |
|
|
|
<!-- 2) 非行政执法数量:按子领域(bureau_dept_id)聚合--> |
|
|
|
left join ( |
|
|
|
select |
|
|
|
t2.bureau_dept_id as dept_id, |
|
|
|
COUNT(1) as fxz_cnt |
|
|
|
from |
|
|
|
non_enforcement_registration t2 |
|
|
|
<where> |
|
|
|
t2.has_delete = 0 |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND YEAR(t2.enforcement_time) = #{bo.year} |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t2.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
group by |
|
|
|
t2.bureau_dept_id |
|
|
|
) fxz on t1.dept_id = fxz.dept_id |
|
|
|
<where> |
|
|
|
<if test="bo.domainId !=null and bo.domainId!=''"> |
|
|
|
and t1.domain_id = #{bo.domainId} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
) base |
|
|
|
) xz on t1.dept_id = xz.dept_id |
|
|
|
<!-- 2) 非行政执法数量:按子领域(bureau_dept_id)聚合--> |
|
|
|
left join ( |
|
|
|
select |
|
|
|
t2.bureau_dept_id as dept_id, |
|
|
|
COUNT(1) as fxz_cnt |
|
|
|
from |
|
|
|
non_enforcement_registration t2 |
|
|
|
<where> |
|
|
|
t2.has_delete = 0 |
|
|
|
<if test = "bo.year != null"> |
|
|
|
AND YEAR(t2.enforcement_time) = #{bo.year} |
|
|
|
</if> |
|
|
|
<if test = "bo.quarter != null"> |
|
|
|
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|
|
|
</if> |
|
|
|
<if test = "bo.month != null"> |
|
|
|
AND MONTH(t2.enforcement_time) = #{bo.month} |
|
|
|
</if> |
|
|
|
<if test = "bo.startTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test = "bo.endTime != null"> |
|
|
|
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
group by |
|
|
|
t2.bureau_dept_id |
|
|
|
) fxz on t1.dept_id = fxz.dept_id |
|
|
|
<where> |
|
|
|
<if test="bo.domainId !=null and bo.domainId!=''"> |
|
|
|
and t1.domain_id = #{bo.domainId} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
) base |
|
|
|
order by |
|
|
|
<choose> |
|
|
|
<when test="bo.orderByColumn == 'xzzfCount'">xzzfCount</when> |
|
|
|
@ -489,5 +498,12 @@ |
|
|
|
<otherwise>xzzfslpm</otherwise> |
|
|
|
</choose> |
|
|
|
<if test="bo.isAsc == 'desc'">desc</if> |
|
|
|
</sql> |
|
|
|
<select id="selectScanDataSituationDomainDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<include refid="selectScanDataSituationDomainDetailsSql"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectScanDataSituationDomainDetailsList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|
|
|
<include refid="selectScanDataSituationDomainDetailsSql"/> |
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|
|