<?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.robot.mapper.LdRoadmapMapper">

    <resultMap type="com.ruoyi.robot.domain.LdRoadmap" id="LdRoadmapResult">
        <result property="id" column="id"/>
        <result property="mapName" column="map_name"/>
        <result property="geojsonData" column="geojson_data"/>
        <result property="version" column="version"/>
        <result property="pointCount" column="point_count"/>
        <result property="lineCount" column="line_count"/>
        <result property="isValid" column="is_valid"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectLdRoadmapVo">
        select id, map_name, geojson_data, version, point_count, line_count, is_valid,
               create_by, create_time, update_by, update_time
        from ld_roadmap
    </sql>
    <insert id="insert"></insert>
    <update id="updateById" parameterType="com.ruoyi.robot.domain.LdRoadmap">
        update ld_roadmap
        <trim prefix="SET" suffixOverrides=",">
            <if test="mapName != null and mapName != ''">map_name = #{mapName},</if>
            <if test="geojsonData != null">geojson_data = #{geojsonData},</if>
            <if test="version != null">version = #{version},</if>
            <if test="pointCount != null">point_count = #{pointCount},</if>
            <if test="lineCount != null">line_count = #{lineCount},</if>
            <if test="isValid != null">is_valid = #{isValid},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <select id="selectByMapName" resultMap="LdRoadmapResult">
        <include refid="selectLdRoadmapVo"/>
        where map_name = #{mapName} and is_valid = 1
    </select>

</mapper>
