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

149 lines
5.4 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.ZdyTicketSpecialAreaMapper">
<resultMap type="ZdyTicketSpecialArea" id="ZdyTicketSpecialAreaResult">
<result property="id" column="id"/>
<result property="ticketId" column="ticket_id"/>
<result property="provinceName" column="province_name"/>
<result property="cityName" column="city_name"/>
<result property="areaName" column="area_name"/>
<result property="provinceCode" column="province_code"/>
<result property="cityCode" column="city_code"/>
<result property="areaCode" column="area_code"/>
</resultMap>
<sql id="selectZdyTicketSpecialAreaVo">
select id,
ticket_id,
province_name,
city_name,
area_name,
province_code,
city_code,
area_code
from zdy_ticket_special_area
</sql>
<select id="selectZdyTicketSpecialAreaList" parameterType="ZdyTicketSpecialArea"
resultMap="ZdyTicketSpecialAreaResult">
<include refid="selectZdyTicketSpecialAreaVo"/>
<where>
<if test="ticketId != null ">
and ticket_id = #{ticketId}
</if>
<if test="provinceName != null and provinceName != ''">
and province_name like concat('%', #{provinceName}, '%')
</if>
<if test="cityName != null and cityName != ''">
and city_name like concat('%', #{cityName}, '%')
</if>
<if test="areaName != null and areaName != ''">
and area_name like concat('%', #{areaName}, '%')
</if>
<if test="provinceCode != null ">
and province_code = #{provinceCode}
</if>
<if test="cityCode != null ">
and city_code = #{cityCode}
</if>
<if test="areaCode != null ">
and area_code = #{areaCode}
</if>
</where>
</select>
<select id="selectZdyTicketSpecialAreaById" parameterType="Long"
resultMap="ZdyTicketSpecialAreaResult">
<include refid="selectZdyTicketSpecialAreaVo"/>
where id = #{id}
</select>
<insert id="insertZdyTicketSpecialArea" parameterType="ZdyTicketSpecialArea" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_special_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketId != null">ticket_id,
</if>
<if test="provinceName != null and provinceName != ''">province_name,
</if>
<if test="cityName != null and cityName != ''">city_name,
</if>
<if test="areaName != null and areaName != ''">area_name,
</if>
<if test="provinceCode != null">province_code,
</if>
<if test="cityCode != null">city_code,
</if>
<if test="areaCode != null">area_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketId != null">#{ticketId},
</if>
<if test="provinceName != null and provinceName != ''">#{provinceName},
</if>
<if test="cityName != null and cityName != ''">#{cityName},
</if>
<if test="areaName != null and areaName != ''">#{areaName},
</if>
<if test="provinceCode != null">#{provinceCode},
</if>
<if test="cityCode != null">#{cityCode},
</if>
<if test="areaCode != null">#{areaCode},
</if>
</trim>
</insert>
<update id="updateZdyTicketSpecialArea" parameterType="ZdyTicketSpecialArea">
update zdy_ticket_special_area
<trim prefix="SET" suffixOverrides=",">
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="provinceName != null and provinceName != ''">province_name =
#{provinceName},
</if>
<if test="cityName != null and cityName != ''">city_name =
#{cityName},
</if>
<if test="areaName != null and areaName != ''">area_name =
#{areaName},
</if>
<if test="provinceCode != null">province_code =
#{provinceCode},
</if>
<if test="cityCode != null">city_code =
#{cityCode},
</if>
<if test="areaCode != null">area_code =
#{areaCode},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketSpecialAreaById" parameterType="Long">
delete
from zdy_ticket_special_area
where id = #{id}
</delete>
<delete id="deleteZdyTicketSpecialAreaByIds" parameterType="String">
delete from zdy_ticket_special_area where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteZdyTicketSpecialAreaByTicketId" parameterType="Long">
delete
from zdy_ticket_special_area
where ticket_id = #{ticketId}
</delete>
</mapper>