IsKeyController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. package com.ktg.iscs.controller;
  2. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  3. import com.ktg.common.annotation.Log;
  4. import com.ktg.common.core.controller.BaseController;
  5. import com.ktg.common.enums.BusinessType;
  6. import com.ktg.common.pojo.CommonResult;
  7. import com.ktg.common.utils.poi.ExcelUtil;
  8. import com.ktg.iscs.domain.IsKey;
  9. import com.ktg.iscs.domain.vo.key.IsKeyVO;
  10. import com.ktg.iscs.service.IIsKeyService;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.v3.oas.annotations.Parameter;
  14. import io.swagger.v3.oas.annotations.Parameters;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.security.access.prepost.PreAuthorize;
  17. import org.springframework.web.bind.annotation.*;
  18. import javax.servlet.http.HttpServletResponse;
  19. import java.util.List;
  20. /**
  21. * 钥匙Controller
  22. *
  23. * @author cgj
  24. * @date 2024-11-19
  25. */
  26. @Api(tags = "钥匙")
  27. @RestController
  28. @RequestMapping("/iscs/key")
  29. public class IsKeyController extends BaseController
  30. {
  31. @Autowired
  32. private IIsKeyService isKeyService;
  33. /**
  34. * 查询钥匙分页
  35. */
  36. @ApiOperation("查询钥匙-分页")
  37. @Parameters({
  38. @Parameter(name = "page", description = "Page"),
  39. @Parameter(name = "isKey", description = "实体参数")
  40. })
  41. // @PreAuthorize("@ss.hasPermi('iscs:key:list')")
  42. @GetMapping("/getIsKeyPage")
  43. public CommonResult<Page<IsKeyVO>> getIsKeyPage(Page<IsKey> page, IsKey isKey)
  44. {
  45. // Page<IsKey> result = isKeyService.page(page, Wrappers.<IsKey>lambdaQuery()
  46. // .orderByDesc(IsKey::getKeyId));
  47. Page<IsKeyVO> result = isKeyService.getIsKeyPage(page, isKey);
  48. return CommonResult.success(result);
  49. }
  50. /**
  51. * 导出钥匙列表
  52. */
  53. @ApiOperation("导出钥匙列表")
  54. @Parameter(name = "isKey", description = "实体参数")
  55. @PreAuthorize("@ss.hasPermi('iscs:key:export')")
  56. @Log(title = "钥匙", businessType = BusinessType.EXPORT)
  57. @PostMapping("/exportIsKey")
  58. public void exportIsKey(HttpServletResponse response, IsKey isKey)
  59. {
  60. List<IsKey> list = isKeyService.selectIsKeyList(isKey);
  61. ExcelUtil<IsKey> util = new ExcelUtil<IsKey>(IsKey.class);
  62. util.exportExcel(response, list, "钥匙数据");
  63. }
  64. /**
  65. * 获取钥匙详细信息
  66. */
  67. @ApiOperation("获取钥匙详细信息")
  68. @Parameter(name = "keyId", description = "keyId")
  69. // @PreAuthorize("@ss.hasPermi('iscs:key:query')")
  70. @GetMapping(value = "/selectIsKeyById")
  71. public CommonResult<IsKey> selectIsKeyById(Long keyId)
  72. {
  73. return CommonResult.success(isKeyService.selectIsKeyByKeyId(keyId));
  74. }
  75. @ApiOperation("通过NFC获取钥匙详细信息")
  76. @Parameter(name = "nfc", description = "nfc")
  77. @GetMapping("/selectIsKeyByNfc")
  78. public CommonResult<IsKey> selectIsKeyByNfc(String nfc) {
  79. return CommonResult.success(isKeyService.selectIsKeyByNfc(nfc));
  80. }
  81. /**
  82. * 新增钥匙
  83. */
  84. @ApiOperation("新增钥匙")
  85. // @PreAuthorize("@ss.hasPermi('iscs:key:add')")
  86. @Log(title = "钥匙", businessType = BusinessType.INSERT)
  87. @PostMapping("/insertIsKey")
  88. public CommonResult<Boolean> insertIsKey(@RequestBody @Parameter(name = "isKey", description = "新增数据类,放到body") IsKey isKey)
  89. {
  90. return CommonResult.success(isKeyService.insertIsKey(isKey) == 1);
  91. }
  92. /**
  93. * 修改钥匙
  94. */
  95. @ApiOperation("修改钥匙")
  96. // @PreAuthorize("@ss.hasPermi('iscs:key:edit')")
  97. @Log(title = "钥匙", businessType = BusinessType.UPDATE)
  98. @PostMapping("/updateIsKey")
  99. public CommonResult<Boolean> updateIsKey(@RequestBody @Parameter(name = "isKey", description = "修改数据类,放到body") IsKey isKey)
  100. {
  101. return CommonResult.success(isKeyService.updateIsKey(isKey) == 1);
  102. }
  103. /**
  104. * 删除钥匙
  105. */
  106. @ApiOperation("删除钥匙")
  107. // @PreAuthorize("@ss.hasPermi('iscs:key:remove')")
  108. @Log(title = "钥匙", businessType = BusinessType.DELETE)
  109. @PostMapping("/deleteIsKeyByKeyIds")
  110. public CommonResult<Boolean> deleteIsKeyByKeyIds(String keyIds)
  111. {
  112. return CommonResult.success(isKeyService.deleteIsKeyByKeyIds(keyIds) != 0);
  113. }
  114. }