zhwl/zhwl-business/zhwl-scenic/target/classes/mapper/scenic/ZdySpotGuideMapper.xml

84 lines
2.8 KiB
XML
Raw Normal View History

2025-07-01 17:54:58 +08:00
<?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.scenic.mapper.ZdySpotGuideMapper">
<resultMap type="ZdySpotGuide" id="ZdySpotGuideResult">
<result property="spotId" column="spot_id"/>
<result property="guideId" column="guide_id"/>
<result property="sort" column="sort"/>
</resultMap>
<sql id="selectZdySpotGuideVo">
select spot_id, guide_id, sort
from zdy_spot_guide
</sql>
<select id="selectZdySpotGuideList" parameterType="ZdySpotGuide" resultMap="ZdySpotGuideResult">
<include refid="selectZdySpotGuideVo"/>
<where>
<if test="sort != null ">
and sort = #{sort}
</if>
<if test="guideId != null">and guide_id = #{guideId}</if>
</where>
</select>
<select id="selectZdySpotGuideBySpotId" parameterType="Long"
resultMap="ZdySpotGuideResult">
<include refid="selectZdySpotGuideVo"/>
where spot_id = #{spotId}
</select>
<insert id="insertZdySpotGuide" parameterType="ZdySpotGuide">
insert into zdy_spot_guide
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="spotId != null">spot_id,
</if>
<if test="guideId != null">guide_id,
</if>
<if test="sort != null">sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="spotId != null">#{spotId},
</if>
<if test="guideId != null">#{guideId},
</if>
<if test="sort != null">#{sort},
</if>
</trim>
</insert>
<update id="updateZdySpotGuide" parameterType="ZdySpotGuide">
update zdy_spot_guide
<trim prefix="SET" suffixOverrides=",">
<if test="sort != null">sort =
#{sort},
</if>
</trim>
where spot_id = #{spotId} and guide_id = #{guideId}
</update>
<delete id="deleteZdySpotGuideByGuideId" parameterType="Integer">
delete
from zdy_spot_guide
where guide_id = #{guideId}
</delete>
<delete id="deleteZdySpotGuideBySpotIds" parameterType="String">
delete from zdy_spot_guide where spot_id in
<foreach item="spotId" collection="array" open="(" separator="," close=")">
#{spotId}
</foreach>
</delete>
<delete id="deleteZdySpotGuideByGuideIds" parameterType="String">
delete from zdy_spot_guide where guide_id in
<foreach item="guideId" collection="array" open="(" separator="," close=")">
#{guideId}
</foreach>
</delete>
</mapper>