select co.name AS ssgs, gr.name AS fzlb, cy.name AS lcmc,c.subject AS zt,c.createTime as lcfqsj,s.contractid as htid,c.creatorName AS cjr,e.companyname as cjrbm,s.tenantName as qyrzt,s.receiverName as jsr,c.createTime,c.comments,a.name,a.tenantname as qsr,a.completetime as qssj ,if ( c.status='COMPLETE','完成','未完成') as status from COMPANY co left join CATEGORY_GROUP gr on gr.companyId = co.id left join CATEGORY cy on cy.groupId = gr.id inner join CONTRACT c on c.categoryid=cy.id inner join SIGNATORY s on s.contractid=c.id inner join ACTION a on a.signatoryId =s.id left join EMPLOYEE f on f.userid=c.creatorId left join EMPLOYEE_DEPARTMENT h on f.id=h.employeeid left join DEPARTMENT e on co.id=e.companyid and e.id= h.departmentid where c.status <> 'DRAFT' and c.status <> 'EXPIRED' and c.status <> 'FILLING' and c.status <> 'FILLING' and c.status <> 'DELETE' AND e.type = 'SECTION' ${if(len(所属公司) == 0,"","and ssgs = '" + 所属公司 + "' ")}${if(len(分组类别) == 0,"","and fzlb = '" + 分组类别 + "' ")}${if(len(流程名称) == 0,"","and lcmc = '" + 流程名称 + "' ")}