Xiajijian
2025-10-15 c8c87b9d441558f8023b980feb3647bb8288d132
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
<?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.ard.data.model.mapper.ArdModelMapper">
    
    <resultMap type="ArdModel" id="ArdModelResult">
        <result property="id"    column="id"    />
        <result property="modelName"    column="model_name"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="height"    column="height"    />
        <result property="proportion"    column="proportion"    />
        <result property="modelUrl"    column="model_url"    />
    </resultMap>
 
    <sql id="selectArdModelVo">
        select id,
               model_name,
               longitude,
               latitude,
               height,
               proportion,
               model_url
        from ard_model_management
    </sql>
 
    <select id="selectArdModelList" parameterType="ArdModel" resultMap="ArdModelResult">
        <include refid="selectArdModelVo"/>
        <where>  
            <if test="modelName != null  and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="height != null "> and height = #{height}</if>
            <if test="proportion != null "> and proportion = #{proportion}</if>
            <if test="modelUrl != null "> and model_url = #{modelUrl}</if>
        </where>
    </select>
    
    <select id="selectArdModelById" parameterType="String" resultMap="ArdModelResult">
        <include refid="selectArdModelVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertArdModel" parameterType="ArdModel">
        insert into ard_model_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="modelName != null">model_name,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="height != null">height,</if>
            <if test="proportion != null">proportion,</if>
            <if test="modelUrl != null">model_url,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="modelName != null">#{modelName},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="height != null">#{height},</if>
            <if test="proportion != null">#{proportion},</if>
            <if test="modelUrl != null">#{modelUrl},</if>
         </trim>
    </insert>
 
    <update id="updateArdModel" parameterType="ArdModel">
        update ard_model_management
        <trim prefix="SET" suffixOverrides=",">
            <if test="modelName != null">model_name = #{modelName},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="height != null">height = #{height},</if>
            <if test="proportion != null">proportion = #{proportion},</if>
            <if test="modelUrl != null">model_url = #{modelUrl},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdModelById" parameterType="String">
        delete from ard_model_management where id = #{id}
    </delete>
 
    <delete id="deleteArdModelByIds" parameterType="String">
        delete from ard_model_management where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>