|
|
@@ -1,95 +1,100 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.rfidtoken;
|
|
|
-
|
|
|
-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.rfidtoken.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.rfidtoken.RfidTokenDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.rfidtoken.RfidTokenService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - rfid标识")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/rfid-token")
|
|
|
-@Validated
|
|
|
-public class RfidTokenController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private RfidTokenService rfidTokenService;
|
|
|
-
|
|
|
- @PostMapping("/insertRfidToken")
|
|
|
- @Operation(summary = "创建rfid标识")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:create')")
|
|
|
- public CommonResult<Long> insertRfidToken(@Valid @RequestBody RfidTokenSaveReqVO createReqVO) {
|
|
|
- return success(rfidTokenService.createRfidToken(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateRfidToken")
|
|
|
- @Operation(summary = "更新rfid标识")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:update')")
|
|
|
- public CommonResult<Boolean> updateRfidToken(@Valid @RequestBody RfidTokenSaveReqVO updateReqVO) {
|
|
|
- rfidTokenService.updateRfidToken(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteRfidTokenList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除rfid标识")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:delete')")
|
|
|
- public CommonResult<Boolean> deleteRfidTokenList(@RequestParam("ids") List<Long> ids) {
|
|
|
- rfidTokenService.deleteRfidTokenListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectRfidTokenById")
|
|
|
- @Operation(summary = "获得rfid标识")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:query')")
|
|
|
- public CommonResult<RfidTokenRespVO> selectRfidTokenById(@RequestParam("id") Long id) {
|
|
|
- RfidTokenDO rfidToken = rfidTokenService.getRfidToken(id);
|
|
|
- return success(BeanUtils.toBean(rfidToken, RfidTokenRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getRfidTokenPage")
|
|
|
- @Operation(summary = "获得rfid标识分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:query')")
|
|
|
- public CommonResult<PageResult<RfidTokenRespVO>> getRfidTokenPage(@Valid RfidTokenPageReqVO pageReqVO) {
|
|
|
- PageResult<RfidTokenDO> pageResult = rfidTokenService.getRfidTokenPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, RfidTokenRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportRfidTokenExcel")
|
|
|
- @Operation(summary = "导出rfid标识 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:rfid-token:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportRfidTokenExcel(@Valid RfidTokenPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<RfidTokenDO> list = rfidTokenService.getRfidTokenPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "rfid标识.xls", "数据", RfidTokenRespVO.class,
|
|
|
- BeanUtils.toBean(list, RfidTokenRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.rfidtoken;
|
|
|
+
|
|
|
+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.rfidtoken.vo.RfidTokenPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.rfidtoken.vo.RfidTokenRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.rfidtoken.vo.RfidTokenSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.rfidtoken.RfidTokenDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.rfidtoken.RfidTokenService;
|
|
|
+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 = "管理后台 - rfid标识")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/rfid-token")
|
|
|
+@Validated
|
|
|
+public class RfidTokenController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private RfidTokenService rfidTokenService;
|
|
|
+
|
|
|
+ @PostMapping("/insertRfidToken")
|
|
|
+ @Operation(summary = "创建rfid标识")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:create')")
|
|
|
+ public CommonResult<Long> insertRfidToken(@Valid @RequestBody RfidTokenSaveReqVO createReqVO) {
|
|
|
+ return success(rfidTokenService.createRfidToken(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateRfidToken")
|
|
|
+ @Operation(summary = "更新rfid标识")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:update')")
|
|
|
+ public CommonResult<Boolean> updateRfidToken(@Valid @RequestBody RfidTokenSaveReqVO updateReqVO) {
|
|
|
+ rfidTokenService.updateRfidToken(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteRfidTokenList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除rfid标识")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:delete')")
|
|
|
+ public CommonResult<Boolean> deleteRfidTokenList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ rfidTokenService.deleteRfidTokenListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectRfidTokenById")
|
|
|
+ @Operation(summary = "获得rfid标识")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:query')")
|
|
|
+ public CommonResult<RfidTokenRespVO> selectRfidTokenById(@RequestParam("id") Long id) {
|
|
|
+ RfidTokenDO rfidToken = rfidTokenService.getRfidToken(id);
|
|
|
+ return success(BeanUtils.toBean(rfidToken, RfidTokenRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getRfidTokenPage")
|
|
|
+ @Operation(summary = "获得rfid标识分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:query')")
|
|
|
+ public CommonResult<PageResult<RfidTokenRespVO>> getRfidTokenPage(@Valid RfidTokenPageReqVO pageReqVO) {
|
|
|
+ PageResult<RfidTokenDO> pageResult = rfidTokenService.getRfidTokenPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, RfidTokenRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportRfidTokenExcel")
|
|
|
+ @Operation(summary = "导出rfid标识 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:rfid-token:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportRfidTokenExcel(@Valid RfidTokenPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<RfidTokenDO> list = rfidTokenService.getRfidTokenPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "rfid标识.xls", "数据", RfidTokenRespVO.class,
|
|
|
+ BeanUtils.toBean(list, RfidTokenRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "机柜录入rfid标识")
|
|
|
+ @PostMapping("/insertRfidTokenByCabinet")
|
|
|
+ public CommonResult<Boolean> insertRfidTokenByCabinet(@RequestBody @Parameter(name = "rfidTokenDO", description = "新增数据类,放到body") RfidTokenDO rfidTokenDO)
|
|
|
+ {
|
|
|
+ return CommonResult.success(rfidTokenService.insertRfidTokenByCabinet(rfidTokenDO));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|