SeatMapper.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Licensed to the Apache Software Foundation (ASF) under one or more
  4. ~ contributor license agreements. See the NOTICE file distributed with
  5. ~ this work for additional information regarding copyright ownership.
  6. ~ The ASF licenses this file to You under the Apache License, Version 2.0
  7. ~ (the "License"); you may not use this file except in compliance with
  8. ~ the License. You may obtain a copy of the License at
  9. ~
  10. ~ http://www.apache.org/licenses/LICENSE-2.0
  11. ~
  12. ~ Unless required by applicable law or agreed to in writing, software
  13. ~ distributed under the License is distributed on an "AS IS" BASIS,
  14. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. ~ See the License for the specific language governing permissions and
  16. ~ limitations under the License.
  17. -->
  18. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  19. <mapper namespace="com.sf.mapper.SeatMapper">
  20. <!-- 获取列车车厢余票集合 -->
  21. <select id="listSeatRemainingTicket" parameterType="com.sf.entity.SeatDO"
  22. resultType="Integer">
  23. select count(*) as count
  24. from t_seat
  25. where train_id = #{seatDO.trainId}
  26. and start_station = #{seatDO.startStation}
  27. and end_station = #{seatDO.endStation}
  28. and seat_status = '0'
  29. and carriage_number in
  30. <foreach collection="trainCarriageList" item="carriage" open="(" separator="," close=")">
  31. #{carriage}
  32. </foreach>
  33. group by carriage_number
  34. </select>
  35. <select id="listSeatTypeCount" resultType="com.sf.dto.domain.SeatTypeCountDTO">
  36. select seat_type as seatType, count(*) as seatCount
  37. from t_seat
  38. where train_id = #{trainId}
  39. and start_station = #{startStation}
  40. and end_station = #{endStation}
  41. and seat_status = '0'
  42. and seat_type in
  43. <foreach collection="seatTypes" item="seatType" open="(" separator="," close=")">
  44. #{seatType}
  45. </foreach>
  46. group by seat_type
  47. having seatCount > 0
  48. </select>
  49. </mapper>