|
|
@@ -0,0 +1,106 @@
|
|
|
+package org.dromara.backstage.basics.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.constraints.*;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
|
+import org.dromara.common.log.annotation.Log;
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.core.validate.AddGroup;
|
|
|
+import org.dromara.common.core.validate.EditGroup;
|
|
|
+import org.dromara.common.log.enums.BusinessType;
|
|
|
+import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
+import org.dromara.backstage.basics.domain.vo.PtAreaVo;
|
|
|
+import org.dromara.backstage.basics.domain.bo.PtAreaBo;
|
|
|
+import org.dromara.backstage.basics.service.IPtAreaService;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 建筑物区域
|
|
|
+ * 前端访问路由地址为:/room/ptArea
|
|
|
+ *
|
|
|
+ * @author bing
|
|
|
+ * @date 2024-08-08
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/room/ptArea")
|
|
|
+public class PtAreaController extends BaseController {
|
|
|
+
|
|
|
+ private final IPtAreaService ptAreaService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询建筑物区域列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public R<List<PtAreaVo>> list(PtAreaBo bo) {
|
|
|
+ List<PtAreaVo> list = ptAreaService.queryList(bo);
|
|
|
+ return R.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出建筑物区域列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:export")
|
|
|
+ @Log(title = "建筑物区域", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(PtAreaBo bo, HttpServletResponse response) {
|
|
|
+ List<PtAreaVo> list = ptAreaService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "建筑物区域", PtAreaVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取建筑物区域详细信息
|
|
|
+ *
|
|
|
+ * @param areaId 主键
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:query")
|
|
|
+ @GetMapping("/{areaId}")
|
|
|
+ public R<PtAreaVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable Long areaId) {
|
|
|
+ return R.ok(ptAreaService.queryById(areaId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增建筑物区域
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:add")
|
|
|
+ @Log(title = "建筑物区域", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody PtAreaBo bo) {
|
|
|
+ return toAjax(ptAreaService.insertByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改建筑物区域
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:edit")
|
|
|
+ @Log(title = "建筑物区域", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody PtAreaBo bo) {
|
|
|
+ return toAjax(ptAreaService.updateByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除建筑物区域
|
|
|
+ *
|
|
|
+ * @param areaIds 主键串
|
|
|
+ */
|
|
|
+ @SaCheckPermission("room:ptArea:remove")
|
|
|
+ @Log(title = "建筑物区域", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{areaIds}")
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] areaIds) {
|
|
|
+ return toAjax(ptAreaService.deleteWithValidByIds(List.of(areaIds), true));
|
|
|
+ }
|
|
|
+}
|