|
@@ -11,6 +11,8 @@ import com.zjugis.yzt.beans.entity.Pewg;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
@RestController
|
|
@@ -21,52 +23,64 @@ public class PewgController extends BaseRestController {
|
|
|
private PewgService pewgService;
|
|
|
|
|
|
/**
|
|
|
- * 获取批而未供信息(分页)
|
|
|
+ * 获取批而未供信息(分页)- 使用SQL查询,包含面积计算
|
|
|
*/
|
|
|
@GetMapping("/page")
|
|
|
- public IPage<PewgVO> getPewgList(
|
|
|
+ public IPage<PewgVO> getPewgListWithArea(
|
|
|
@RequestParam(defaultValue = "1") Integer current,
|
|
|
@RequestParam(defaultValue = "10") Integer size,
|
|
|
- @RequestParam(required = false) String dkMc, // 项目名称
|
|
|
- @RequestParam(required = false) String xzqmc, // 乡镇街道
|
|
|
- @RequestParam(required = false) String pcbh, // 批次名称
|
|
|
- @RequestParam(required = false) String lx, // 类型
|
|
|
- @RequestParam(required = false) String ghyt, // 规划用途
|
|
|
- @RequestParam(required = false) String wgyy // 未供原因
|
|
|
+ @RequestParam(required = false) String pch, // 批次名称
|
|
|
+ @RequestParam(required = false) String dkMc, // 项目名称
|
|
|
+ @RequestParam(required = false) Double minArea, // 剩余面积最小值(平方米)
|
|
|
+ @RequestParam(required = false) Double maxArea, // 剩余面积最大值(平方米)
|
|
|
+ @RequestParam(required = false) String xzz, // 乡镇街道
|
|
|
+ @RequestParam(required = false) String dkYt, // 土地用途
|
|
|
+ @RequestParam(required = false) String lx, // 类型
|
|
|
+ @RequestParam(required = false) String wgyy // 未供原因
|
|
|
) {
|
|
|
|
|
|
- QueryWrapper<Pewg> queryWrapper = new QueryWrapper<>();
|
|
|
-
|
|
|
- if (pcbh != null && !pcbh.isEmpty()) {
|
|
|
- queryWrapper.like("pcbh", pcbh);
|
|
|
+ Page<Pewg> page = new Page<>(current, size);
|
|
|
+
|
|
|
+ // 构建查询参数
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ if (pch != null && !pch.isEmpty()) {
|
|
|
+ params.put("pch", pch);
|
|
|
}
|
|
|
- if (lx != null && !lx.isEmpty()) {
|
|
|
- queryWrapper.like("fwlx", lx);
|
|
|
+ if (dkMc != null && !dkMc.isEmpty()) {
|
|
|
+ params.put("dkMc", dkMc);
|
|
|
}
|
|
|
- if (wgyy != null && !wgyy.isEmpty()) {
|
|
|
- queryWrapper.like("wgyy", wgyy);
|
|
|
+ if (minArea != null) {
|
|
|
+ params.put("minArea", minArea);
|
|
|
}
|
|
|
- if (dkMc != null && !dkMc.isEmpty()) {
|
|
|
- queryWrapper.like("dk_mc", dkMc);
|
|
|
+ if (maxArea != null) {
|
|
|
+ params.put("maxArea", maxArea);
|
|
|
}
|
|
|
- if (xzqmc != null && !xzqmc.isEmpty()) {
|
|
|
- queryWrapper.like("xzqmc", xzqmc);
|
|
|
+ if (xzz != null && !xzz.isEmpty()) {
|
|
|
+ params.put("xzz", xzz);
|
|
|
}
|
|
|
- if (ghyt != null && !ghyt.isEmpty()) {
|
|
|
- queryWrapper.like("ghyt", ghyt);
|
|
|
+ if (dkYt != null && !dkYt.isEmpty()) {
|
|
|
+ params.put("dkYt", dkYt);
|
|
|
}
|
|
|
- Page<Pewg> page = new Page<>(current, size);
|
|
|
- IPage<Pewg> pewgPage = pewgService.page(page, queryWrapper);
|
|
|
+ if (lx != null && !lx.isEmpty()) {
|
|
|
+ params.put("lx", lx);
|
|
|
+ }
|
|
|
+ if (wgyy != null && !wgyy.isEmpty()) {
|
|
|
+ params.put("wgyy", wgyy);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用自定义分页查询方法
|
|
|
+ IPage<Pewg> pewgPage = pewgService.pageWithAreaCustom(page, params);
|
|
|
|
|
|
return pewgPage.convert(this::convertToVO);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据ID获取批而未供信息
|
|
|
*/
|
|
|
@GetMapping("/{id}")
|
|
|
public PewgVO getPewgById(@PathVariable Integer id) {
|
|
|
- Pewg pewg = pewgService.getById(id);
|
|
|
+ Pewg pewg = pewgService.getByIdWithArea(id);
|
|
|
return convertToVO(pewg);
|
|
|
}
|
|
|
|
|
@@ -127,13 +141,7 @@ public class PewgController extends BaseRestController {
|
|
|
}
|
|
|
PewgVO vo = new PewgVO();
|
|
|
BeanUtils.copyProperties(pewg, vo);
|
|
|
- // 通过数据库st_area(shape)函数获取面积
|
|
|
- if (pewg.getObjectid() != null) {
|
|
|
- Double area = pewgService.getAreaById(pewg.getObjectid());
|
|
|
- if (area != null) {
|
|
|
- vo.setArea(new java.math.BigDecimal(area));
|
|
|
- }
|
|
|
- }
|
|
|
return vo;
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+}
|