| 1234567891011121314151617181920212223242526 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.example.cinema.data.ScheduleMapper">
- <insert id="insertOneSchedule" parameterType="com.example.cinema.vo.ScheduleForm"
- useGeneratedKeys="true" keyProperty="id">
- insert into schedule(hall_id, movie_id, start_time, end_time, fare)
- values(#{hallId}, #{movieId}, #{startTime}, #{endTime}, #{fare})
- </insert>
- <select id="selectSchedule" resultMap="ScheduleItem">
- select * from
- (select * from schedule where hall_id = #{hallId} and start_time between #{startDate} and #{endDate}) s,
- (select name, id as movie_id from movie) m,
- (select name, id as hall_id from hall) h
- where s.movie_id = m.movie_id and s.hall_id = h.hall_id
- </select>
- <resultMap id="ScheduleItem" type="com.example.cinema.vo.ScheduleItem">
- <id column="id" property="id"></id>
- <result column="hall_id" property="hallId"></result>
- <result column="movie_id" property="movieId"></result>
- <result column="start_time" property="startTime"></result>
- <result column="end_time" property="endTime"></result>
- </resultMap>
- </mapper>
|