|  |  | 
 |  |  |         BY invoice_ledger_id | 
 |  |  |         ) T6 ON T1.id = T6.invoice_ledger_id | 
 |  |  |         <where> | 
 |  |  |             <if test="c.customerName != null and c.customerName !=''"> | 
 |  |  |                 AND T3.customer_name LIKE CONCAT('%',#{c.customerName},'%') | 
 |  |  |             <if test="req.customerName != null and req.customerName !=''"> | 
 |  |  |                 AND T3.customer_name LIKE CONCAT('%',#{req.customerName},'%') | 
 |  |  |             </if> | 
 |  |  |             <if test="c.invoiceLedgerId != null"> | 
 |  |  |                 AND T1.id = #{c.invoiceLedgerId} | 
 |  |  |             <if test="req.invoiceLedgerId != null"> | 
 |  |  |                 AND T1.id = #{req.invoiceLedgerId} | 
 |  |  |             </if> | 
 |  |  |             <if test="c.customerContractNo != null and c.customerContractNo !=''"> | 
 |  |  |                 AND T3.customer_contract_no LIKE CONCAT('%',#{c.customerContractNo},'%') | 
 |  |  |             <if test="req.customerContractNo != null and req.customerContractNo !=''"> | 
 |  |  |                 AND T3.customer_contract_no LIKE CONCAT('%',#{req.customerContractNo},'%') | 
 |  |  |             </if> | 
 |  |  |             <if test="c.projectName != null and c.projectName !=''"> | 
 |  |  |                 AND T3.project_name LIKE CONCAT('%',#{c.projectName},'%') | 
 |  |  |             <if test="req.projectName != null and req.projectName !=''"> | 
 |  |  |                 AND T3.project_name LIKE CONCAT('%',#{req.projectName},'%') | 
 |  |  |             </if> | 
 |  |  |             <if test="req.invoiceDateStart != null and req.invoiceDateStart != '' "> | 
 |  |  |                 AND T1.invoice_date >= DATE_FORMAT(#{req.invoiceDateStart},'%Y-%m-%d') | 
 |  |  |             </if> | 
 |  |  |             <if test="req.invoiceDateEnd != null and req.invoiceDateEnd != '' "> | 
 |  |  |                 AND  T1.invoice_date <= DATE_FORMAT(#{req.invoiceDateEnd},'%Y-%m-%d') | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         ORDER BY T2.create_time DESC |