Jelajahi Sumber

获取疑似闲置土地

gushoubang 10 bulan lalu
induk
melakukan
f0f0ea777c

+ 24 - 8
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/tdgy/TdgyController.java

@@ -4,10 +4,8 @@ import com.onemap.apply.domain.tdgy.vo.UpdateTdgyVo;
 import com.onemap.apply.service.tdgy.TdgyService;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.security.utils.SecurityUtils;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
@@ -18,12 +16,30 @@ public class TdgyController {
     @Resource
     private TdgyService tdgyService;
 
+    /**
+     * 修改土地供应
+     *
+     * @param updateTdgyVo
+     * @return
+     */
     @PutMapping("")
-    public RequestResult GetXzqCode(@Valid @RequestBody UpdateTdgyVo updateTdgyVo) {
-        // if (SecurityUtils.getLoginUser() == null || SecurityUtils.getLoginUser().getSysUser() == null) {
-        //     return RequestResult.error("请先登录");
-        // }
+    public RequestResult updateTdgy(@Valid @RequestBody UpdateTdgyVo updateTdgyVo) {
         RequestResult requestResult = tdgyService.updateTdgy(updateTdgyVo);
         return requestResult;
     }
+
+    /**
+     * 获取疑似闲置土地
+     *
+     * @return
+     */
+    @GetMapping("/suspectedIdleLand")
+    public RequestResult getSuspectedIdleLand(String xmmc, String xzqh, Integer pageSize, Integer pageNum) {
+        Integer limit = 20;
+        if (pageSize != null) limit = pageSize;
+        Integer offset = 0;
+        if (pageNum != null) offset = (pageNum - 1) * limit;
+        RequestResult requestResult = tdgyService.getSuspectedIdleLand(xmmc, xzqh, limit, offset);
+        return requestResult;
+    }
 }

+ 8 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/tdgy/TdgyMapper.java

@@ -3,7 +3,15 @@ package com.onemap.apply.mapper.tdgy;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.onemap.apply.domain.tdgy.dto.TdgySjDTO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface TdgyMapper extends BaseMapper<TdgySjDTO> {
+    List<Map<String, Object>> getSuspectedIdleLand(@Param("xmmc") String xmmc,
+                                                   @Param("xzqh") String xzqh,
+                                                   @Param("limit") Integer limit,
+                                                   @Param("offset") Integer offset);
 }

+ 11 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/tdgy/TdgyServiceImp.java

@@ -10,6 +10,8 @@ import com.onemap.common.datasource.annotation.Slave;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 土地供应服务实现类
@@ -46,4 +48,13 @@ public class TdgyServiceImp implements TdgyService {
         tdgyMapper.update(null, wrapper);
         return RequestResult.success();
     }
+
+    @Slave
+    @Override
+    public RequestResult getSuspectedIdleLand(String xmmc, String xzqh, Integer limit, Integer offset) {
+        List<Map<String, Object>> list = tdgyMapper.getSuspectedIdleLand(xmmc, xzqh, limit, offset);
+
+        RequestResult requestResult = RequestResult.success(list);
+        return requestResult;
+    }
 }

+ 2 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/tdgy/TdgyService.java

@@ -5,4 +5,6 @@ import com.onemap.common.core.web.domain.RequestResult;
 
 public interface TdgyService {
     RequestResult updateTdgy(UpdateTdgyVo updateTdgyVo);
+
+    RequestResult getSuspectedIdleLand(String xmmc, String xzqh, Integer limit, Integer offset);
 }

+ 13 - 2
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/tdgy/TdgyMapper.xml

@@ -1,6 +1,17 @@
 <?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.onemap.apply.mapper.tdgy.TdgyMapper">
-
+    <select id="getSuspectedIdleLand" resultType="map">
+        SELECT id, xmmc, crmj, ydkgsj
+        from tdgy_sj
+        WHERE (sfjg!=true or sfjg is null)
+        and (NOW() - sjkgsj > INTERVAL '365 days')
+        <if test="xmmc != null and xmmc != ''">
+            and xmmc like '%'||#{xmmc}||'%'
+        </if>
+        <if test="xzqh != null and xzqh != ''">
+            and xzqh = #{xzqh}
+        </if>
+        limit #{limit} offset #{offset};
+    </select>
 </mapper>