From 67e03b179e1a257622cf2b5b21ec0610115c3bf9 Mon Sep 17 00:00:00 2001 From: chenhuan <czj123456> Date: 星期二, 28 五月 2024 17:48:40 +0800 Subject: [PATCH] Merge branch 'master' of http://117.78.1.188:8089/r/dkyChenJiang --- javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml b/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml index b364545..650f94b 100644 --- a/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml +++ b/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml @@ -52,14 +52,31 @@ SELECT MAX(id) FROM js_tub_log where project_id = #{projectId} </select> - <select id="countTubLogDate" resultMap="TubLogResult"> + <select id="countTubLogDate2" resultMap="TubLogResult"> SELECT a.tub_name, b.inbound_number, - a.outbound_number + a.outbound_number, + a.unit FROM - ( SELECT tub_name, SUM( number ) AS outbound_number FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a - LEFT JOIN ( SELECT tub_name, SUM( number ) AS inbound_number FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name + ( SELECT tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a + LEFT JOIN ( SELECT tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name + </select> + + <select id="countTubLogDate" resultMap="TubLogResult"> + SELECT + a.project_id, + a.tub_name, + b.inbound_number, + a.outbound_number, + a.unit + FROM + ( SELECT project_id, tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a + LEFT JOIN ( SELECT project_id, tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name + AND a.project_id = b.project_id + <where> + <if test="projectId != null and projectId != ''"> and a.project_id = #{projectId}</if> + </where> </select> <insert id="insertTubLog" parameterType="TubLog" useGeneratedKeys="true" keyProperty="id"> -- Gitblit v1.9.1