|
@@ -0,0 +1,116 @@
|
|
|
+package com.platform.rest.controller.preparation;
|
|
|
+
|
|
|
+import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.common.util.R;
|
|
|
+import com.platform.common.validation.group.AddGroup;
|
|
|
+import com.platform.common.validation.group.UpdateGroup;
|
|
|
+import com.platform.dao.dto.preparation.BuildingDTO;
|
|
|
+import com.platform.dao.vo.query.preparation.BuildingVO;
|
|
|
+import com.platform.dao.vo.sb.SbPositionVO;
|
|
|
+import com.platform.rest.log.annotation.SysLog;
|
|
|
+import com.platform.service.preparation.BuildingService;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 筹建管理 控制器
|
|
|
+ * @Author xc
|
|
|
+ * @Date 2022-12-28 20:00:26
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/preparation/building")
|
|
|
+public class BuildingController {
|
|
|
+
|
|
|
+ private final BuildingService buildingService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询单条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R<BuildingVO> getById(@PathVariable("id") String id) {
|
|
|
+ return new R(buildingService.getModelById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增记录
|
|
|
+ *
|
|
|
+ * @param buildingDTO 设备位置DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("新增设备位置")
|
|
|
+ @PostMapping
|
|
|
+ public R save(@Validated({AddGroup.class}) @RequestBody BuildingDTO buildingDTO) {
|
|
|
+ return new R<>(buildingService.saveModelByDTO(buildingDTO));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改记录
|
|
|
+ *
|
|
|
+ * @param buildingDTO 设备位置DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("修改设备位置")
|
|
|
+ @PutMapping("/{id}")
|
|
|
+ public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody BuildingDTO buildingDTO) {
|
|
|
+ buildingService.modModelByDTO(buildingDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除一条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("删除设备位置")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ public R removeById(@PathVariable String id) {
|
|
|
+ buildingService.deleteByPrimaryKey(id);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量记录
|
|
|
+ *
|
|
|
+ * @param ids 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("批量删除设备位置")
|
|
|
+ @DeleteMapping("")
|
|
|
+ public R removeIds(@RequestBody List<String> ids) {
|
|
|
+ buildingService.batchDelete(ids);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取分页
|
|
|
+ *
|
|
|
+ * @param pageNum 当前页码
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @param buildingDTO 设备位置DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ public R<AbstractPageResultBean<SbPositionVO>> query(BuildingDTO buildingDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
|
|
|
+ return new R(buildingService.selectPageList(buildingDTO, pageNum, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取列表
|
|
|
+ *
|
|
|
+ * @param buildingDTO 设备位置DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/longYan")
|
|
|
+ public R queryLongYan(BuildingDTO buildingDTO) {
|
|
|
+ return new R(buildingService.selectLongYanList(buildingDTO));
|
|
|
+ }
|
|
|
+}
|