wanger 1 жил өмнө
parent
commit
2005c11c7e

+ 33 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/yzt/searchController.java

@@ -1,5 +1,6 @@
 package com.onemap.apply.controller.yzt;
 package com.onemap.apply.controller.yzt;
 
 
+import com.onemap.apply.domain.yzt.CollectionDTO;
 import com.onemap.apply.domain.yzt.PoiSearchDTO;
 import com.onemap.apply.domain.yzt.PoiSearchDTO;
 import com.onemap.apply.service.yzt.ISearchService;
 import com.onemap.apply.service.yzt.ISearchService;
 import com.onemap.common.core.web.controller.BaseController;
 import com.onemap.common.core.web.controller.BaseController;
@@ -8,6 +9,8 @@ import com.onemap.common.security.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.Map;
+
 
 
 @RestController
 @RestController
 @RequestMapping("/yzt/search")
 @RequestMapping("/yzt/search")
@@ -26,4 +29,34 @@ public class searchController extends BaseController {
     public RequestResult poi(@RequestBody PoiSearchDTO poiSearchDTO) {
     public RequestResult poi(@RequestBody PoiSearchDTO poiSearchDTO) {
         return searchService.poi(poiSearchDTO);
         return searchService.poi(poiSearchDTO);
     }
     }
+
+    /**
+     * 书签查询
+     *
+     * @return
+     */
+    @PostMapping("/bookmark")
+    public RequestResult bookmark(@RequestBody PoiSearchDTO poiSearchDTO) {
+        return searchService.bookmark(poiSearchDTO);
+    }
+
+    /**
+     * 书签新增
+     *
+     * @return
+     */
+    @PostMapping("/bookmarkAdd")
+    public RequestResult bookmarkAdd(@RequestBody CollectionDTO collectionDTO) {
+        return searchService.bookmarkAdd(collectionDTO);
+    }
+
+    /**
+     * 书签新增
+     *
+     * @return
+     */
+    @PostMapping("/bookmarkDel")
+    public RequestResult bookmarkDel(@RequestBody Map params) {
+        return searchService.bookmarkDel(params.get("id").toString());
+    }
 }
 }

+ 46 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/yzt/CollectionDTO.java

@@ -0,0 +1,46 @@
+package com.onemap.apply.domain.yzt;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+/**
+ * 地图收藏相关 (书签、飞行路线、对比分析等)
+ */
+@TableName("t_yzt_collection")
+public class CollectionDTO {
+    private String id;
+    private String name;
+    private String type;
+    private String info ;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+}

+ 9 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/yzt/PoiSearchDTO.java

