SELECT * FROM (SELECT t.*,ROWNUM FROM ( select s.id as tripapproval_id,
t.id as travel_id,w.id as travel_id2,
w.employee_num,
s.res_app_id,
w.id as employee_id,
t.begin_city,
t.destination_city,
t.begin_date,
t.end_date,
w.employee_name,
t.travel_type
from cs s, bt t, cw w
where s.id = t.tripapproval_id
and t.tripapproval_id=w.tripapproval_id
and s.id = w.tripapproval_id
and s.enable_flag = 1
and t.enable_flag = 1
and w.enable_flag = 1
<if test='resAppId != null and resAppId!=""'>
and s.res_app_id = #{resAppId}
</if>
<if test='travelId != null and travelId!=""'>
and t.id = #{travelId}
</if>
<if test='travelId2 != null and travelId2!=""'>
and w.id = #{travelId2}
</if>
<if test='tripapprovalId != null and tripapprovalId!=""'>
and s.id = #{tripapprovalId}
</if>
<if test='employeeName != null and employeeName!=""'>
and w.employee_name = #{employeeName}
</if>
order by s.APPLY_DATE desc) t)
需要多套几层