zhwl/zhwl-business/zhwl-ticket/target/classes/mapper/cinema/ZdyCinemaHallMapper.xml
2025-07-01 17:54:58 +08:00

225 lines
8.8 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.ZdyCinemaHallMapper">
<resultMap type = "ZdyCinemaHall" id = "ZdyCinemaHallResult">
<result property = "hallId" column = "hall_id"/>
<result property = "hallName" column = "hall_name"/>
<result property = "hallAddress" column = "hall_address"/>
<result property = "rowStart" column = "row_start"/>
<result property = "rowNums" column = "row_nums"/>
<result property = "seatNumsRow" column = "seat_nums_row"/>
<result property = "seatNums" column = "seat_nums"/>
<result property = "seatState" column = "seat_state"/>
<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"/>
<result property = "zoneCount" column = "zoneCount"/>
<collection property = "zdyCinemaHallZoneList"
javaType = "java.util.List"
column = "hall_id"
ofType = "ZdyCinemaHallZone"
select = "selectZdyCinemaHallZoneList"/>
</resultMap>
<resultMap type = "ZdyCinemaHallZone" id = "ZdyCinemaHallZoneResult">
<result property = "zoneId" column = "zone_id"/>
<result property = "hallId" column = "hall_id"/>
<result property = "zoneName" column = "zone_name"/>
<result property = "seatSet" column = "seat_set"/>
</resultMap>
<sql id = "selectZdyCinemaHallVo">
select a.hall_id,
a.hall_name,
a.hall_address,
a.row_start,
a.row_nums,
a.seat_nums_row,
a.seat_nums,
a.seat_state,
a.del_state,
a.create_time,
a.create_by,
a.update_time,
a.update_by
from zdy_cinema_hall a
</sql>
<select id = "selectZdyCinemaHallList" parameterType = "ZdyCinemaHall" resultMap = "ZdyCinemaHallResult">
<include refid = "selectZdyCinemaHallVo"/>
<where>
<if test = "hallName != null and hallName != ''">
and a.hall_name like concat('%', #{hallName}, '%')
</if>
<if test = "hallAddress != null and hallAddress != ''">
and a.hall_address = #{hallAddress}
</if>
<if test = "rowStart != null ">
and a.row_start = #{rowStart}
</if>
<if test = "rowNums != null ">
and a.row_nums = #{rowNums}
</if>
<if test = "seatNumsRow != null ">
and a.seat_nums_row = #{seatNumsRow}
</if>
<if test = "seatNums != null ">
and a.seat_nums = #{seatNums}
</if>
<if test = "seatState != null and seatState != ''">
and a.seat_state = #{seatState}
</if>
<if test = "delState != null ">
and a.del_state = #{delState}
</if>
</where>
order by a.update_time desc
</select>
<select id = "selectZdyCinemaHallZoneList" parameterType = "Long" resultMap = "ZdyCinemaHallZoneResult">
select c.*
from zdy_cinema_hall_zone c
where c.hall_id = #{hallId}
</select>
<select id = "selectZdyCinemaHallByHallId" parameterType = "Long" resultMap = "ZdyCinemaHallResult">
<include refid = "selectZdyCinemaHallVo"/>
where a.hall_id = #{hallId}
</select>
<insert id = "insertZdyCinemaHall" parameterType = "ZdyCinemaHall" useGeneratedKeys = "true" keyProperty = "hallId">
insert into zdy_cinema_hall
<trim prefix = "(" suffix = ")" suffixOverrides = ",">
<if test = "hallName != null and hallName != ''">hall_name,
</if>
<if test = "hallAddress != null and hallAddress != ''">hall_address,
</if>
<if test = "rowStart != null">row_start,
</if>
<if test = "rowNums != null">row_nums,
</if>
<if test = "seatNumsRow != null">seat_nums_row,
</if>
<if test = "seatNums != null">seat_nums,
</if>
<if test = "seatState != null and seatState != ''">seat_state,
</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 = "hallName != null and hallName != ''">#{hallName},
</if>
<if test = "hallAddress != null and hallAddress != ''">#{hallAddress},
</if>
<if test = "rowStart != null">#{rowStart},
</if>
<if test = "rowNums != null">#{rowNums},
</if>
<if test = "seatNumsRow != null">#{seatNumsRow},
</if>
<if test = "seatNums != null">#{seatNums},
</if>
<if test = "seatState != null and seatState != ''">#{seatState},</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 = "updateZdyCinemaHall" parameterType = "ZdyCinemaHall">
update zdy_cinema_hall
<trim prefix = "SET" suffixOverrides = ",">
<if test = "hallName != null and hallName != ''">hall_name = #{hallName},
</if>
<if test = "hallAddress != null and hallAddress != ''">hall_address = #{hallAddress},
</if>
<if test = "rowStart != null">row_start = #{rowStart},
</if>
<if test = "rowNums != null">row_nums = #{rowNums},
</if>
<if test = "seatNumsRow != null">seat_nums_row = #{seatNumsRow},
</if>
<if test = "seatNums != null">seat_nums = #{seatNums},
</if>
<if test = "seatState != null and seatState != ''">seat_state = #{seatState},
</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 hall_id = #{hallId}
</update>
<delete id = "deleteZdyCinemaHallByHallId" parameterType = "Long">
delete
from zdy_cinema_hall
where hall_id = #{hallId}
</delete>
<delete id = "deleteZdyCinemaHallByHallIds" parameterType = "String">
delete from zdy_cinema_hall where hall_id in
<foreach item = "hallId" collection = "array" open = "(" separator = "," close = ")">
#{hallId}
</foreach>
</delete>
<delete id = "deleteZdyCinemaHallZoneByHallIds" parameterType = "String">
delete from zdy_cinema_hall_zone where hall_id in
<foreach item = "hallId" collection = "array" open = "(" separator = "," close = ")">
#{hallId}
</foreach>
</delete>
<delete id = "deleteZdyCinemaHallZoneByHallId" parameterType = "Long">
delete
from zdy_cinema_hall_zone
where hall_id = #{hallId}
</delete>
<insert id = "batchZdyCinemaHallZone">
insert into zdy_cinema_hall_zone ( zone_id , hall_id , zone_name , seat_set) values
<foreach item = "item" index = "index" collection = "list" separator = ",">
( #{item.zoneId
}, #{item.hallId
}, #{item.zoneName
}, #{item.seatSet
})
</foreach>
</insert>
<select id="existsHallName" parameterType="ZdyCinemaHall" resultType="java.lang.Boolean">
SELECT EXISTS(SELECT 1
FROM zdy_cinema_hall
WHERE hall_name = #{hallName}
<if test="hallId != null">
AND hall_id != #{hallId}
</if>
)
</select>
</mapper>