InvoiceManageExtendMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.idea.invoice.mapper.InvoiceManageExtendMapper">
  4. <select id="listByModel" resultType="com.idea.invoice.dto.InvoiceManageDto">
  5. select i.*,cm.id contractId,cm.contract_number,cm.record_number,cm.buyer_name,cm.house_name,
  6. ifnull(cm.buyer_money,0) buyer_money,
  7. ifnull(cm.maintenance_total_price,0) maintenance_total_price,
  8. ifnull(cm.total_price,0) receivable_money,
  9. cm.collection_status,cm.fund_collection_status
  10. from invoice_manage i
  11. left join idea_settle_down.contract_manage cm on i.contract_id = cm.id
  12. <where>
  13. <if test="type !=null and type !=''">
  14. and i.type = #{type}
  15. </if>
  16. <if test="buyerName !=null and buyerName !=''">
  17. and cm.buyer_name like concat('%',#{buyerName},'%')
  18. </if>
  19. <if test="houseName !=null and houseName !=''">
  20. and cm.house_name like concat('%',#{houseName},'%')
  21. </if>
  22. <if test="sendStatus !=null and sendStatus !=''">
  23. and i.send_status = #{sendStatus}
  24. </if>
  25. <if test="sendDateFrom !=null and sendDateFrom !=''">
  26. and i.submit_time >= #{sendDateFrom}
  27. </if>
  28. <if test="sendDateTo !=null and sendDateTo !=''">
  29. and i.submit_time &lt;= #{sendDateTo}
  30. </if>
  31. <if test="invoiceStatus !=null and invoiceStatus !=''">
  32. and i.invoice_status = #{invoiceStatus}
  33. </if>
  34. <if test="invoiceDateFrom !=null and invoiceDateFrom !=''">
  35. and i.invoice_date >= #{invoiceDateFrom}
  36. </if>
  37. <if test="invoiceDateTo !=null and invoiceDateTo !=''">
  38. and i.invoice_date &lt;= #{sendDateTo}
  39. </if>
  40. <if test="houseId !=null and houseId !=''">
  41. cm.house_id = #{houseId}
  42. </if>
  43. </where>
  44. order by i.create_time desc
  45. </select>
  46. <select id="selectNeedRefreshStatusList" resultType="com.idea.invoice.model.InvoiceManage">
  47. select * from invoice_manage where nc_code is null or nc_code = ''
  48. </select>
  49. </mapper>