<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.modules.workreimbursementcount.dao.WorkInvoiceInfoDao">
	<select id="findInfoList" resultType="WorkInvoiceInfo" >
		select a.id
        ,a.code as invoiceCode
        ,a.number
        ,a.total_money totalMoney
        ,a.income_money incomeMoney
        ,a.date
        ,a.state
        ,a.office_id officeId
        ,a.back_sign backSign
        ,t4.name clientName
        ,t3.contract_num  contractNum
        ,t3.name contractName
 from
  work_invoice_detail a
  LEFT JOIN work_invoice t1 on t1.id=a.invoice_id
  LEFT JOIN project_records t2 on t2.id = t1.project_id
  LEFT JOIN work_contract_info t3 on t3.id= t2.contract_id
  left JOIN work_client_info t4 on t1.client_id=t4.id
  where a.del_flag = '0' and a.state in ('正常','作废')
  and a.office_id=#{officeId}
		<if test="date != '' and date != null">
			AND YEAR(a.date) = #{date}
		</if>
	</select>

</mapper>