where z.id = x.dy_level_id and x.id = y.line_id and j.term_id = y.id and j.channel_id = k.id
and x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}
<!-- select-->
<!-- z.id as id,-->
<!-- z.name as name,-->
<!-- z.dy_value as dyvalue,-->
<!-- x.id as line_id,-->
<!-- x.name as line_name,-->
<!-- x.bs_manufacturer as bs_manufacturer,-->
<!-- y.id as term_id,-->
<!-- y.tower_id as tower_id,-->
<!-- y.cmdid as cmdid,-->
<!-- y.display_name as display_name,-->
<!-- k.id as channel_id,-->
<!-- k.channel_name as channel_name,-->
<!-- l.schedule_id as schedule_id-->
<!-- from `lines` x,-->
<!-- terminals y,-->
<!-- dy_level z,-->
<!-- terminal_channel_mapper j,-->
<!-- terminal_channels k,-->
<!-- terminal_schedulemapper l-->
<!-- where z.id = x.dy_level_id and x.id = y.line_id and j.term_id = y.id and j.channel_id = k.id and y.id = l.term_id and j.channel_id = l.channel_id-->
<!-- and x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}-->
<!-- <if test="termid != null">-->
<!-- and y.id = #{termid}-->
<!-- </if>-->
SELECT
z.id AS id,
z.name AS name,
z.dy_value AS dyvalue,
x.id AS line_id,
x.name AS line_name,
x.bs_manufacturer AS bs_manufacturer,
y.id AS term_id,
y.tower_id AS tower_id,
y.cmdid AS cmdid,
y.display_name AS display_name,
k.id AS channel_id,
k.channel_name AS channel_name,
l.schedule_id AS schedule_id
FROM
(((((dy_level z
left JOIN `lines` x ON z.id = x.dy_level_id)
left JOIN terminals y ON x.id = y.line_id)
left JOIN terminal_channel_mapper j ON j.term_id = y.id)
left JOIN terminal_channels k ON j.channel_id = k.id)
left JOIN terminal_schedulemapper l ON j.channel_id = l.channel_id)
where
x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}