@@ -5,9 +5,18 @@ package com.onemap.apply.domain.yzt;
  */
  */
 public class PoiSearchDTO {
 public class PoiSearchDTO {
     private String name ;
     private String name ;
+    private String type ;
     private Integer limit;
     private Integer limit;
     private Integer offset ;
     private Integer offset ;
 
 
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     public String getName() {
     public String getName() {
         return name;
         return name;
     }
     }

+ 16 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/yzt/CollectionMapper.java

@@ -0,0 +1,16 @@
+package com.onemap.apply.mapper.yzt;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.yzt.CollectionDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @ClassName CollectionMapper
+ * @Description TODO
+ * @Author 北京四维空间数码科技有限公司
+ * @Date 2023/6/15 14:33
+ * @Version 1.0
+ */
+@Mapper
+public interface CollectionMapper extends BaseMapper<CollectionDTO> {
+}

+ 4 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/yzt/SearchMapper.java

@@ -16,4 +16,8 @@ public interface SearchMapper {
     List<PoiDTO> poi(@Param("name") String name, @Param("limit") Integer limit, @Param("offset") Integer offset);
     List<PoiDTO> poi(@Param("name") String name, @Param("limit") Integer limit, @Param("offset") Integer offset);
 
 
     Integer poicount(@Param("name") String name);
     Integer poicount(@Param("name") String name);
+
+    List<CollectionDTO> bookmark(@Param("name") String name, @Param("type") String type, @Param("limit") Integer limit, @Param("offset") Integer offset);
+
+    Integer bookmarkcount(@Param("name") String name, @Param("type") String type);
 }
 }

+ 43 - 6
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/yzt/SearchServiceImpl.java

@@ -1,18 +1,14 @@
 package com.onemap.apply.service.impl.yzt;
 package com.onemap.apply.service.impl.yzt;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.onemap.apply.domain.yzt.*;
 import com.onemap.apply.domain.yzt.*;
+import com.onemap.apply.mapper.yzt.CollectionMapper;
 import com.onemap.apply.mapper.yzt.SearchMapper;
 import com.onemap.apply.mapper.yzt.SearchMapper;
-import com.onemap.apply.mapper.yzt.ZymlMapper;
 import com.onemap.apply.service.yzt.ISearchService;
 import com.onemap.apply.service.yzt.ISearchService;
-import com.onemap.apply.service.yzt.IZymlService;
-import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.datasource.annotation.Slave;
 import com.onemap.common.datasource.annotation.Slave;
-import com.onemap.common.security.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.*;
 import java.util.*;
 
 
@@ -21,6 +17,8 @@ public class SearchServiceImpl implements ISearchService {
 
 
     @Autowired
     @Autowired
     private SearchMapper searchMapper;
     private SearchMapper searchMapper;
+    @Autowired
+    private CollectionMapper collectionMapper;
 
 
 
 
     @Override
     @Override
@@ -38,4 +36,43 @@ public class SearchServiceImpl implements ISearchService {
         }
         }
         return RequestResult.error("查询成功!");
         return RequestResult.error("查询成功!");
     }
     }
