地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?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.javaweb.cms.mapper.EmailMapper">
 
    <resultMap type="Email" id="EmailResult">
        <result property="id" column="id" />
        <result property="emailType" column="email_type" />
        <result property="userId" column="user_id" />
        <result property="createBy" column="create_by" />
        <result property="createTime" column="create_time" />
        <result property="fromEmail" column="from_email" />
        <result property="fromEmailPwd" column="from_email_pwd" />
        <result property="toEmail" column="to_email" />
        <result property="subject" column="subject" />
        <result property="content" column="content" />
        <result property="sendFlag" column="send_flag" />
        <result property="sendTime" column="send_time" />
        <result property="sendType" column="send_type" />
        <result property="planTime" column="plan_time" />
        <result property="copyTo" column="copy_to" />
        <result property="attachfiles" column="attachfiles" />
    </resultMap>
 
    <sql id="selectEmailVo">
        select id, email_type, user_id, create_by, create_time, from_email,
        from_email_pwd, to_email, subject, content, send_flag, send_time,
        send_type, plan_time, copy_to, attachfiles from cms_email
    </sql>
 
    <select id="selectEmailList" parameterType="Email" resultMap="EmailResult">
        <include refid="selectEmailVo" />
        <where>
            <if test="emailType != null "> and email_type = #{emailType}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="fromEmail != null  and fromEmail != ''"> and from_email = #{fromEmail}</if>
            <if test="fromEmailPwd != null  and fromEmailPwd != ''"> and from_email_pwd = #{fromEmailPwd}</if>
            <if test="toEmail != null  and toEmail != ''"> and to_email = #{toEmail}</if>
            <if test="subject != null  and subject != ''"> and subject = #{subject}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
            <if test="sendTime != null "> and send_time = #{sendTime}</if>
            <if test="sendType != null "> and send_type = #{sendType}</if>
            <if test="planTime != null  and planTime != ''"> and plan_time = #{planTime}</if>
            <if test="copyTo != null  and copyTo != ''"> and copy_to = #{copyTo}</if>
            <if test="attachfiles != null  and attachfiles != ''"> and attachfiles = #{attachfiles}</if>
        </where>
    </select>
 
    <select id="selectEmailById" parameterType="String" resultMap="EmailResult">
        <include refid="selectEmailVo" />
        where id = #{id}
    </select>
 
    <insert id="insertEmail" parameterType="Email" useGeneratedKeys="true"
        keyProperty="id">
        insert into cms_email
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            <if test="emailType != null ">email_type,</if>
            <if test="userId != null  and userId != ''">user_id,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="fromEmail != null  and fromEmail != ''">from_email,</if>
            <if test="fromEmailPwd != null  and fromEmailPwd != ''">from_email_pwd,</if>
            <if test="toEmail != null  and toEmail != ''">to_email,</if>
            <if test="subject != null  and subject != ''">subject,</if>
            <if test="content != null  and content != ''">content,</if>
            <if test="sendFlag != null ">send_flag,</if>
            <if test="sendTime != null ">send_time,</if>
            <if test="sendType != null ">send_type,</if>
            <if test="planTime != null ">plan_time,</if>
            <if test="copyTo != null  and copyTo != ''">copy_to,</if>
            <if test="attachfiles != null  and attachfiles != ''">attachfiles,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{id},
            <if test="emailType != null ">#{emailType},</if>
            <if test="userId != null  and userId != ''">#{userId},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="fromEmail != null  and fromEmail != ''">#{fromEmail},</if>
            <if test="fromEmailPwd != null  and fromEmailPwd != ''">#{fromEmailPwd},</if>
            <if test="toEmail != null  and toEmail != ''">#{toEmail},</if>
            <if test="subject != null  and subject != ''">#{subject},</if>
            <if test="content != null  and content != ''">#{content},</if>
            <if test="sendFlag != null ">#{sendFlag},</if>
            <if test="sendTime != null ">#{sendTime},</if>
            <if test="sendType != null ">#{sendType},</if>
            <if test="planTime != null ">#{planTime},</if>
            <if test="copyTo != null  and copyTo != ''">#{copyTo},</if>
            <if test="attachfiles != null  and attachfiles != ''">#{attachfiles},</if>
        </trim>
    </insert>
 
    <update id="updateEmail" parameterType="Email">
        update cms_email
        <trim prefix="SET" suffixOverrides=",">
            <if test="emailType != null ">email_type = #{emailType},</if>
            <if test="userId != null  and userId != ''">user_id = #{userId},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="fromEmail != null  and fromEmail != ''">from_email = #{fromEmail},</if>
            <if test="fromEmailPwd != null  and fromEmailPwd != ''">from_email_pwd = #{fromEmailPwd},</if>
            <if test="toEmail != null  and toEmail != ''">to_email = #{toEmail},</if>
            <if test="subject != null  and subject != ''">subject = #{subject},</if>
            <if test="content != null  and content != ''">content = #{content},</if>
            <if test="sendFlag != null ">send_flag = #{sendFlag},</if>
            <if test="sendTime != null ">send_time = #{sendTime},</if>
            <if test="sendType != null ">send_type = #{sendType},</if>
            <if test="planTime != null  ">plan_time = #{planTime},</if>
            <if test="copyTo != null  and copyTo != ''">copy_to = #{copyTo},</if>
            <if test="attachfiles != null  and attachfiles != ''">attachfiles = #{attachfiles},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmailById" parameterType="String">
        delete from cms_email where id = #{id}
    </delete>
 
    <delete id="deleteEmailByIds" parameterType="String">
        delete from cms_email where id in
        <foreach item="id" collection="array" open="(" separator=","
            close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>