|
@@ -596,39 +596,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<where>
|
|
|
<if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') >= #{startDate}</if>
|
|
|
<if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') <= #{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 <= ( 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>
|
|
|
UNION
|
|
|
select * from pdm_work_plan
|
|
|
<where>
|
|
|
<if test="startDate != null and startDate!=''"> and DATE_FORMAT(plan_start_wk_tm,'%Y-%m-%d') >= #{startDate}</if>
|
|
|
<if test="endDate != null and endDate!=''"> and DATE_FORMAT(plan_end_tm,'%Y-%m-%d') <= #{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 <= ( 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>
|
|
|
</select>
|
|
|
</mapper>
|