Administrator
2023-08-12 ee89d67599e85222b1df11df6601ab5658475052
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
<?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.app.patrolplan.mapper.ArdAppPatrolpointRecordMapper">
    
    <resultMap type="ArdAppPatrolpointRecord" id="ArdAppPatrolpointRecordResult">
        <result property="id"    column="id"    />
        <result property="remark"    column="remark"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="userId"    column="user_id"    />
        <result property="recordTime"    column="record_time"    />
        <result property="appPatrolpointsId"    column="app_patrolpoints_id"    />
    </resultMap>
 
    <sql id="selectArdAppPatrolpointRecordVo">
        select id, remark, longitude, latitude, user_id, record_time, app_patrolpoints_id from ard_app_patrolpoint_record
    </sql>
 
    <select id="selectArdAppPatrolpointRecordList" parameterType="ArdAppPatrolpointRecord" resultMap="ArdAppPatrolpointRecordResult">
        <include refid="selectArdAppPatrolpointRecordVo"/>
        <where>  
            <if test="longitude != null  and longitude != ''"> and longitude = #{longitude}</if>
            <if test="latitude != null  and latitude != ''"> and latitude = #{latitude}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="recordTime != null  and recordTime != ''"> and record_time = #{recordTime}</if>
            <if test="appPatrolpointsId != null  and appPatrolpointsId != ''"> and app_patrolpoints_id = #{appPatrolpointsId}</if>
        </where>
    </select>
    
    <select id="selectArdAppPatrolpointRecordById" parameterType="String" resultMap="ArdAppPatrolpointRecordResult">
        <include refid="selectArdAppPatrolpointRecordVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdAppPatrolpointRecord" parameterType="ArdAppPatrolpointRecord">
        insert into ard_app_patrolpoint_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="remark != null">remark,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="userId != null">user_id,</if>
            <if test="recordTime != null">record_time,</if>
            <if test="appPatrolpointsId != null">app_patrolpoints_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="remark != null">#{remark},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="userId != null">#{userId},</if>
            <if test="recordTime != null">#{recordTime},</if>
            <if test="appPatrolpointsId != null">#{appPatrolpointsId},</if>
         </trim>
    </insert>
 
    <update id="updateArdAppPatrolpointRecord" parameterType="ArdAppPatrolpointRecord">
        update ard_app_patrolpoint_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="remark != null">remark = #{remark},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="recordTime != null">record_time = #{recordTime},</if>
            <if test="appPatrolpointsId != null">app_patrolpoints_id = #{appPatrolpointsId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdAppPatrolpointRecordById" parameterType="String">
        delete from ard_app_patrolpoint_record where id = #{id}
    </delete>
 
    <delete id="deleteArdAppPatrolpointRecordByIds" parameterType="String">
        delete from ard_app_patrolpoint_record where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
<!--    <select id="maxNum">-->
<!--        select user_id,user_name,max(points_num) pointsNum from ard_app_patrolpoint_record GROUP BY user_id,user_name-->
<!--    </select>-->
 
 
</mapper>