SendEmailMapper.xml 4.93 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="userId"    />
        <result property="source"    column="source"    />
        <result property="email"    column="email"    />
        <result property="sendFrequency"    column="sendFrequency"    />
        <result property="status"    column="status"    />
        <result property="creditTime"    column="creditTime"    />
        <result property="updateTime"    column="updateTime"    />
    </resultMap>
	
	<sql id="selectSendEmailVo">
        select id, userId,source, email, sendFrequency, status, creditTime, updateTime 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 userId = #{userId}</if>
            <if test="email != null  and email != '' "> and email = #{email}</if>
            <if test="sendFrequency != null  and sendFrequency != '' "> and sendFrequency = #{sendFrequency}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="creditTime != null "> and creditTime = #{creditTime}</if>
            <if test="updateTime != null "> and updateTime = #{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 != ''  ">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="creditTime != null  ">creditTime,</if>
			<if test="updateTime != null  ">updateTime,</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="creditTime != null  ">#{creditTime},</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 != ''  ">userId = #{userId},</if>
            <if test="email != null  and email != ''  ">email = #{email},</if>
            <if test="sendFrequency != null  and sendFrequency != ''  ">sendFrequency = #{sendFrequency},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{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 != ''  ">sendFrequency = #{sendFrequency},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
        </trim>
        where userId = #{userId}
    </update>
</mapper>