left join (select hygf_jp_inverter.sn_code, hygf_jp_inverter.third_station_id from hygf_jp_station left join hygf_jp_inverter on hygf_jp_station.third_station_id = hygf_jp_inverter.third_station_id) newTable on hygf_jp_station.third_station_id = newTable.third_station_id
select MAX(hjs.sequence_nbr) AS sequence_nbr,group_concat(hji.sn_code) AS nbqSnCode from hygf_jp_station hjs left join hygf_jp_inverter hji on hjs.third_station_id = hji.third_station_id
group by hjs.third_station_id
) lc
on hjs.sequence_nbr = lc.sequence_nbr
<where>
<iftest="dto.name!=null">
and hygf_jp_station.name like concat(concat('%',#{dto.name}),'%')
and hjs.name like concat(concat('%',#{dto.name}),'%')
</if>
<iftest="dto.userName!=null">
and hygf_jp_station.user_name like concat(concat('%',#{dto.userName}),'%')
and hjs.user_name like concat(concat('%',#{dto.userName}),'%')
</if>
<iftest="dto.address!=null">
and hygf_jp_station.address like concat(concat('%',#{dto.address}),'%')
and hjs.address like concat(concat('%',#{dto.address}),'%')
</if>
<iftest="dto.area!=null">
and hygf_jp_station.area like concat(concat('%',#{dto.area}),'%')
and hjs.area like concat(concat('%',#{dto.area}),'%')