VoyageMapper.xml 2.1 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.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="selectVoyageListByShipIdAndDate"
  15. resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO">
  16. select w.id voyage_id, w.name as voyage_name,
  17. s.id ship_id, s.name as ship_name, s.short_name as ship_short_name,
  18. r.id route_id, r.name as route_name, r.short_name as route_short_name,
  19. r.duration, r.price as route_price, r.direction
  20. from product_voyage w
  21. inner join resource_ship s on w.ship_id = s.id
  22. inner join resource_route r on w.route_id = r.id
  23. INNER JOIN product_price_voyage t on w.id = t.voyage_id
  24. where w.deleted = 0 and r.deleted = 0 and s.deleted = 0 and t.deleted = 0
  25. and w.channel like '%2%'
  26. and w.start_time > now()
  27. <if test="shipId != null and shipId != ''">
  28. and w.ship_id = #{shipId}
  29. </if>
  30. <if test="date != null and date != ''">
  31. and w.start_time >= #{date}
  32. and w.start_time &lt;= CONCAT(#{date},' 23:59:59')
  33. </if>
  34. and w.shelf_status = 1
  35. </select>
  36. </mapper>