165 lines
9.1 KiB
XML
165 lines
9.1 KiB
XML
<?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.zhwl.cinema.mapper.ZdyCinemaMovieMapper">
|
|
|
|
<resultMap type = "ZdyCinemaMovie" id = "ZdyCinemaMovieResult">
|
|
<result property = "movieId" column = "movie_id"/>
|
|
<result property = "movieName" column = "movie_name"/>
|
|
<result property = "movieLength" column = "movie_length"/>
|
|
<result property = "movieBeginTime" column = "movie_begin_time"/>
|
|
<result property = "movieEndTime" column = "movie_end_time"/>
|
|
<result property = "movieCategory" column = "movie_category"/>
|
|
<result property = "moviePoster" column = "movie_poster"/>
|
|
<result property = "movieAdvise" column = "movie_advise"/>
|
|
<result property = "moviePerformer" column = "movie_performer"/>
|
|
<result property = "movieIntroduction" column = "movie_introduction"/>
|
|
<result property = "movieStatus" column = "movie_status"/>
|
|
<result property = "moviePictures" column = "movie_pictures"/>
|
|
<result property = "delState" column = "del_state"/>
|
|
<result property = "createTime" column = "create_time"/>
|
|
<result property = "createBy" column = "create_by"/>
|
|
<result property = "updateTime" column = "update_time"/>
|
|
<result property = "updateBy" column = "update_by"/>
|
|
</resultMap>
|
|
|
|
<sql id = "selectZdyCinemaMovieVo">
|
|
select movie_id,
|
|
movie_name,
|
|
movie_length,
|
|
(select venue_begin_date from zdy_cinema_movie_venue where movie_id = a.movie_id order by venue_begin_date limit 1) as movie_begin_time,
|
|
(select venue_end_date from zdy_cinema_movie_venue where movie_id = a.movie_id order by venue_begin_date desc limit 1) as movie_end_time,
|
|
movie_category,
|
|
movie_poster,
|
|
movie_advise,
|
|
movie_performer,
|
|
movie_introduction,
|
|
movie_status,
|
|
movie_pictures,
|
|
del_state,
|
|
create_time,
|
|
create_by,
|
|
update_time,
|
|
update_by
|
|
from zdy_cinema_movie a
|
|
</sql>
|
|
|
|
<select id = "selectZdyCinemaMovieList" parameterType = "ZdyCinemaMovie" resultMap = "ZdyCinemaMovieResult">
|
|
<include refid = "selectZdyCinemaMovieVo"/>
|
|
<where>
|
|
a.del_state = 0
|
|
<if test = "movieName != null and movieName != ''">and movie_name like concat('%', #{movieName}, '%')</if>
|
|
<if test = "movieLength != null ">and movie_length = #{movieLength}</if>
|
|
<if test = "movieBeginTime != null ">and movie_begin_time = #{movieBeginTime}</if>
|
|
<if test = "movieEndTime != null ">and movie_end_time = #{movieEndTime}</if>
|
|
<if test = "movieCategory != null and movieCategory != ''">and movie_category = #{movieCategory}</if>
|
|
<if test = "moviePoster != null and moviePoster != ''">and movie_poster = #{moviePoster}</if>
|
|
<if test = "movieAdvise != null and movieAdvise != ''">and movie_advise = #{movieAdvise}</if>
|
|
<if test = "moviePerformer != null and moviePerformer != ''">and movie_performer = #{moviePerformer}</if>
|
|
<if test = "movieIntroduction != null and movieIntroduction != ''">and movie_introduction =
|
|
#{movieIntroduction}
|
|
</if>
|
|
<if test = "movieStatus != null ">and movie_status = #{movieStatus}</if>
|
|
<if test = "moviePictures != null and moviePictures != ''">and movie_pictures = #{moviePictures}</if>
|
|
<if test = "delState != null ">and del_state = #{delState}</if>
|
|
<if test = "createTimeStart != null ">and create_time >= #{createTimeStart}</if>
|
|
<if test = "createTimeEnd != null ">and create_time <= #{createTimeEnd}</if>
|
|
<if test = "updateTimeStart != null ">and update_time >= #{updateTimeStart}</if>
|
|
<if test = "updateTimeEnd != null ">and update_time <= #{updateTimeEnd}</if>
|
|
</where>
|
|
order by update_time desc
|
|
</select>
|
|
|
|
<select id = "selectZdyCinemaMovieByMovieId" parameterType = "Long" resultMap = "ZdyCinemaMovieResult">
|
|
<include refid = "selectZdyCinemaMovieVo"/>
|
|
where movie_id = #{movieId}
|
|
</select>
|
|
|
|
<insert id = "insertZdyCinemaMovie" parameterType = "ZdyCinemaMovie" useGeneratedKeys = "true"
|
|
keyProperty = "movieId">
|
|
insert into zdy_cinema_movie
|
|
<trim prefix = "(" suffix = ")" suffixOverrides = ",">
|
|
<if test = "movieName != null and movieName != ''">movie_name,</if>
|
|
<if test = "movieLength != null">movie_length,</if>
|
|
<if test = "movieBeginTime != null">movie_begin_time,</if>
|
|
<if test = "movieEndTime != null">movie_end_time,</if>
|
|
<if test = "movieCategory != null">movie_category,</if>
|
|
<if test = "moviePoster != null">movie_poster,</if>
|
|
<if test = "movieAdvise != null">movie_advise,</if>
|
|
<if test = "moviePerformer != null">movie_performer,</if>
|
|
<if test = "movieIntroduction != null">movie_introduction,</if>
|
|
<if test = "movieStatus != null">movie_status,</if>
|
|
<if test = "moviePictures != null">movie_pictures,</if>
|
|
<if test = "delState != null">del_state,</if>
|
|
<if test = "createTime != null">create_time,</if>
|
|
<if test = "createBy != null">create_by,</if>
|
|
<if test = "updateTime != null">update_time,</if>
|
|
<if test = "updateBy != null">update_by,</if>
|
|
</trim>
|
|
<trim prefix = "values (" suffix = ")" suffixOverrides = ",">
|
|
<if test = "movieName != null and movieName != ''">#{movieName},</if>
|
|
<if test = "movieLength != null">#{movieLength},</if>
|
|
<if test = "movieBeginTime != null">#{movieBeginTime},</if>
|
|
<if test = "movieEndTime != null">#{movieEndTime},</if>
|
|
<if test = "movieCategory != null">#{movieCategory},</if>
|
|
<if test = "moviePoster != null">#{moviePoster},</if>
|
|
<if test = "movieAdvise != null">#{movieAdvise},</if>
|
|
<if test = "moviePerformer != null">#{moviePerformer},</if>
|
|
<if test = "movieIntroduction != null">#{movieIntroduction},</if>
|
|
<if test = "movieStatus != null">#{movieStatus},</if>
|
|
<if test = "moviePictures != null">#{moviePictures},</if>
|
|
<if test = "delState != null">#{delState},</if>
|
|
<if test = "createTime != null">#{createTime},</if>
|
|
<if test = "createBy != null">#{createBy},</if>
|
|
<if test = "updateTime != null">#{updateTime},</if>
|
|
<if test = "updateBy != null">#{updateBy},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id = "updateZdyCinemaMovie" parameterType = "ZdyCinemaMovie">
|
|
update zdy_cinema_movie
|
|
<trim prefix = "SET" suffixOverrides = ",">
|
|
<if test = "movieName != null and movieName != ''">movie_name = #{movieName},</if>
|
|
<if test = "movieLength != null">movie_length = #{movieLength},</if>
|
|
<if test = "movieBeginTime != null">movie_begin_time = #{movieBeginTime},</if>
|
|
<if test = "movieEndTime != null">movie_end_time = #{movieEndTime},</if>
|
|
<if test = "movieCategory != null">movie_category = #{movieCategory},</if>
|
|
<if test = "moviePoster != null">movie_poster = #{moviePoster},</if>
|
|
<if test = "movieAdvise != null">movie_advise = #{movieAdvise},</if>
|
|
<if test = "moviePerformer != null">movie_performer = #{moviePerformer},</if>
|
|
<if test = "movieIntroduction != null">movie_introduction = #{movieIntroduction},</if>
|
|
<if test = "movieStatus != null">movie_status = #{movieStatus},</if>
|
|
<if test = "moviePictures != null">movie_pictures = #{moviePictures},</if>
|
|
<if test = "delState != null">del_state = #{delState},</if>
|
|
<if test = "createTime != null">create_time = #{createTime},</if>
|
|
<if test = "createBy != null">create_by = #{createBy},</if>
|
|
<if test = "updateTime != null">update_time = #{updateTime},</if>
|
|
<if test = "updateBy != null">update_by = #{updateBy},</if>
|
|
</trim>
|
|
where movie_id = #{movieId}
|
|
</update>
|
|
|
|
<update id = "deleteZdyCinemaMovieByMovieId" parameterType = "Long">
|
|
update zdy_cinema_movie
|
|
set del_state = 1
|
|
where movie_id = #{movieId}
|
|
</update>
|
|
|
|
<update id = "deleteZdyCinemaMovieByMovieIds" parameterType = "String">
|
|
update zdy_cinema_movie
|
|
set del_state = 1
|
|
where movie_id in
|
|
<foreach item = "movieId" collection = "array" open = "(" separator = "," close = ")">
|
|
#{movieId}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="existsMovieName" parameterType="ZdyCinemaMovie" resultType="java.lang.Boolean">
|
|
SELECT EXISTS(SELECT 1
|
|
FROM zdy_cinema_movie
|
|
WHERE movie_name = #{movieName}
|
|
<if test="movieId != null">
|
|
AND movie_id != #{movieId}
|
|
</if>
|
|
AND del_state = 0)
|
|
</select>
|
|
</mapper> |