燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2024-11-29 9a8c8a90c7c01b6bc770d4be5baeff72c058468c
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
<?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.yssh.mapper.LocationMapper">
    <resultMap id="locationResult" type="com.yssh.entity.Location">
        <id column="id" property="id" javaType="java.lang.Integer" />
        <id column="name" property="name" javaType="java.lang.String" jdbcType="VARCHAR" />
        <id column="type" property="type" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="lon" property="lon" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="lat" property="lat" javaType="java.lang.Float" jdbcType="DOUBLE"/>
    </resultMap>
    
    <sql id="locationSql">
        SELECT id, name, type, format(lon, 6) lon, format(lat, 6) lat FROM location
    </sql>
 
    <select id="selectByXY" resultType="com.yssh.entity.Location">
        select id, name, type, lon, lat from location
        <where>
            lon between (#{x} - 0.0009) and (#{x} + 0.0009)
            and
            lat between (#{y} - 0.0009) and (#{y} + 0.0009)
        </where>
    </select>
 
    <select id="selectVocAddrs" resultType="com.yssh.entity.Location">
        select id, x "lon", y "lat", addr "name"
        from voc_addr
        where length(addr) > 0;
    </select>
    
    <select id="query" resultType="com.yssh.entity.Location">
        <include refid="locationSql"></include>
        <where>
            <if test="name != null and name != ''">
                AND name LIKE concat('%', #{name}, '%')
            </if>
            <if test="type != null and type != ''">
                AND type = #{type}
            </if>
        </where>
    </select>
 
    <!--include refid="locationSql"></include-->
    <select id="getAll" resultType="com.yssh.entity.Location">
        select id, name, type, lon, lat from location;
    </select>
    
    <insert id="insertLocation" parameterType="com.yssh.entity.Location">
        insert into location(
            name, type, lon, lat
        )
        values (
            #{name},#{type},#{lon},#{lat}
        )
    </insert>
    
    <delete id="deleteLocation">
        delete from location where id = #{id}
    </delete>
</mapper>