|
@@ -0,0 +1,111 @@
|
|
|
+package com.qmrb.system.controller;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springdoc.core.annotations.ParameterObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.qmrb.system.common.result.PageResult;
|
|
|
+import com.qmrb.system.common.result.Result;
|
|
|
+import com.qmrb.system.common.result.ResultCode;
|
|
|
+import com.qmrb.system.framework.resubmit.Resubmit;
|
|
|
+import com.qmrb.system.service.IBarnRecordService;
|
|
|
+import com.qmrb.system.pojo.form.BarnRecordForm;
|
|
|
+import com.qmrb.system.pojo.vo.BarnRecordVO;
|
|
|
+import com.qmrb.system.pojo.query.BarnRecordQuery;
|
|
|
+import com.qmrb.system.pojo.vo.Option;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 岗亭端停车记录 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author gs
|
|
|
+ * @since 2025-02-26
|
|
|
+ */
|
|
|
+@Tag(name = "岗亭端停车记录接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/v1/record")
|
|
|
+@CrossOrigin
|
|
|
+public class BarnRecordController{
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBarnRecordService barnRecordService;
|
|
|
+
|
|
|
+ @Operation(summary = "岗亭端停车记录分页列表", security = {@SecurityRequirement(name = "Authorization")})
|
|
|
+ @GetMapping("/page")
|
|
|
+ public PageResult<BarnRecordVO> getPage(
|
|
|
+ @ParameterObject BarnRecordQuery queryParams
|
|
|
+ ) {
|
|
|
+ Page<BarnRecordVO> result = barnRecordService.getPage(queryParams);
|
|
|
+ return PageResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "新增岗亭端停车记录", security = {@SecurityRequirement(name = "Authorization")})
|
|
|
+ @PostMapping
|
|
|
+ @PreAuthorize("@ss.hasPerm('record:add')")
|
|
|
+ @Resubmit
|
|
|
+ public Result<BarnRecordForm> saveForm(
|
|
|
+ @RequestBody @Valid BarnRecordForm form
|
|
|
+ ) {
|
|
|
+ BarnRecordForm result = barnRecordService.saveForm(form);
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "岗亭端停车记录表单数据", security = {@SecurityRequirement(name = "Authorization")})
|
|
|
+ @GetMapping("/{id}/form")
|
|
|
+ public Result<BarnRecordForm> getForm(
|
|
|
+ @Parameter(description = "岗亭端停车记录ID") @PathVariable Long id
|
|
|
+ ) {
|
|
|
+ BarnRecordForm formData = barnRecordService.getFormData(id);
|
|
|
+ return Result.success(formData);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "修改岗亭端停车记录", security = {@SecurityRequirement(name = "Authorization")})
|
|
|
+ @PutMapping(value = "/{id}")
|
|
|
+ @PreAuthorize("@ss.hasPerm('record:edit')")
|
|
|
+ public Result<?> updateForm(
|
|
|
+ @Parameter(description = "岗亭端停车记录ID") @PathVariable Long id,
|
|
|
+ @RequestBody @Validated BarnRecordForm form) {
|
|
|
+
|
|
|
+ boolean result = barnRecordService.updateForm(id,form);
|
|
|
+ return Result.judge(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "删除岗亭端停车记录", security = {@SecurityRequirement(name = "Authorization")})
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ @PreAuthorize("@ss.hasPerm('record:delete')")
|
|
|
+ public Result<?> deleteUsers(
|
|
|
+ @Parameter(description = "岗亭端停车记录ID,多个以英文逗号(,)分割") @PathVariable String ids
|
|
|
+ ) {
|
|
|
+ if(StrUtil.isBlank(ids)) {
|
|
|
+ return Result.failed(ResultCode.PARAM_ERROR, "删除的岗亭端停车记录数据为空");
|
|
|
+ }
|
|
|
+ // 逻辑删除
|
|
|
+ List<Long> idList = Arrays.asList(ids.split(",")).stream()
|
|
|
+ .map(idStr -> Long.parseLong(idStr)).collect(Collectors.toList());
|
|
|
+ boolean result = barnRecordService.removeByIds(idList);
|
|
|
+ return Result.judge(result);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|