PriceVoyageMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. LEFT JOIN resource_room_model t4 on t3.room_model_id = t4.id
  21. WHERE
  22. t1.deleted = 0
  23. AND t2.deleted = 0
  24. AND t3.deleted = 0
  25. and t1.shelf_status = 1
  26. <if test="reqVO.shipId != null and reqVO.shipId != ''">
  27. and t1.ship_id = #{reqVO.shipId}
  28. </if>
  29. <if test="reqVO.routeId != null and reqVO.routeId != ''">
  30. AND t1.route_id = #{reqVO.routeId}
  31. </if>
  32. and t1.start_time > now()
  33. and t1.channel like '%2%'
  34. and t4.can_sale = 1
  35. <if test="reqVO.startDate != null and reqVO.startDate != ''">
  36. AND t1.start_time >= #{reqVO.startDate}
  37. </if>
  38. <if test="reqVO.endDate != null and reqVO.endDate != ''">
  39. AND t1.start_time &lt;= CONCAT(#{reqVO.endDate},' 23:59:59')
  40. </if>
  41. GROUP BY
  42. t1.id
  43. order by
  44. t1.start_time ASC
  45. </select>
  46. <select id="selectRoomModelListByVoyageId"
  47. resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppRoomModelPriceRespVO">
  48. SELECT
  49. t1.price,
  50. t1.room_model_id,
  51. t2.`name` room_model_name
  52. FROM
  53. product_price_room_model t1
  54. LEFT JOIN resource_room_model t2 ON t1.room_model_id = t2.id
  55. WHERE
  56. EXISTS (SELECT id FROM product_price_voyage WHERE voyage_id = #{voyageId} and t1.object_id= id AND deleted = 0 )
  57. AND t1.deleted = 0
  58. AND t2.deleted = 0
  59. and t2.can_sale = 1
  60. ORDER BY
  61. t1.price ASC
  62. </select>
  63. </mapper>