|
@@ -0,0 +1,170 @@
|
|
|
+package com.zoniot.ccrc.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.zoniot.ccrc.commom.model.AjaxMessage;
|
|
|
+import com.zoniot.ccrc.commom.model.Pagination;
|
|
|
+import com.zoniot.ccrc.commom.model.ResultStatus;
|
|
|
+import com.zoniot.ccrc.dto.GridInfo;
|
|
|
+import com.zoniot.ccrc.entity.Building;
|
|
|
+import com.zoniot.ccrc.entity.Community;
|
|
|
+import com.zoniot.ccrc.entity.Device;
|
|
|
+import com.zoniot.ccrc.entity.GridManagement;
|
|
|
+import com.zoniot.ccrc.service.GridManagementService;
|
|
|
+import com.zoniot.ccrc.dto.GridUser;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * (GridManagement)控制层
|
|
|
+ *
|
|
|
+ * @author hym
|
|
|
+ * @since 2021-02-23 11:47:59
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/gridManagement")
|
|
|
+@Api(tags = "网格管理")
|
|
|
+public class GridManagementController {
|
|
|
+ /**
|
|
|
+ * 服务对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private GridManagementService gridManagementService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增一条数据
|
|
|
+ *
|
|
|
+ * @param gridInfo 实体类
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "insert", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "插入网格管理户表信息")
|
|
|
+ public AjaxMessage<Integer> insert(@ApiParam(value = "设置配置", required = true) @RequestBody GridInfo gridInfo) {
|
|
|
+ int result = gridManagementService.insert(gridInfo);
|
|
|
+
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改一条数据
|
|
|
+ *
|
|
|
+ * @param gridManagement 实体类
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "update", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "更改网格户表信息")
|
|
|
+ public AjaxMessage<Integer> update(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
|
|
|
+ int result = gridManagementService.update(gridManagement);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除一条数据
|
|
|
+ *
|
|
|
+ * @param gridManagement 参数对象
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "delete", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询设施配置列表")
|
|
|
+ public AjaxMessage<Integer> delete(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
|
|
|
+ int result = gridManagementService.deleteById(gridManagement.getId());
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param pageNum 偏移
|
|
|
+ * @param pageSize 条数
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "selectPage", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询网格管理列表")
|
|
|
+ public AjaxMessage<Pagination<GridManagement>> selectPage(Integer pageNum, Integer pageSize,
|
|
|
+ Integer userId, String waterNo
|
|
|
+ , String adddress, String name) {
|
|
|
+ GridManagement gridManagement = new GridManagement();
|
|
|
+ gridManagement.setAddress(adddress);
|
|
|
+ gridManagement.setUserId(userId);
|
|
|
+ gridManagement.setWaterMeterNo(waterNo);
|
|
|
+ gridManagement.setCustomerName(name);
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<GridManagement> gridManagements = gridManagementService.selectList(gridManagement);
|
|
|
+ Pagination<GridManagement> pages = new Pagination<>(gridManagements);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param pageNum 偏移
|
|
|
+ * @param pageSize 条数
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "selectGridPage", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询网格管理列表")
|
|
|
+ public AjaxMessage<Pagination<GridUser>> selectGridPage(Integer pageNum, Integer pageSize,
|
|
|
+ String name, Integer orgId) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<GridUser>gridUsers=gridManagementService.selectGirdUserInfo(name,orgId);
|
|
|
+ Pagination<GridUser> pages = new Pagination<>(gridUsers);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, pages);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @param
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getCommutityByOrg", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询小区信息")
|
|
|
+ public AjaxMessage<List<Community>> selectGridPage(Integer orgId) {
|
|
|
+
|
|
|
+ List<Community>communities=gridManagementService.getCommutityByOrg(orgId);
|
|
|
+
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, communities);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @param
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getBuildingByCommutity", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询建筑信息")
|
|
|
+ public AjaxMessage<List<Building>> getBuildingByCommutity(Integer commutityId) {
|
|
|
+
|
|
|
+ List<Building>buildings=gridManagementService.getBuildingByCommutity(commutityId);
|
|
|
+
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, buildings);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @param
|
|
|
+ * @return Response对象
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getDevices", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "查询建筑信息")
|
|
|
+ public AjaxMessage<List<Device>> getDevices(Integer buildingId, Integer userId, String address) {
|
|
|
+
|
|
|
+ List<Device>devices=gridManagementService.getDevices(buildingId,userId,address);
|
|
|
+
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, devices);
|
|
|
+ }
|
|
|
+}
|