left join t_trial_drive_shop ttds on ttds.created_by = tu.id and ttds.del_flag = 0
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on
ta.biz_id = tefc.id and ta.biz_type = 1
where tef.del_flag = 0
and tef.biz_fence_type = 12
<iftest="term != null and term !=''">
...
...
@@ -122,7 +138,8 @@
left join t_user tu on tu.id = tef.created_by
left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on