zhanghua
2023-09-08 7ef4892f9f24f941aca37e6b3991b808a0aca619
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
<?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.ycl.mapper.video.VideoPointMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.entity.video.VideoPoint">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="longitude" property="longitude" jdbcType="FLOAT"/>
        <result column="latitude" property="latitude" jdbcType="FLOAT"/>
        <result column="street_id" property="streetId" jdbcType="INTEGER"/>
        <result column="community_id" property="communityId" jdbcType="INTEGER"/>
        <result column="address" property="address" jdbcType="VARCHAR"/>
        <result column="plat_resource_id" property="platResourceId" jdbcType="VARCHAR"/>
        <result column="equipment_brand" property="equipmentBrand" jdbcType="VARCHAR"/>
        <result column="equipment_model" property="equipmentModel" jdbcType="VARCHAR"/>
        <result column="equipment_ip" property="equipmentIp" jdbcType="VARCHAR"/>
        <result column="url_address" property="urlAddress" jdbcType="VARCHAR"/>
    </resultMap>
 
    <resultMap id="VoMap" type="com.ycl.vo.equipment.VideoPointVo" extends="BaseResultMap">
        <result column="community_name" property="community" jdbcType="VARCHAR"/>
        <result column="street_name" property="street" jdbcType="VARCHAR"/>
 
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id
        ,name,longitude,latitude,street_id,community_id,address,plat_resource_id,equipment_brand,equipment_model,equipment_ip,url_address
    </sql>
    <select id="search" resultMap="VoMap">
        SELECT vp.*,s.region_name street_name,c.region_name community_name FROM ums_video_point vp
        LEFT JOIN ums_sccg_region s on vp.street_id = s.id
        LEFT JOIN ums_sccg_region c on vp.community_id = c.id
        <where>
            <if test="streetId!=null">
                and vp.street_id = #{streetId}
            </if>
            <if test="communityId!=null">
                and vp.community_id = #{communityId}
            </if>
        </where>
        ORDER BY vp.code DESC
    </select>
 
</mapper>