|
|
@@ -134,17 +134,24 @@
|
|
|
</select>
|
|
|
<select id="countByTypeAndMonth" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- type,
|
|
|
- MONTH(report_date) AS month,
|
|
|
- COUNT(1) AS count
|
|
|
+ type,
|
|
|
+ MONTH(report_date) AS month,
|
|
|
+ COUNT(1) AS count
|
|
|
FROM u_trial_self_inspection_record
|
|
|
WHERE contract_id = #{contractId}
|
|
|
- <foreach collection="nodeIds" item="id" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- AND task_status = '已审批'
|
|
|
- AND is_deleted = 0
|
|
|
- AND DATE_FORMAT(report_date, '%Y') = #{year}
|
|
|
+ <if test="nodeIds != null and nodeIds.size() > 0">
|
|
|
+ AND node_id IN (
|
|
|
+ <foreach collection="nodeIds" item="id" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="nodeIds == null or nodeIds.size() == 0">
|
|
|
+ AND 1 = 0
|
|
|
+ </if>
|
|
|
+ AND task_status = '已审批'
|
|
|
+ AND is_deleted = 0
|
|
|
+ AND DATE_FORMAT(report_date, '%Y') = #{year}
|
|
|
GROUP BY type, MONTH(report_date)
|
|
|
ORDER BY type, month;
|
|
|
</select>
|
|
|
@@ -154,9 +161,16 @@
|
|
|
detection_result
|
|
|
FROM u_trial_self_inspection_record
|
|
|
WHERE contract_id = #{contractId}
|
|
|
- <foreach collection="nodeIds" item="id" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
+ <if test="nodeIds != null and nodeIds.size() > 0">
|
|
|
+ AND node_id IN (
|
|
|
+ <foreach collection="nodeIds" item="id" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="nodeIds == null or nodeIds.size() == 0">
|
|
|
+ AND 1 = 0
|
|
|
+ </if>
|
|
|
AND task_status = '已审批'
|
|
|
AND is_deleted = 0
|
|
|
AND DATE_FORMAT(report_date, '%Y') = #{year}
|