SampleMapper.xml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.fjhx.sale.mapper.sample.SampleMapper">
  4. <select id="getPage" resultType="com.fjhx.sale.entity.sample.vo.SampleVo">
  5. select
  6. *
  7. from sample s
  8. ${ew.customSqlSegment}
  9. </select>
  10. <select id="sampleHandoverList" resultType="com.fjhx.sale.entity.contract.vo.ContractProductVo">
  11. SELECT
  12. t1.create_time AS ct,
  13. t1.id,
  14. t1.sample_id sampleId,
  15. t1.product_id,
  16. t2.`code` AS `contractCode`,
  17. t2.user_name AS userName,
  18. t2.versions AS contractVersion,
  19. t2.buy_corporation_id buyCorporationId,
  20. <!-- 需要采购的合同数量-->
  21. t1.expend_quantity AS expendQuantity,
  22. <!-- 交接单时间-->
  23. t3.sampleTime,
  24. <!-- 合同审批通过后的时间(每次合同审批后都会修改时间 所以取update_time) -->
  25. t2.update_time updateTime,
  26. ( SELECT create_time FROM claim_contract WHERE contract_id = t2.id ORDER BY create_time DESC LIMIT 1 ) AS claimTime
  27. FROM
  28. sample_product t1
  29. LEFT JOIN sample t2 ON t1.sample_id = t2.id
  30. <!-- 列表中只显示存在交接单的数据 获取到交接单时间最单的一条-->
  31. join(SELECT business_id,create_time sampleTime from bytesailing_base.file_info GROUP BY business_id HAVING MAX(create_time)) t3 on
  32. t2.id = t3.business_id
  33. ${ew.customSqlSegment}
  34. </select>
  35. </mapper>