From 5d7b65670282a4fad015e37d567cfa171b162052 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期二, 20 五月 2025 12:25:19 +0800
Subject: [PATCH] 基础代码

---
 pt-admin/src/main/java/com/ruoyi/web/controller/errand/CommunityController.java |  129 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 129 insertions(+), 0 deletions(-)

diff --git a/pt-admin/src/main/java/com/ruoyi/web/controller/errand/CommunityController.java b/pt-admin/src/main/java/com/ruoyi/web/controller/errand/CommunityController.java
new file mode 100644
index 0000000..867ea30
--- /dev/null
+++ b/pt-admin/src/main/java/com/ruoyi/web/controller/errand/CommunityController.java
@@ -0,0 +1,129 @@
+package com.ruoyi.web.controller.errand;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.errand.domain.Community;
+import com.ruoyi.errand.object.dto.sys.*;
+import com.ruoyi.errand.object.vo.app.CommunityListVO;
+import com.ruoyi.errand.object.vo.sys.*;
+import com.ruoyi.errand.service.CommunityService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+
+@RestController
+@RequestMapping(value = "/app/community")
+@Api(value = "小区信息", tags = "小区信息操作控制器")
+@Slf4j
+public class CommunityController {
+    @Autowired
+    private CommunityService communityService;
+
+
+
+    /**
+     * 区域内的小区列表
+     */
+    @GetMapping("/getCommunity")
+    @ApiOperation(value = "区域内的小区列表",tags = "app用户端-小区")
+    public R<List<CommunityListVO>> getCommunity(@RequestParam(value = "regionId") Integer regionId) {
+        return communityService.getCommunity(regionId);
+    }
+
+    /**
+     * 获取所有小区列表
+     */
+    @GetMapping("/getTotalCommunityList")
+    @PreAuthorize("@ss.hasPermi('system:index:statistics')")
+    @ApiOperation(value = "获取所有小区列表(开通的小区总数取列表大小吧)",tags = "系统后台-首页")
+    public R<List<CommunityListVO>> getTotalCommunityList() {
+        return communityService.getTotalCommunityList();
+    }
+
+    /**
+     * 加载未绑定跑腿员的小区  权限设置
+     */
+    @GetMapping("/getAllCommunityList")
+    @PreAuthorize("@ss.hasPermi('system:appuser:list')")
+    @ApiOperation(value = "跑腿员管理-加载未绑定跑腿员的小区", tags = "系统后台-跑腿员管理")
+    public R<List<AllCommunityListVO>> getAllCommunityList() {
+        return R.ok(communityService.getAllCommunityList());
+    }
+
+    /**
+     * 小区管理列表查看 权限设置
+     */
+    @PostMapping("/list")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-分页列表", tags = "系统后台-小区管理")
+    public R<IPage<CommunityPageListVO>> getCommunityPageList(@RequestBody @Valid CommunityPageListDTO communityPageListDTO) {
+        return R.ok(communityService.getCommunityPageList(communityPageListDTO));
+    }
+
+
+    /**
+     * 添加小区 权限设置
+     * 判断小区是否存在
+     * 判断跑腿员是否存在
+     * 判断跑腿员是否绑定
+     *
+     */
+    @PostMapping("/add")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-添加", tags = "系统后台-小区管理")
+    public R<Void> add(@RequestBody @Valid AddCommunityDTO addCommunityDTO) {
+        communityService.add(addCommunityDTO);
+        return R.ok();
+    }
+
+    /**
+     * 编辑 权限设置
+     */
+    @PutMapping("/edit")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-编辑", tags = "系统后台-小区管理")
+    public R<Void> edit(@RequestBody @Valid EditCommunityDTO editCommunityDTO) {
+        communityService.edit(editCommunityDTO);
+        return R.ok();
+    }
+
+    /**
+     * 删除 权限设置
+     * 删除小区 跑腿员 app用户
+     */
+    @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-删除", tags = "系统后台-小区管理")
+    public R<Void> delete(@RequestParam("id")Integer id) {
+        communityService.delete(id);
+        return R.ok();
+    }
+    /**
+     * 冻结 权限设置
+     */
+    @PutMapping("/froze")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-冻结/解冻", tags = "系统后台-小区管理")
+    public R<Void> froze(@RequestParam("id")Integer id) {
+        communityService.froze(id);
+        return R.ok();
+    }
+    /**
+     * 查看详情 权限设置
+     */
+
+    @GetMapping("/detail")
+    @PreAuthorize("@ss.hasPermi('system:community:list')")
+    @ApiOperation(value = "小区管理-查看详情", tags = "系统后台-小区管理")
+    public R<CommunitySysDetailVO> detail(@RequestParam("id") Integer id) {
+        return R.ok(communityService.detail(id));
+    }
+}    
\ No newline at end of file

--
Gitblit v1.7.1