zhaoyun 6 mēneši atpakaļ
vecāks
revīzija
21ab32cf2a

+ 2 - 1
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/controller/ReportController.java

@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 @RestController
@@ -76,7 +77,7 @@ public class ReportController extends BaseController {
 
         ReportDayVO vo = new ReportDayVO();
         vo.setAppointmentList(appointmentlist);
-        vo.setIllegalList(illegalList);
+        vo.setIllegalList((illegalList==null||illegalList.size()==1)?new ArrayList<>():illegalList);
         vo.setPlanList(planlist);
         vo.setNextDayList(nextDayList);
         return vo;

+ 41 - 12
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmReportIllegalDayMapper.xml

@@ -26,18 +26,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectPdmReportIllegalDayList" parameterType="PdmReportIllegalDay" resultMap="PdmReportIllegalDayResult">
-        <include refid="selectPdmReportIllegalDayVo"/>
-        <where>
-            <if test="company != null  and company != ''"> and company = #{company}</if>
-            <if test="reportDate != null  and reportDate != ''"> and report_date = #{reportDate}</if>
-            <if test="provinceNum1 != null "> and province_num1 = #{provinceNum1}</if>
-            <if test="provinceNum2 != null "> and province_num2 = #{provinceNum2}</if>
-            <if test="cityNum1 != null "> and city_num1 = #{cityNum1}</if>
-            <if test="cityNum2 != null "> and city_num2 = #{cityNum2}</if>
-            <if test="countyNum1 != null "> and county_num1 = #{countyNum1}</if>
-            <if test="countyNum2 != null "> and county_num2 = #{countyNum2}</if>
-            <if test="checkNum != null "> and check_num = #{checkNum}</if>
-        </where>
+        select * from (
+            <include refid="selectPdmReportIllegalDayVo"/>
+            <where>
+                <if test="company != null  and company != ''"> and company like concat('%', #{company}, '%')</if>
+                <if test="reportDate != null  and reportDate != ''"> and report_date = #{reportDate}</if>
+                <if test="provinceNum1 != null "> and province_num1 = #{provinceNum1}</if>
+                <if test="provinceNum2 != null "> and province_num2 = #{provinceNum2}</if>
+                <if test="cityNum1 != null "> and city_num1 = #{cityNum1}</if>
+                <if test="cityNum2 != null "> and city_num2 = #{cityNum2}</if>
+                <if test="countyNum1 != null "> and county_num1 = #{countyNum1}</if>
+                <if test="countyNum2 != null "> and county_num2 = #{countyNum2}</if>
+                <if test="checkNum != null "> and check_num = #{checkNum}</if>
+            </where>
+            UNION
+            SELECT
+            sum(id) as id,
+            '总计' as company,
+            report_date,
+            sum(ifnull(province_num1,0)) province_num1,
+            sum(ifnull(province_num2,0)) province_num2,
+            sum(ifnull(city_num1,0)) city_num1,
+            sum(ifnull(city_num2,0)) city_num2,
+            sum(ifnull(county_num1,0)) county_num1,
+            sum(ifnull(county_num2,0)) county_num2,
+            sum(ifnull(check_num,0)) check_num,
+            create_by ,
+            create_time,
+            update_by,
+            update_time FROM
+            pdm_report_illegal_day
+            <where>
+                <if test="company != null  and company != ''"> and company like concat('%', #{company}, '%')</if>
+                <if test="reportDate != null  and reportDate != ''"> and report_date = #{reportDate}</if>
+                <if test="provinceNum1 != null "> and province_num1 = #{provinceNum1}</if>
+                <if test="provinceNum2 != null "> and province_num2 = #{provinceNum2}</if>
+                <if test="cityNum1 != null "> and city_num1 = #{cityNum1}</if>
+                <if test="cityNum2 != null "> and city_num2 = #{cityNum2}</if>
+                <if test="countyNum1 != null "> and county_num1 = #{countyNum1}</if>
+                <if test="countyNum2 != null "> and county_num2 = #{countyNum2}</if>
+                <if test="checkNum != null "> and check_num = #{checkNum}</if>
+            </where>) a order by id asc
     </select>
 
     <select id="selectPdmReportIllegalDayById" parameterType="Long" resultMap="PdmReportIllegalDayResult">