PaymentMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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="cn.com.ty.lift.business.contract.dao.mapper.PaymentMapper" >
  4. <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.contract.dao.entity.Payment" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="contracts_id" property="contractsId" jdbcType="BIGINT" />
  7. <result column="type" property="type" jdbcType="INTEGER" />
  8. <result column="summary" property="summary" jdbcType="VARCHAR" />
  9. <result column="plan_money" property="planMoney" jdbcType="DECIMAL" />
  10. <result column="work_money" property="workMoney" jdbcType="DECIMAL" />
  11. <result column="plan_date" property="planDate" jdbcType="TIMESTAMP" />
  12. <result column="work_date" property="workDate" jdbcType="TIMESTAMP" />
  13. <result column="cashier_user" property="cashierUser" jdbcType="BIGINT" />
  14. <result column="is_ticket" property="isTicket" jdbcType="INTEGER" />
  15. <result column="is_collection" property="isCollection" jdbcType="INTEGER" />
  16. <result column="remarks" property="remarks" jdbcType="LONGVARCHAR" />
  17. <result column="status" property="status" jdbcType="INTEGER" />
  18. <result column="note_img_url" property="noteImgUrl" jdbcType="LONGVARCHAR" />
  19. <result column="bank_img_url" property="bankImgUrl" jdbcType="LONGVARCHAR" />
  20. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  21. <result column="code" property="code" jdbcType="VARCHAR" />
  22. <result column="amount_invoice" property="amountInvoice" jdbcType="DECIMAL" />
  23. <result column="billing_date" property="billingDate" jdbcType="TIMESTAMP" />
  24. <result column="number_periods" property="numberPeriods" jdbcType="INTEGER" />
  25. </resultMap>
  26. <sql id="Base_Column_List" >
  27. id, contracts_id, type, summary, plan_money, work_money, plan_date, work_date, cashier_user,
  28. is_ticket, is_collection, remarks, status, note_img_url, bank_img_url, create_date, code, amount_invoice, billing_date,
  29. number_periods
  30. </sql>
  31. <select id="findByCondition" parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.PaymentRequest"
  32. resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.PaymentResponse">
  33. SELECT
  34. p.id AS projectId,
  35. c.id AS contractId,
  36. c.code AS contractCode,
  37. p.project_name AS projectName,
  38. pa.code AS paymentCode,
  39. pa.plan_money AS receivableAmount,
  40. pa.work_money AS receivedAmount,
  41. (pa.plan_money - pa.work_money) AS unCollectedAmount,
  42. pa.cashier_user AS cashierUser
  43. FROM contracts c
  44. LEFT JOIN payment pa ON c.id = pa.contracts_id
  45. LEFT JOIN project p ON c.project_id = p.id
  46. WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
  47. <if test="request.contractCode!=null and request.contractCode!=''">
  48. AND c.code LIKE CONCAT('%',#{request.contractCode,jdbcType=BIGINT},'%')
  49. </if>
  50. <if test="request.projectName!=null and request.projectName!=''">
  51. AND p.project_name LIKE CONCAT('%',#{request.projectName,jdbcType=VARCHAR},'%')
  52. </if>
  53. <if test="request.paymentType!=null and request.paymentType!=''">
  54. AND pa.type = #{request.paymentType,jdbcType=VARCHAR}
  55. </if>
  56. </select>
  57. <select id="queryContractDetailById" parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.PaymentRequest"
  58. resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.PaymentDetailResponse">
  59. SELECT
  60. p.project_name AS projectName,
  61. p.address AS projectAddress,
  62. c.code AS contractCode,
  63. c.source AS contractSource,
  64. c.type AS contractType,
  65. c.lift_num AS liftNum,
  66. c.star_date AS starDate,
  67. c.end_date AS endDate,
  68. c.pay_mode AS payMode,
  69. c.moneys AS moneys,
  70. c.given_date AS givenDate,
  71. c.given_user AS givenUser,
  72. c.remarks AS remarks
  73. FROM contracts c
  74. LEFT JOIN project p ON c.project_id = p.id
  75. WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
  76. <if test="request.id!=null and request.id!=''">
  77. AND c.id = #{request.id,jdbcType=BIGINT}
  78. </if>
  79. </select>
  80. </mapper>