地质所 沉降监测网建设项目
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
<?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.LinkMapper">
 
    <resultMap type="Link" id="LinkResult">
        <result property="linkId" column="link_id" />
        <result property="linkType" column="link_type" />
        <result property="linkName" column="link_name" />
        <result property="keywords" column="keywords" />
        <result property="link" column="link" />
        <result property="description" column="description" />
        <result property="logo" column="logo" />
        <result property="auditState" column="audit_state" />
        <result property="detail" column="detail" />
        <result property="sort" column="sort" />
        <result property="upVote" column="up_vote" />
        <result property="commentFlag" column="comment_flag" />
        <result property="status" column="status" />
    </resultMap>
 
    <sql id="selectLinkVo">
        select link_id, link_type, link_name, keywords, link, description, logo,
        audit_state, detail, sort, up_vote, comment_flag, status from cms_link
    </sql>
 
    <select id="selectLinkList" parameterType="Link" resultMap="LinkResult">
        <include refid="selectLinkVo" />
        <where>
            <if test="linkType != null  and linkType != ''"> and link_type = #{linkType}</if>
            <if test="linkName != null  and linkName != ''"> and link_name like concat('%', #{linkName}, '%')</if>
            <if test="auditState != null "> and audit_state = #{auditState}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
 
    <select id="selectLinkById" parameterType="Long" resultMap="LinkResult">
        <include refid="selectLinkVo" />
        where link_id = #{linkId}
    </select>
 
    <insert id="insertLink" parameterType="Link" useGeneratedKeys="true"
        keyProperty="linkId">
        insert into cms_link
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="linkType != null  and linkType != ''">link_type,</if>
            <if test="linkName != null  and linkName != ''">link_name,</if>
            <if test="keywords != null  and keywords != ''">keywords,</if>
            <if test="link != null  and link != ''">link,</if>
            <if test="description != null  and description != ''">description,</if>
            <if test="logo != null  and logo != ''">logo,</if>
            <if test="auditState != null ">audit_state,</if>
            <if test="detail != null  and detail != ''">detail,</if>
            <if test="sort != null ">sort,</if>
            <if test="upVote != null ">up_vote,</if>
            <if test="commentFlag != null ">comment_flag,</if>
            <if test="status != null ">status,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="linkType != null  and linkType != ''">#{linkType},</if>
            <if test="linkName != null  and linkName != ''">#{linkName},</if>
            <if test="keywords != null  and keywords != ''">#{keywords},</if>
            <if test="link != null  and link != ''">#{link},</if>
            <if test="description != null  and description != ''">#{description},</if>
            <if test="logo != null  and logo != ''">#{logo},</if>
            <if test="auditState != null ">#{auditState},</if>
            <if test="detail != null  and detail != ''">#{detail},</if>
            <if test="sort != null ">#{sort},</if>
            <if test="upVote != null ">#{upVote},</if>
            <if test="commentFlag != null ">#{commentFlag},</if>
            <if test="status != null ">#{status},</if>
        </trim>
    </insert>
 
    <update id="updateLink" parameterType="Link">
        update cms_link
        <trim prefix="SET" suffixOverrides=",">
            <if test="linkType != null  and linkType != ''">link_type = #{linkType},</if>
            <if test="linkName != null  and linkName != ''">link_name = #{linkName},</if>
            <if test="keywords != null  and keywords != ''">keywords = #{keywords},</if>
            <if test="link != null  and link != ''">link = #{link},</if>
            <if test="description != null  and description != ''">description = #{description},</if>
            <if test="logo != null  and logo != ''">logo = #{logo},</if>
            <if test="auditState != null ">audit_state = #{auditState},</if>
            <if test="detail != null  and detail != ''">detail = #{detail},</if>
            <if test="sort != null ">sort = #{sort},</if>
            <if test="upVote != null ">up_vote = #{upVote},</if>
            <if test="commentFlag != null ">comment_flag = #{commentFlag},</if>
            <if test="status != null ">status = #{status},</if>
        </trim>
        where link_id = #{linkId}
    </update>
 
    <delete id="deleteLinkById" parameterType="Long">
        delete from cms_link where link_id = #{linkId}
    </delete>
 
    <delete id="deleteLinkByIds" parameterType="String">
        delete from cms_link where link_id in
        <foreach item="linkId" collection="array" open="(" separator=","
            close=")">
            #{linkId}
        </foreach>
    </delete>
 
</mapper>