left join we_customer wc on wccm.from_id = wc.external_userid and (case when LOCATE('wm', wccm.from_id) or LOCATE('wo', wccm.from_id) then 0 else 1 end) = 0
left join we_customer wc on wccm.from_id = wc.external_userid and (case when LOCATE('wm', wccm.from_id) or LOCATE('wo', wccm.from_id) then 0 else 1 end) = 0
<where>
<where>
<iftest="fromId != null and fromId != ''">
<iftest="fromId != null and fromId != ''">
and wccm.from_id = #{fromId}
and (wccm.from_id = #{fromId} or wccm.to_list = #{fromId})
</if>
</if>
<iftest="toList != null and toList != ''">
<iftest="toList != null and toList != ''">
and wccm.to_list = #{toList}
and (wccm.to_list = #{toList} or wccm.from_id = #{toList})