214 lines
7.6 KiB
XML
214 lines
7.6 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.ticket.mapper.ZdyTicketApplicablePeriodMapper">
|
||
|
|
||
|
<resultMap type="ZdyTicketApplicablePeriod" id="ZdyTicketApplicablePeriodResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="ticketId" column="ticket_id"/>
|
||
|
<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="remark" column="remark"/>
|
||
|
<result property="timeQuantum" column="time_quantum"/>
|
||
|
<result property="inventory" column="inventory"/>
|
||
|
<result property="price" column="price"/>
|
||
|
<result property="isInventory" column="is_inventory"/>
|
||
|
<result property="isPrice" column="is_price"/>
|
||
|
<result property="playTime" column="play_time"/>
|
||
|
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyTicketApplicablePeriodVo">
|
||
|
select id,
|
||
|
ticket_id,
|
||
|
create_time,
|
||
|
create_by,
|
||
|
update_time,
|
||
|
update_by,
|
||
|
remark,
|
||
|
time_quantum,
|
||
|
inventory,
|
||
|
price,
|
||
|
is_inventory,
|
||
|
is_price,
|
||
|
play_time
|
||
|
from zdy_ticket_applicable_period
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyTicketApplicablePeriodList" parameterType="ZdyTicketApplicablePeriod"
|
||
|
resultMap="ZdyTicketApplicablePeriodResult">
|
||
|
<include refid="selectZdyTicketApplicablePeriodVo"/>
|
||
|
<where>
|
||
|
<if test="ticketId != null ">
|
||
|
and ticket_id = #{ticketId}
|
||
|
</if>
|
||
|
<if test="playTime != null ">
|
||
|
and play_time = #{playTime}
|
||
|
</if>
|
||
|
<if test="timeQuantum != null ">
|
||
|
and time_quantum = #{timeQuantum}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyTicketApplicablePeriodById" parameterType="Long"
|
||
|
resultMap="ZdyTicketApplicablePeriodResult">
|
||
|
<include refid="selectZdyTicketApplicablePeriodVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyTicketApplicablePeriod" parameterType="ZdyTicketApplicablePeriod" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_ticket_applicable_period
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="ticketId != null">ticket_id,
|
||
|
</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>
|
||
|
<if test="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="timeQuantum != null">time_quantum,
|
||
|
</if>
|
||
|
<if test="inventory != null">inventory,
|
||
|
</if>
|
||
|
<if test="price != null">price,
|
||
|
</if>
|
||
|
<if test="isInventory != null">is_inventory,
|
||
|
</if>
|
||
|
<if test="isPrice != null">is_price,
|
||
|
</if>
|
||
|
<if test="playTime != null">play_time,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="ticketId != null">#{ticketId},
|
||
|
</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>
|
||
|
<if test="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="timeQuantum != null">#{timeQuantum},
|
||
|
</if>
|
||
|
<if test="inventory != null">#{inventory},
|
||
|
</if>
|
||
|
<if test="price != null">#{price},
|
||
|
</if>
|
||
|
<if test="isInventory != null">#{isInventory},
|
||
|
</if>
|
||
|
<if test="isPrice != null">#{isPrice},
|
||
|
</if>
|
||
|
<if test="playTime != null">#{playTime},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyTicketApplicablePeriod" parameterType="ZdyTicketApplicablePeriod">
|
||
|
update zdy_ticket_applicable_period
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="ticketId != null">ticket_id =
|
||
|
#{ticketId},
|
||
|
</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>
|
||
|
<if test="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="timeQuantum != null">time_quantum =
|
||
|
#{timeQuantum},
|
||
|
</if>
|
||
|
<if test="inventory != null">inventory =
|
||
|
#{inventory},
|
||
|
</if>
|
||
|
<if test="price != null">price =
|
||
|
#{price},
|
||
|
</if>
|
||
|
<if test="isInventory != null">is_inventory =
|
||
|
#{isInventory},
|
||
|
</if>
|
||
|
<if test="isPrice != null">is_price =
|
||
|
#{isPrice},
|
||
|
</if>
|
||
|
<if test="playTime != null">play_time =
|
||
|
#{playTime},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyTicketApplicablePeriodById" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_ticket_applicable_period
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyTicketApplicablePeriodByIds" parameterType="String">
|
||
|
delete from zdy_ticket_applicable_period where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
<delete id="deleteZdyTicketApplicablePeriodByTicketId" >
|
||
|
delete
|
||
|
from zdy_ticket_applicable_period
|
||
|
where ticket_id = #{ticketId} and play_time = #{playTime}
|
||
|
</delete>
|
||
|
<delete id="deleteByTicketId">
|
||
|
delete
|
||
|
from zdy_ticket_applicable_period
|
||
|
where ticket_id = #{ticketId}
|
||
|
</delete>
|
||
|
|
||
|
<select id="selectZdyTicketApplicablePeriodByTicketId" parameterType="Long"
|
||
|
resultMap="ZdyTicketApplicablePeriodResult">
|
||
|
<include refid="selectZdyTicketApplicablePeriodVo"/>
|
||
|
where ticket_id = #{ticketId}
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyTicketApplicablePeriodByTicketIdAndTime" parameterType="com.zhwl.ticket.domain.dto.TimeInventoryDTO"
|
||
|
resultMap="ZdyTicketApplicablePeriodResult">
|
||
|
<include refid="selectZdyTicketApplicablePeriodVo"/>
|
||
|
where ticket_id = #{ticketId} and time_quantum = #{timeQuantum} and play_time = #{playTime} limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="selectInventoryByParam" parameterType="com.zhwl.ticket.domain.dto.TimeInventoryDTO"
|
||
|
resultType="Long">
|
||
|
select sum(inventory) as inventory
|
||
|
from zdy_ticket_applicable_period
|
||
|
where ticket_id = #{ticketId}
|
||
|
<choose>
|
||
|
<when test="playTime != null">
|
||
|
and play_time = #{playTime}
|
||
|
</when>
|
||
|
<otherwise>
|
||
|
and play_time >= now()
|
||
|
</otherwise>
|
||
|
</choose>
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|