地质所 沉降监测网建设项目
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
<?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.FriendLinkMapper">
 
    <resultMap type="FriendLink" id="FriendLinkResult">
        <result property="id" column="id" />
        <result property="name" column="name" />
        <result property="link" column="link" />
        <result property="logo" column="logo" />
        <result property="auditState" column="audit_state" />
    </resultMap>
 
    <sql id="selectFriendLinkVo">
        select id, name, link,description, logo, audit_state from cms_friend_link
    </sql>
 
    <select id="selectFriendLinkList" parameterType="FriendLink"
        resultMap="FriendLinkResult">
        <include refid="selectFriendLinkVo" />
        <where>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="auditState != null "> and audit_state = #{auditState}</if>
        </where>
    </select>
 
    <select id="selectFriendLinkById" parameterType="Long"
        resultMap="FriendLinkResult">
        <include refid="selectFriendLinkVo" />
        where id = #{id}
    </select>
 
    <insert id="insertFriendLink" parameterType="FriendLink"
        useGeneratedKeys="true" keyProperty="id">
        insert into cms_friend_link
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null  and name != ''">name,</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>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null  and name != ''">#{name},</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>
        </trim>
    </insert>
 
    <update id="updateFriendLink" parameterType="FriendLink">
        update cms_friend_link
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null  and name != ''">name = #{name},</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>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteFriendLinkById" parameterType="Long">
        delete from cms_friend_link where id = #{id}
    </delete>
 
    <delete id="deleteFriendLinkByIds" parameterType="String">
        delete from cms_friend_link where id in
        <foreach item="id" collection="array" open="(" separator=","
            close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>