<?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.xxfc.platform.tour.mapper.TourTagMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.xxfc.platform.tour.entity.TourTag" id="tourTagMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="img" column="img"/>
        <result property="describe" column="describe"/>
        <result property="link" column="link"/>
        <result property="isHot" column="is_hot"/>
        <result property="count" column="count"/>
        <result property="rank" column="rank"/>
        <result property="ctrTime" column="ctr_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="isDel" column="is_del"/>
    </resultMap>

    <insert id="save" useGeneratedKeys="true" keyProperty="id" keyColumn="id" parameterType="com.xxfc.platform.tour.dto.TourTagDTO">
        insert tour_tag(`name`,`img`,`describe`,`rank`,`ctr_time`)
        values(#{name},#{img},#{describe},#{rank},#{ctrTime})
    </insert>

    <select id="findByTagName" resultMap="tourTagMap">
        select * from tour_tag where name=#{name} <if test="id!=null">
        AND `id` not in (#{id})
    </if>;
    </select>
</mapper>