ContractPropertyDao.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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="platform.modules.build.dao.ContractPropertyDao">
  4. <select id="findLatestByContractId" resultType="platform.modules.build.entity.ContractProperty">
  5. SELECT * FROM y_contract_property u WHERE u.contract_id = #{contract_id}
  6. and u.fee_type = #{fee_type} and u.del_flag=0
  7. order by u.create_time desc ,pay_time desc limit 1
  8. </select>
  9. <select id="findDueProperty" resultType="platform.modules.build.entity.ContractProperty"
  10. parameterType="platform.modules.build.DTO.PropertyDto">
  11. SELECT
  12. t.*,
  13. (t.price*t.number*t.payment_cycle) as total_fee
  14. FROM y_contract_property t
  15. left join y_contract contract on t.contract_id=contract.id
  16. WHERE
  17. contract.del_flag = '0'
  18. and t.build_id = #{build_id}
  19. and t.del_flag=0 and t.actural_paid_date is null
  20. and datediff( t.pay_time,curdate()) &lt;= contract.remind_day
  21. <if test="company_id!=null">
  22. and t.company_id=#{company_id}
  23. </if>
  24. order by t.pay_time limit #{count}
  25. </select>
  26. <update id="deleteByContractId">
  27. update y_contract_property set del_flag=1
  28. where contract_id=#{contract_id} and fee_type=#{type}
  29. </update>
  30. <select id="isExistPayTime" resultType="Integer">
  31. SELECT count(id) FROM y_contract_property property
  32. WHERE property.pay_time = #{pay_time} and property.contract_no=#{contract_no}
  33. and property.fee_type = #{fee_type}
  34. </select>
  35. </mapper>