+
+    @Override
+    public RequestResult bookmark(PoiSearchDTO poiSearchDTO) {
+        try {
+            Map data = new HashMap();
+            List<CollectionDTO> res = searchMapper.bookmark(poiSearchDTO.getName(), poiSearchDTO.getType(), poiSearchDTO.getLimit(), poiSearchDTO.getOffset());
+            data.put("data", res);
+            Integer count = searchMapper.bookmarkcount(poiSearchDTO.getName(), poiSearchDTO.getType());
+            data.put("count", count);
+            return RequestResult.success("查询成功!", data);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("查询成功!");
+    }
+
+    @Override
+    public RequestResult bookmarkAdd(CollectionDTO collectionDTO) {
+        try {
+            collectionMapper.insert(collectionDTO);
+            return RequestResult.success("保存成功!", 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("保存失败!", 0);
+    }
+
+    @Override
+    public RequestResult bookmarkDel(String id) {
+        try {
+            QueryWrapper<CollectionDTO> wrapper = new QueryWrapper();
+            wrapper.eq("id", id);
+            collectionMapper.delete(wrapper);
+            return RequestResult.success("删除成功!", 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("删除失败!", 0);
+    }
 }
 }

+ 7 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/yzt/ISearchService.java

@@ -1,5 +1,6 @@
 package com.onemap.apply.service.yzt;
 package com.onemap.apply.service.yzt;
 
 
+import com.onemap.apply.domain.yzt.CollectionDTO;
 import com.onemap.apply.domain.yzt.PoiSearchDTO;
 import com.onemap.apply.domain.yzt.PoiSearchDTO;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.domain.RequestResult;
 
 
@@ -8,4 +9,10 @@ import java.util.Map;
 public interface ISearchService {
 public interface ISearchService {
 
 
     RequestResult poi(PoiSearchDTO poiSearchDTO);
     RequestResult poi(PoiSearchDTO poiSearchDTO);
+
+    RequestResult bookmark(PoiSearchDTO poiSearchDTO);
+
+    RequestResult bookmarkAdd(CollectionDTO collectionDTO);
+
+    RequestResult bookmarkDel(String id);
 }
 }

+ 21 - 11
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/yzt/SearchMapper.xml

@@ -6,20 +6,30 @@
 
 
 
 
     <select id="poi" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.PoiDTO">
     <select id="poi" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.PoiDTO">
-        SELECT t.name,t.adress,st_x ( t.geom ) x,st_y ( t.geom ) y
-FROM
-	 poi t
-WHERE
-	t.name LIKE '%'|| #{name} || '%'
-	LIMIT ${limit} OFFSET  ${offset}
+        select t.name,t.adress,st_x ( t.geom ) x,st_y ( t.geom ) y
+        from  poi t where
+	t.name like '%'|| #{name} || '%'
+	limit ${limit} offset  ${offset}
     </select>
     </select>
 
 
     <select id="poicount" parameterType="java.lang.String" resultType="java.lang.Integer">
     <select id="poicount" parameterType="java.lang.String" resultType="java.lang.Integer">
-        SELECT count(1)
-FROM
-	 poi t
-WHERE
-	t.name LIKE '%'|| #{name} || '%'
+        select count(1) from poi t where t.name like '%'|| #{name} || '%'
+    </select>
+
+    <select id="bookmark" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.CollectionDTO">
+        select * from t_yzt_collection t where t.type = #{type}
+         <if test="name != null and name != ''">
+             and t.name like '%'|| #{name} || '%'
+         </if>
+	     limit ${limit} offset  ${offset}
+    </select>
+
+    <select id="bookmarkcount" parameterType="java.lang.String" resultType="java.lang.Integer">
+        select count(1)  FROM t_yzt_collection t
+        where t.type = #{type}
+        <if test="name != null and name != ''">
+            and t.name like '%'|| #{name} || '%'
+        </if>
     </select>
     </select>
 
 
 </mapper>
 </mapper>

+ 19 - 18
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/yzt/XzqMapper.xml

@@ -27,24 +27,25 @@
         case when (select count(1) from xzqh p where p.pid = t.id) > 0 then '1'
         case when (select count(1) from xzqh p where p.pid = t.id) > 0 then '1'
         else '0' end as "isparent"
         else '0' end as "isparent"
         from xzqh t where 1 = 1
         from xzqh t where 1 = 1
-        <if test="city == null or city == false">
-            and t.pid is not null and length(t.id) &lt;= (select case (select length(t.id) from xzqh t where
-             t.pid is null)
-            when 2 then 4
-            when 4 then 6
-            when 6 then 9
-            when 9 then 12
-            end)
-        </if>
-        <if test="city != null or city == true">
-            and length(t.id) &lt;= (select case (select length(t.id) from xzqh t where  t.pid
-            is null)
-            when 2 then 4
-            when 4 then 6
-            when 6 then 9
-            when 9 then 12
-            end )
-        </if>
+        order by t.pid
+<!--        <if test="city == null or city == false">-->
+<!--            and t.pid is not null and length(t.id) &lt;= (select case (select length(t.id) from xzqh t where-->
+<!--             t.pid is null)-->
+<!--            when 2 then 4-->
+<!--            when 4 then 6-->
+<!--            when 6 then 9-->
+<!--            when 9 then 12-->
+<!--            end)-->
+<!--        </if>-->
+<!--        <if test="city != null or city == true">-->
+<!--            and length(t.id) &lt;= (select case (select length(t.id) from xzqh t where  t.pid-->
+<!--            is null)-->
+<!--            when 2 then 4-->
+<!--            when 4 then 6-->
+<!--            when 6 then 9-->
+<!--            when 9 then 12-->
+<!--            end )-->
+<!--        </if>-->
     </select>
     </select>
 
 
     <select id="GetGeom" resultType="java.lang.String" parameterType="java.lang.String">
     <select id="GetGeom" resultType="java.lang.String" parameterType="java.lang.String">