<?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.project.benyi.mapper.ByThemeMonthplanitemMapper">

    <resultMap type="ByThemeMonthplanitem" id="ByThemeMonthplanitemResult">
        <result property="id" column="id"/>
        <result property="mpid" column="mpid"/>
        <result property="zc" column="zc"/>
        <result property="starttime" column="starttime"/>
        <result property="endtime" column="endtime"/>
        <result property="activityid" column="activityid"/>
        <result property="jzzc" column="jzzc"/>
        <result property="createuserid" column="createuserid"/>
        <result property="createTime" column="create_time"/>
    </resultMap>

    <sql id="selectByThemeMonthplanitemVo">
        select id, mpid, zc, starttime, endtime, activityid, jzzc, createuserid, create_time from by_theme_monthplanitem
    </sql>

    <select id="selectByThemeMonthplanitemList" parameterType="ByThemeMonthplanitem" resultMap="ByThemeMonthplanitemResult">
        <include refid="selectByThemeMonthplanitemVo"/>
        <where>
            <if test="mpid != null  and mpid != ''">and mpid = #{mpid}</if>
            <if test="zc != null ">and zc = #{zc}</if>
            <if test="starttime != null ">and starttime = #{starttime}</if>
            <if test="endtime != null ">and endtime = #{endtime}</if>
            <if test="activityid != null  and activityid != ''">and activityid = #{activityid}</if>
            <if test="jzzc != null  and jzzc != ''">and jzzc = #{jzzc}</if>
            <if test="createuserid != null ">and createuserid = #{createuserid}</if>
        </where>
        order by zc
    </select>

    <select id="selectByThemeMonthplanitemById" parameterType="String" resultMap="ByThemeMonthplanitemResult">
        <include refid="selectByThemeMonthplanitemVo"/>
        where id = #{id}
    </select>

    <insert id="insertByThemeMonthplanitem" parameterType="ByThemeMonthplanitem">
        insert into by_theme_monthplanitem
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="mpid != null  and mpid != ''">mpid,</if>
            <if test="zc != null ">zc,</if>
            <if test="starttime != null ">starttime,</if>
            <if test="endtime != null ">endtime,</if>
            <if test="activityid != null  and activityid != ''">activityid,</if>
            <if test="jzzc != null  and jzzc != ''">jzzc,</if>
            <if test="createuserid != null ">createuserid,</if>
            <if test="createTime != null ">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="mpid != null  and mpid != ''">#{mpid},</if>
            <if test="zc != null ">#{zc},</if>
            <if test="starttime != null ">#{starttime},</if>
            <if test="endtime != null ">#{endtime},</if>
            <if test="activityid != null  and activityid != ''">#{activityid},</if>
            <if test="jzzc != null  and jzzc != ''">#{jzzc},</if>
            <if test="createuserid != null ">#{createuserid},</if>
            <if test="createTime != null ">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateByThemeMonthplanitem" parameterType="ByThemeMonthplanitem">
        update by_theme_monthplanitem
        <trim prefix="SET" suffixOverrides=",">
            <if test="mpid != null  and mpid != ''">mpid = #{mpid},</if>
            <if test="zc != null ">zc = #{zc},</if>
            <if test="starttime != null ">starttime = #{starttime},</if>
            <if test="endtime != null ">endtime = #{endtime},</if>
            <if test="activityid != null  and activityid != ''">activityid = #{activityid},</if>
            <if test="jzzc != null  and jzzc != ''">jzzc = #{jzzc},</if>
            <if test="createuserid != null ">createuserid = #{createuserid},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteByThemeMonthplanitemById" parameterType="String">
        delete from by_theme_monthplanitem where id = #{id}
    </delete>

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

</mapper>