|
@@ -1,95 +1,94 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.lockset;
|
|
|
|
|
-
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
-import jakarta.annotation.Resource;
|
|
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
-
|
|
|
|
|
-import jakarta.validation.constraints.*;
|
|
|
|
|
-import jakarta.validation.*;
|
|
|
|
|
-import jakarta.servlet.http.*;
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.controller.admin.lockset.vo.*;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.lockset.LocksetDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.service.lockset.LocksetService;
|
|
|
|
|
-
|
|
|
|
|
-@Tag(name = "管理后台 - 锁具")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/iscs/lockset")
|
|
|
|
|
-@Validated
|
|
|
|
|
-public class LocksetController {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private LocksetService locksetService;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/insertLockset")
|
|
|
|
|
- @Operation(summary = "创建锁具")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:create')")
|
|
|
|
|
- public CommonResult<Long> insertLockset(@Valid @RequestBody LocksetSaveReqVO createReqVO) {
|
|
|
|
|
- return success(locksetService.createLockset(createReqVO));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PutMapping("/updateLockset")
|
|
|
|
|
- @Operation(summary = "更新锁具")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:update')")
|
|
|
|
|
- public CommonResult<Boolean> updateLockset(@Valid @RequestBody LocksetSaveReqVO updateReqVO) {
|
|
|
|
|
- locksetService.updateLockset(updateReqVO);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @DeleteMapping("/deleteLocksetList")
|
|
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
- @Operation(summary = "批量删除锁具")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:delete')")
|
|
|
|
|
- public CommonResult<Boolean> deleteLocksetList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
- locksetService.deleteLocksetListByIds(ids);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/selectLocksetById")
|
|
|
|
|
- @Operation(summary = "获得锁具")
|
|
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:query')")
|
|
|
|
|
- public CommonResult<LocksetRespVO> selectLocksetById(@RequestParam("id") Long id) {
|
|
|
|
|
- LocksetDO lockset = locksetService.getLockset(id);
|
|
|
|
|
- return success(BeanUtils.toBean(lockset, LocksetRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/getLocksetPage")
|
|
|
|
|
- @Operation(summary = "获得锁具分页")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:query')")
|
|
|
|
|
- public CommonResult<PageResult<LocksetRespVO>> getLocksetPage(@Valid LocksetPageReqVO pageReqVO) {
|
|
|
|
|
- PageResult<LocksetDO> pageResult = locksetService.getLocksetPage(pageReqVO);
|
|
|
|
|
- return success(BeanUtils.toBean(pageResult, LocksetRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/exportLocksetExcel")
|
|
|
|
|
- @Operation(summary = "导出锁具 Excel")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lockset:export')")
|
|
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
- public void exportLocksetExcel(@Valid LocksetPageReqVO pageReqVO,
|
|
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
- List<LocksetDO> list = locksetService.getLocksetPage(pageReqVO).getList();
|
|
|
|
|
- // 导出 Excel
|
|
|
|
|
- ExcelUtils.write(response, "锁具.xls", "数据", LocksetRespVO.class,
|
|
|
|
|
- BeanUtils.toBean(list, LocksetRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.lockset;
|
|
|
|
|
+
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+
|
|
|
|
|
+import jakarta.validation.constraints.*;
|
|
|
|
|
+import jakarta.validation.*;
|
|
|
|
|
+import jakarta.servlet.http.*;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.lockset.vo.*;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.lockset.LocksetDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.service.lockset.LocksetService;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 锁具")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/iscs/lockset")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class LocksetController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private LocksetService locksetService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/insertLockset")
|
|
|
|
|
+ @Operation(summary = "创建锁具")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:create')")
|
|
|
|
|
+ public CommonResult<Long> insertLockset(@Valid @RequestBody LocksetSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(locksetService.createLockset(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/updateLockset")
|
|
|
|
|
+ @Operation(summary = "更新锁具")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateLockset(@Valid @RequestBody LocksetSaveReqVO updateReqVO) {
|
|
|
|
|
+ locksetService.updateLockset(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/deleteLocksetList")
|
|
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
+ @Operation(summary = "批量删除锁具")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteLocksetList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
+ locksetService.deleteLocksetListByIds(ids);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/selectLocksetById")
|
|
|
|
|
+ @Operation(summary = "获得锁具")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:query')")
|
|
|
|
|
+ public CommonResult<LocksetRespVO> selectLocksetById(@RequestParam("id") Long id) {
|
|
|
|
|
+ LocksetDO lockset = locksetService.getLockset(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(lockset, LocksetRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getLocksetPage")
|
|
|
|
|
+ @Operation(summary = "获得锁具分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:query')")
|
|
|
|
|
+ public CommonResult<PageResult<LocksetRespVO>> getLocksetPage(@Valid LocksetPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<LocksetRespVO> pageResult = locksetService.getLocksetPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportLocksetExcel")
|
|
|
|
|
+ @Operation(summary = "导出锁具 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lockset:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportLocksetExcel(@Valid LocksetPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<LocksetRespVO> list = locksetService.getLocksetPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "锁具.xls", "数据", LocksetRespVO.class, list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|