SendEmailMapper.xml 4.96 KB
<?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.web.controller.business.mapper.SendEmailMapper">
    
    <resultMap type="SendEmail" id="SendEmailResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="source"    column="source"    />
        <result property="email"    column="email"    />
        <result property="sendFrequency"    column="send_frequency"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
	
	<sql id="selectSendEmailVo">
        select id, user_id,source, email, send_frequency, status, create_time, update_time from send_email
    </sql>
	
    <select id="selectSendEmailList" parameterType="SendEmail" resultMap="SendEmailResult">
        <include refid="selectSendEmailVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="source != null  and source != ''  ">source = #{source}</if>
            <if test="userId != null  and userId != '' "> and user_id = #{userId}</if>
            <if test="email != null  and email != '' "> and email = #{email}</if>
            <if test="sendFrequency != null  and sendFrequency != '' "> and send_frequency = #{sendFrequency}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
        </where>
    </select>
    
    <select id="selectSendEmailById" parameterType="Integer" resultMap="SendEmailResult">
        <include refid="selectSendEmailVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSendEmail" parameterType="SendEmail" useGeneratedKeys="true" keyProperty="id">
        insert into send_email
		<trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="source != null  and source != ''  ">`source`,</if>
			<if test="userId != null  and userId != ''  ">user_id,</if>
			<if test="email != null  and email != ''  ">email,</if>
			<if test="sendFrequency != null  and sendFrequency != ''  ">send_frequency,</if>
			<if test="status != null  and status != ''  ">status,</if>
			<if test="createTime != null  ">create_time,</if>
			<if test="updateTime != null  ">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="source != null  and source != ''  "> #{source},</if>
			<if test="userId != null  and userId != ''  ">#{userId},</if>
			<if test="email != null  and email != ''  ">#{email},</if>
			<if test="sendFrequency != null  and sendFrequency != ''  ">#{sendFrequency},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
			<if test="createTime != null  ">#{createTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
         </trim>
    </insert>
	 
    <update id="updateSendEmail" parameterType="SendEmail">
        update send_email
        <trim prefix="SET" suffixOverrides=",">
            <if test="source != null  and source != ''  ">source = #{source},</if>
            <if test="userId != null  and userId != ''  ">user_id = #{userId},</if>
            <if test="email != null  and email != ''  ">email = #{email},</if>
            <if test="sendFrequency != null  and sendFrequency != ''  ">send_frequency = #{sendFrequency},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="createTime != null  ">create_time = #{creatTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

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


    <update id="updateSendEmailByUserId" parameterType="SendEmail">
        update send_email
        <trim prefix="SET" suffixOverrides=",">
            <if test="source != null  and source != ''  ">source = #{source},</if>
            <if test="email != null  and email != ''  ">email = #{email},</if>
            <if test="sendFrequency != null  and sendFrequency != ''  ">send_frequency = #{sendFrequency},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
        </trim>
        where user_id = #{userId}
    </update>
</mapper>