<?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.ruoyi.system.mapper.CpsMeetingEnterpriseTripInfoMapper">

    <resultMap type="com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo" id="CpsMeetingEnterpriseTripInfoResult">
        <result property="id"    column="id"    />
        <result property="tripName"    column="trip_name"    />

        <result property="tripDateStart"    column="trip_date_start"    />
        <result property="tripDateEnd"    column="trip_date_end"    />
        <result property="tripDetail"    column="trip_detail"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectCpsMeetingEnterpriseTripInfoVo">
        select id, trip_name, trip_date_start, trip_date_end, trip_detail, update_time, create_time, create_by, update_by from cps_meeting_enterprise_trip_info
    </sql>

    <select id="selectCpsMeetingEnterpriseTripInfoList" parameterType="com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo" resultMap="CpsMeetingEnterpriseTripInfoResult">
        select id, trip_name, trip_date_start, trip_date_end, update_time, create_time, create_by, update_by from cps_meeting_enterprise_trip_info
        <where>
            <if test="tripDateStart != null "> and trip_date_start = #{tripDateStart}</if>
            <if test="tripDateEnd != null "> and trip_date_end = #{tripDateEnd}</if>
            <if test="tripDetail != null  and tripDetail != ''"> and trip_detail = #{tripDetail}</if>
        </where>
    </select>

    <select id="selectCpsMeetingEnterpriseTripInfoById" parameterType="Long" resultMap="CpsMeetingEnterpriseTripInfoResult">
        <include refid="selectCpsMeetingEnterpriseTripInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertCpsMeetingEnterpriseTripInfo" parameterType="com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo" useGeneratedKeys="true" keyProperty="id">
        insert into cps_meeting_enterprise_trip_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="tripName != null and tripName != ''">trip_name,</if>
            <if test="tripDateStart != null">trip_date_start,</if>
            <if test="tripDateEnd != null">trip_date_end,</if>
            <if test="tripDetail != null and tripDetail != ''">trip_detail,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="tripName != null and tripName != ''">#{tripName},</if>
            <if test="tripDateStart != null">#{tripDateStart},</if>
            <if test="tripDateEnd != null">#{tripDateEnd},</if>
            <if test="tripDetail != null and tripDetail != ''">#{tripDetail},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateCpsMeetingEnterpriseTripInfo" parameterType="com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo">
        update cps_meeting_enterprise_trip_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="tripName != null and tripName != ''">trip_name = #{tripName},</if>
            <if test="tripDateStart != null">trip_date_start = #{tripDateStart},</if>
            <if test="tripDateEnd != null">trip_date_end = #{tripDateEnd},</if>
            <if test="tripDetail != null and tripDetail != ''">trip_detail = #{tripDetail},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCpsMeetingEnterpriseTripInfoById" parameterType="Long">
        delete from cps_meeting_enterprise_trip_info where id = #{id}
    </delete>

    <delete id="deleteCpsMeetingEnterpriseTripInfoByIds" parameterType="String">
        delete from cps_meeting_enterprise_trip_info where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
