VoyageMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.voyage.VoyageMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="selectVovageList" resultType="com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO">
  11. select w.*,r.direction from product_voyage w inner join resource_route r on w.route_id = r.id
  12. where w.deleted = 0 and r.deleted = 0 and w.ship_id = #{shipId} and w.start_time > now() and w.shelf_status = 1 and w.channel like '%1%' order by w.create_time asc;
  13. </select>
  14. <select id="selectListCalendar2" resultType="com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO">
  15. select w.*,r.basic_price basicPrice from product_voyage w inner join product_price_voyage r on w.route_id = r.id
  16. where w.deleted = 0 and r.deleted = 0
  17. <if test="vo.shipId != null and vo.shipId != ''">
  18. and w.ship_id = #{shipId}
  19. </if>
  20. <if test="vo.startDate != null and vo.startDate != ''">
  21. and w.start_time >= #{vo.startDate}
  22. </if>
  23. <if test="vo.endDate != null and vo.endDate != ''">
  24. and w.start_time &lt;= #{vo.endDate}
  25. </if>
  26. <if test="vo.channel != null and vo.channel != ''">
  27. and w.channel like concat('%',#{vo.channel},'%')
  28. </if>
  29. and w.shelf_status = 1 order by w.start_time asc;
  30. </select>
  31. <select id="selectVoyageListByShipIdAndDate"
  32. resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO">
  33. select w.id voyage_id, w.name as voyage_name,
  34. s.id ship_id, s.name as ship_name, s.short_name as ship_short_name,
  35. r.id route_id, r.name as route_name, r.short_name as route_short_name,
  36. r.duration, r.price as route_price, r.direction
  37. from product_voyage w
  38. inner join resource_ship s on w.ship_id = s.id
  39. inner join resource_route r on w.route_id = r.id
  40. INNER JOIN product_price_voyage t on w.id = t.voyage_id
  41. where w.deleted = 0 and r.deleted = 0 and s.deleted = 0 and t.deleted = 0
  42. and w.channel like '%2%'
  43. and w.start_time > now()
  44. <if test="shipId != null and shipId != ''">
  45. and w.ship_id = #{shipId}
  46. </if>
  47. <if test="date != null and date != ''">
  48. and w.start_time >= #{date}
  49. and w.start_time &lt;= CONCAT(#{date},' 23:59:59')
  50. </if>
  51. and w.shelf_status = 1
  52. order by w.start_time asc
  53. </select>
  54. </mapper>