PriceVoyageMapper.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.yc.ship.module.product.dal.mysql.pricevoyage.PriceVoyageMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="selectListCalendarPrice"
  11. resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageCalendarPriceRespVO">
  12. SELECT
  13. DATE_FORMAT( t1.start_time, '%Y-%m-%d' ) date,
  14. t1.id voyage_id,
  15. min( t3.price ) price
  16. FROM
  17. product_voyage t1
  18. LEFT JOIN product_price_voyage t2 ON t1.id = t2.voyage_id
  19. LEFT JOIN product_price_room_model t3 ON t2.id = t3.object_id
  20. WHERE
  21. t1.deleted = 0
  22. AND t2.deleted = 0
  23. AND t3.deleted = 0
  24. and t1.ship_id = #{reqVO.shipId}
  25. AND t1.route_id = #{reqVO.routeId}
  26. and t1.channel like '%2%'
  27. <if test="reqVO.startDate != null and reqVO.startDate != ''">
  28. AND t1.start_time >= #{reqVO.startDate}
  29. </if>
  30. <if test="reqVO.endDate != null and reqVO.endDate != ''">
  31. AND t1.start_time &lt;= CONCAT(#{reqVO.endDate},' 23:59:59')
  32. </if>
  33. </select>
  34. <select id="selectRoomModelListByVoyageId"
  35. resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppRoomModelPriceRespVO">
  36. SELECT
  37. t1.price,
  38. t1.room_model_id,
  39. t2.`name` room_model_name
  40. FROM
  41. product_price_room_model t1
  42. LEFT JOIN resource_room_model t2 ON t1.room_model_id = t2.id
  43. WHERE
  44. EXISTS (SELECT id FROM product_price_voyage WHERE voyage_id = #{voyageId} and t1.object_id= id AND deleted = 0 )
  45. AND t1.deleted = 0
  46. AND t2.deleted = 0
  47. ORDER BY
  48. t1.price ASC
  49. </select>
  50. </mapper>