|
@@ -1,95 +1,93 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.locktype;
|
|
|
|
|
-
|
|
|
|
|
-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.locktype.vo.*;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.locktype.LockTypeDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.service.locktype.LockTypeService;
|
|
|
|
|
-
|
|
|
|
|
-@Tag(name = "管理后台 - 挂锁类型")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/iscs/lock-type")
|
|
|
|
|
-@Validated
|
|
|
|
|
-public class LockTypeController {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private LockTypeService lockTypeService;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/insertLockType")
|
|
|
|
|
- @Operation(summary = "创建挂锁类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:create')")
|
|
|
|
|
- public CommonResult<Long> insertLockType(@Valid @RequestBody LockTypeSaveReqVO createReqVO) {
|
|
|
|
|
- return success(lockTypeService.createLockType(createReqVO));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PutMapping("/updateLockType")
|
|
|
|
|
- @Operation(summary = "更新挂锁类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:update')")
|
|
|
|
|
- public CommonResult<Boolean> updateLockType(@Valid @RequestBody LockTypeSaveReqVO updateReqVO) {
|
|
|
|
|
- lockTypeService.updateLockType(updateReqVO);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @DeleteMapping("/deleteLockTypeList")
|
|
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
- @Operation(summary = "批量删除挂锁类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:delete')")
|
|
|
|
|
- public CommonResult<Boolean> deleteLockTypeList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
- lockTypeService.deleteLockTypeListByIds(ids);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/selectLockTypeById")
|
|
|
|
|
- @Operation(summary = "获得挂锁类型")
|
|
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:query')")
|
|
|
|
|
- public CommonResult<LockTypeRespVO> selectLockTypeById(@RequestParam("id") Long id) {
|
|
|
|
|
- LockTypeDO lockType = lockTypeService.getLockType(id);
|
|
|
|
|
- return success(BeanUtils.toBean(lockType, LockTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/getLockTypePage")
|
|
|
|
|
- @Operation(summary = "获得挂锁类型分页")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:query')")
|
|
|
|
|
- public CommonResult<PageResult<LockTypeRespVO>> getLockTypePage(@Valid LockTypePageReqVO pageReqVO) {
|
|
|
|
|
- PageResult<LockTypeDO> pageResult = lockTypeService.getLockTypePage(pageReqVO);
|
|
|
|
|
- return success(BeanUtils.toBean(pageResult, LockTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/exportLockTypeExcel")
|
|
|
|
|
- @Operation(summary = "导出挂锁类型 Excel")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:lock-type:export')")
|
|
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
- public void exportLockTypeExcel(@Valid LockTypePageReqVO pageReqVO,
|
|
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
- List<LockTypeDO> list = lockTypeService.getLockTypePage(pageReqVO).getList();
|
|
|
|
|
- // 导出 Excel
|
|
|
|
|
- ExcelUtils.write(response, "挂锁类型.xls", "数据", LockTypeRespVO.class,
|
|
|
|
|
- BeanUtils.toBean(list, LockTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.locktype;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.locktype.vo.LockTypePageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.locktype.vo.LockTypeRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.locktype.vo.LockTypeSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.locktype.LockTypeDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.service.locktype.LockTypeService;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 挂锁类型")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/iscs/lock-type")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class LockTypeController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private LockTypeService lockTypeService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/insertLockType")
|
|
|
|
|
+ @Operation(summary = "创建挂锁类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:create')")
|
|
|
|
|
+ public CommonResult<Long> insertLockType(@Valid @RequestBody LockTypeSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(lockTypeService.createLockType(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/updateLockType")
|
|
|
|
|
+ @Operation(summary = "更新挂锁类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateLockType(@Valid @RequestBody LockTypeSaveReqVO updateReqVO) {
|
|
|
|
|
+ lockTypeService.updateLockType(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/deleteLockTypeList")
|
|
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
+ @Operation(summary = "批量删除挂锁类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteLockTypeList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
+ lockTypeService.deleteLockTypeListByIds(ids);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/selectLockTypeById")
|
|
|
|
|
+ @Operation(summary = "获得挂锁类型")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:query')")
|
|
|
|
|
+ public CommonResult<LockTypeRespVO> selectLockTypeById(@RequestParam("id") Long id) {
|
|
|
|
|
+ LockTypeDO lockType = lockTypeService.getLockType(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(lockType, LockTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getLockTypePage")
|
|
|
|
|
+ @Operation(summary = "获得挂锁类型分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:query')")
|
|
|
|
|
+ public CommonResult<PageResult<LockTypeRespVO>> getLockTypePage(@Valid LockTypePageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<LockTypeRespVO> pageResult = lockTypeService.getLockTypePage(pageReqVO);
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, LockTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportLockTypeExcel")
|
|
|
|
|
+ @Operation(summary = "导出挂锁类型 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:lock-type:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportLockTypeExcel(@Valid LockTypePageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<LockTypeRespVO> list = lockTypeService.getLockTypePage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "挂锁类型.xls", "数据", LockTypeRespVO.class,
|
|
|
|
|
+ BeanUtils.toBean(list, LockTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|