zhaoyun 4 月之前
父節點
當前提交
0e577eb261
共有 1 個文件被更改,包括 18 次插入27 次删除
  1. 18 27
      ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmWorkPlanMapper.xml

+ 18 - 27
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmWorkPlanMapper.xml

@@ -596,39 +596,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
         <where>
         <if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') &gt;= #{startDate}</if>
         <if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') &gt;= #{startDate}</if>
         <if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') &lt;= #{endDate}</if>
         <if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') &lt;= #{endDate}</if>
-        and EXISTS (select 1 from  pdm_construct_team t
-        INNER JOIN
-        (SELECT
-        DISTINCT team_no,SUBSTRING_INDEX( SUBSTRING_INDEX( construc_car_number, ',', n ), ',', - 1 ) AS vchicle_no
-        FROM
-        `pdm_construct_team`,
-        ( SELECT @rownum := @rownum + 1 AS n FROM ( SELECT @rownum := 0 ) r, `pdm_construct_team` ) x
-        WHERE
-        1 = 1
-        AND n &lt;= ( LENGTH( construc_car_number ) - LENGTH( REPLACE ( construc_car_number, ',', '' ) ) + 1 )
-        ORDER BY
-        id)a on a.vchicle_no=#{vehicleNo} and a.team_no=t.team_no
-        where t.team_leader=work_princip_nm
-        )
+        and EXISTS (
+            SELECT
+            DISTINCT t.*
+            FROM
+            pdm_construct_team t INNER JOIN pdm_vehicle_alarm a on a.vehicle_no like concat('%', t.construc_car_number, '%')
+            and ifnull(t.construc_car_number,'')!=''
+            WHERE
+            t.team_leader = work_princip_nm and a.vehicle_no=#{vehicleNo}
+            )
         </where>
         </where>
         UNION
         UNION
         select *  from pdm_work_plan
         select *  from pdm_work_plan
         <where>
         <where>
         <if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') &gt;= #{startDate}</if>
         <if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') &gt;= #{startDate}</if>
         <if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') &lt;= #{endDate}</if>
         <if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') &lt;= #{endDate}</if>
-         and EXISTS (select 1 from  pdm_constructor t inner JOIN
-        (SELECT
-        DISTINCT team_no,SUBSTRING_INDEX( SUBSTRING_INDEX( construc_car_number, ',', n ), ',', - 1 ) AS vchicle_no
-        FROM
-        `pdm_construct_team`,
-        ( SELECT @rownum := @rownum + 1 AS n FROM ( SELECT @rownum := 0 ) r, `pdm_construct_team` ) x
-        WHERE
-        1 = 1
-        AND n &lt;= ( LENGTH( construc_car_number ) - LENGTH( REPLACE ( construc_car_number, ',', '' ) ) + 1 )
-        ORDER BY
-        id) a on a.vchicle_no=#{vehicleNo} and a.team_no=t.team_no
-        where t.construct_personnel_name=work_princip_nm
-        )
+         and EXISTS (
+            SELECT
+            DISTINCT t.*
+            FROM
+            pdm_constructor t INNER JOIN pdm_construct_team t1  on t1.team_no=t.team_no INNER JOIN pdm_vehicle_alarm a on a.vehicle_no like concat('%', t1.construc_car_number, '%')
+            and ifnull(t1.construc_car_number,'')!=''
+            WHERE
+            t.construct_personnel_name = work_princip_nm and a.vehicle_no=#{vehicleNo}
+            )
         </where>
         </where>
     </select>
     </select>
 </mapper>
 </mapper>