浏览代码

首页折线图优化

WXF 3 年之前
父节点
当前提交
ce0c5911ff
共有 1 个文件被更改,包括 11 次插入12 次删除
  1. 11 12
      simulation-resource-server/src/main/resources/mapper/home/HomePageMapper.xml

+ 11 - 12
simulation-resource-server/src/main/resources/mapper/home/HomePageMapper.xml

@@ -14,18 +14,17 @@
     </select>
 
     <select id="selectRunProjectChart" parameterType="java.util.Map" resultType="api.common.pojo.vo.home.LineChartVO">
-        select count(id) from simulation_manual_project
-        where
-        is_deleted = '0'
-        <if test="createUserId != null and createUserId != ''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
-        </if>
-        <if test="startDate != null">
-            and start_time &gt;= #{startDate}
-        </if>
-        <if test="endDate != null">
-            and start_time &lt;= #{endDate}
-        </if>
+        SELECT
+          COUNT(1) as num,
+          DATE(t.start_time) as toDate
+        FROM(
+          SELECT start_time FROM simulation_manual_project
+          WHERE start_time >= #{dateBegin,jdbcType=VARCHAR} and create_user_id = #{createUserId,jdbcType=VARCHAR}
+          UNION ALL
+          SELECT start_time FROM simulation_automatic_subproject
+          WHERE start_time >= #{dateBegin,jdbcType=VARCHAR} and create_user_id = #{createUserId,jdbcType=VARCHAR}) as t
+        GROUP BY DATE(t.start_time)
+        ORDER BY toDate ASC
     </select>
 
 </mapper>