|
|
@ -98,14 +98,145 @@ |
|
|
|
|
|
|
|
|
<!-- 报表统计指标查询(COUNT聚合,不全量加载) --> |
|
|
<!-- 报表统计指标查询(COUNT聚合,不全量加载) --> |
|
|
<select id="selectReportStatistics" resultType="com.zdxt.enforcementcode.domain.vo.report.RegistrationStatisticsVo"> |
|
|
<select id="selectReportStatistics" resultType="com.zdxt.enforcementcode.domain.vo.report.RegistrationStatisticsVo"> |
|
|
SELECT |
|
|
<!--SELECT |
|
|
COUNT(*) AS total, |
|
|
COUNT(*) AS total, |
|
|
SUM(CASE WHEN has_union = 1 AND union_no IS NOT NULL AND union_no != '' THEN 1 ELSE 0 END) AS unionCount, |
|
|
<!–SUM(CASE WHEN has_union = 1 AND union_no IS NOT NULL AND union_no != '' THEN 1 ELSE 0 END) AS unionCount,–> |
|
|
|
|
|
SUM(CASE WHEN r.has_union = 1 |
|
|
|
|
|
AND r.union_no IS NOT NULL |
|
|
|
|
|
AND r.union_no != '' |
|
|
|
|
|
AND uc.cnt > 1 |
|
|
|
|
|
THEN 1 ELSE 0 END) AS unionCount, |
|
|
SUM(CASE WHEN check_category = #{checkCategoryCode} THEN 1 ELSE 0 END) AS checkCount |
|
|
SUM(CASE WHEN check_category = #{checkCategoryCode} THEN 1 ELSE 0 END) AS checkCount |
|
|
|
|
|
FROM enforcement_registration r |
|
|
|
|
|
LEFT JOIN ( |
|
|
|
|
|
<!– 预计算每个 union_no 的有效成员数(已提交、未删除)–> |
|
|
|
|
|
SELECT union_no, COUNT(1) AS cnt |
|
|
FROM enforcement_registration |
|
|
FROM enforcement_registration |
|
|
<where> |
|
|
WHERE is_submit = 1 |
|
|
|
|
|
AND is_delete = 0 |
|
|
|
|
|
AND union_no IS NOT NULL |
|
|
|
|
|
AND union_no != '' |
|
|
|
|
|
GROUP BY union_no |
|
|
|
|
|
) uc ON uc.union_no = r.union_no--> |
|
|
|
|
|
<!--<where> |
|
|
<include refid="reportWhereCondition"/> |
|
|
<include refid="reportWhereCondition"/> |
|
|
</where> |
|
|
</where>--> |
|
|
|
|
|
SELECT |
|
|
|
|
|
COUNT(*) AS total, |
|
|
|
|
|
( |
|
|
|
|
|
SELECT COUNT(1) FROM ( |
|
|
|
|
|
SELECT 1 |
|
|
|
|
|
FROM enforcement_registration r2 |
|
|
|
|
|
WHERE r2.is_submit = 1 |
|
|
|
|
|
AND r2.is_delete = 0 |
|
|
|
|
|
AND r2.union_no IS NOT NULL |
|
|
|
|
|
AND r2.union_no != '' |
|
|
|
|
|
AND r2.bureau_dept_name IS NOT NULL |
|
|
|
|
|
AND r2.law_enforcement_id IS NOT NULL |
|
|
|
|
|
AND r2.enterprise_name IS NOT NULL |
|
|
|
|
|
AND r2.enterprise_number IS NOT NULL |
|
|
|
|
|
AND r2.law_enforcer IS NOT NULL |
|
|
|
|
|
AND r2.law_enforcer_two IS NOT NULL |
|
|
|
|
|
AND r2.is_complaint IS NOT NULL |
|
|
|
|
|
AND r2.check_category IS NOT NULL |
|
|
|
|
|
AND r2.bureau_dept_id IS NOT NULL |
|
|
|
|
|
AND (r2.status = 0 OR r2.status IS NULL) |
|
|
|
|
|
GROUP BY r2.union_no |
|
|
|
|
|
HAVING COUNT(1) > 1 |
|
|
|
|
|
) t |
|
|
|
|
|
) AS unionCount, |
|
|
|
|
|
SUM(CASE WHEN r.check_category = '01' THEN 1 ELSE 0 END) AS checkCount |
|
|
|
|
|
FROM |
|
|
|
|
|
enforcement_registration r |
|
|
|
|
|
WHERE |
|
|
|
|
|
r.is_submit = 1 |
|
|
|
|
|
AND r.is_delete = 0 |
|
|
|
|
|
AND r.bureau_dept_name IS NOT NULL |
|
|
|
|
|
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.status = 0 OR r.status IS NULL) |
|
|
|
|
|
<if test="bo.bureauDeptName != null and bo.bureauDeptName != ''"> |
|
|
|
|
|
AND r.bureau_dept_name LIKE CONCAT('%', #{bo.bureauDeptName}, '%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.lawEnforcer != null and bo.lawEnforcer != ''"> |
|
|
|
|
|
AND (law_enforcer LIKE CONCAT('%', #{bo.lawEnforcer}, '%') |
|
|
|
|
|
ORr. law_enforcer_two LIKE CONCAT('%', #{bo.lawEnforcer}, '%')) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.enterpriseName != null and bo.enterpriseName != ''"> |
|
|
|
|
|
AND r.enterprise_name LIKE CONCAT('%', #{bo.enterpriseName}, '%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.lawEnforcementItemText != null and bo.lawEnforcementItemText != ''"> |
|
|
|
|
|
AND r.law_enforcement_item_text LIKE CONCAT('%', #{bo.lawEnforcementItemText}, '%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.hasUnion != null"> |
|
|
|
|
|
AND r.has_union = #{bo.hasUnion} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.hasAuto != null"> |
|
|
|
|
|
AND r.has_auto = #{bo.hasAuto} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.entrustDeptName != null and bo.entrustDeptName != ''"> |
|
|
|
|
|
AND r.entrust_dept_name LIKE CONCAT('%', #{bo.entrustDeptName}, '%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.lawEnforceCategory != null and bo.lawEnforceCategory != ''"> |
|
|
|
|
|
AND r.law_enforce_category = #{bo.lawEnforceCategory} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.isComplaint != null"> |
|
|
|
|
|
AND r.is_complaint = #{bo.isComplaint} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.enforce != null and bo.enforce != ''"> |
|
|
|
|
|
AND r.enforce = #{bo.enforce} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.checkCss != null and bo.checkCss != ''"> |
|
|
|
|
|
AND r.check_css = #{bo.checkCss} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.district != null and bo.district != ''"> |
|
|
|
|
|
AND (r.enterprise_address LIKE CONCAT('深圳市', SUBSTRING_INDEX(#{bo.district}, '区', 1), '区%') |
|
|
|
|
|
OR r.enterprise_address LIKE CONCAT('深圳市', SUBSTRING_INDEX(#{bo.district}, '区', 1), '新区%')) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.street != null and bo.street != ''"> |
|
|
|
|
|
AND (r.enterprise_address LIKE CONCAT('深圳市', SUBSTRING_INDEX(#{bo.district}, '区', 1), '区', #{bo.street}, '%') |
|
|
|
|
|
OR r.enterprise_address LIKE CONCAT('深圳市', SUBSTRING_INDEX(#{bo.district}, '区', 1), '新区', #{bo.street}, '%')) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.checkCategory != null and bo.checkCategory != ''"> |
|
|
|
|
|
AND r.check_category = #{bo.checkCategory} |
|
|
|
|
|
</if> |
|
|
|
|
|
<!-- dateType: 1=本月, 2=本季度, 3=本年 --> |
|
|
|
|
|
<if test="bo.dateType != null and bo.dateType == 1"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.dateType != null and bo.dateType == 2"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m') >= CONCAT(YEAR(CURDATE()), '-', |
|
|
|
|
|
CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01' |
|
|
|
|
|
WHEN QUARTER(CURDATE()) IN (2) THEN '04' |
|
|
|
|
|
WHEN QUARTER(CURDATE()) IN (3) THEN '07' |
|
|
|
|
|
ELSE '10' END) |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m') <= CONCAT(YEAR(CURDATE()), '-', |
|
|
|
|
|
CASE WHEN QUARTER(CURDATE()) IN (1) THEN '03' |
|
|
|
|
|
WHEN QUARTER(CURDATE()) IN (2) THEN '06' |
|
|
|
|
|
WHEN QUARTER(CURDATE()) IN (3) THEN '09' |
|
|
|
|
|
ELSE '12' END) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.dateType != null and bo.dateType == 3"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.dateSearch != null and bo.dateSearch != ''"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m') = #{bo.dateSearch} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.beginTime != null and bo.beginTime != ''"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m-%d') >= #{bo.beginTime} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="bo.endTime != null and bo.endTime != ''"> |
|
|
|
|
|
AND DATE_FORMAT(r.enforcement_time, '%Y-%m-%d') <= #{bo.endTime} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="dataFilter != null and dataFilter != ''"> |
|
|
|
|
|
${dataFilter} |
|
|
|
|
|
</if> |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 报表分页列表查询 --> |
|
|
<!-- 报表分页列表查询 --> |
|
|
|