select
    bkd.kd_id,
    bkd.owner,
    bkd.knowledge_type,
    bkd.document_name,
    bkd.document_url,
    bkd.char_count,
    bkd.segmentation_config,
    bkd.document_size,
    bkd.upload_time,
    bkd.is_enable,
    bkd.knowledge_id,
    bkd.train_status
from
    biz_knowledge_document bkd
left join biz_member_knowledge_relation bmkr on bkd.kd_id = bmkr.kd_id and bmkr.is_deleted = 'N'
where bkd.is_deleted = 'N'
<<and ( bmkr.member_id = :memberId or bmkr.member_id = 2 ) >>
<<and bkd.document_name = :documentName>>
<<and bkd.train_status =:trainStatus>>
<<and locate(:searchDocumentName,bkd.document_name) >>
<<and bkd.kd_id in (:kdIds)>>
order by bkd.upload_time desc