IsKeyController.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.ktg.iscs.controller;
  2. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.ktg.common.annotation.Log;
  5. import com.ktg.common.core.controller.BaseController;
  6. import com.ktg.common.enums.BusinessType;
  7. import com.ktg.common.pojo.CommonResult;
  8. import com.ktg.common.utils.poi.ExcelUtil;
  9. import com.ktg.iscs.domain.IsKey;
  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<IsKey>> getIsKeyPage(Page<IsKey> page, IsKey isKey)
  44. {
  45. Page<IsKey> result = isKeyService.page(page, Wrappers.<IsKey>lambdaQuery()
  46. .orderByDesc(IsKey::getKeyId));
  47. return CommonResult.success(result);
  48. }
  49. /**
  50. * 导出钥匙列表
  51. */
  52. @ApiOperation("导出钥匙列表")
  53. @Parameter(name = "isKey", description = "实体参数")
  54. @PreAuthorize("@ss.hasPermi('iscs:key:export')")
  55. @Log(title = "钥匙", businessType = BusinessType.EXPORT)
  56. @PostMapping("/exportIsKey")
  57. public void exportIsKey(HttpServletResponse response, IsKey isKey)
  58. {
  59. List<IsKey> list = isKeyService.selectIsKeyList(isKey);
  60. ExcelUtil<IsKey> util = new ExcelUtil<IsKey>(IsKey.class);
  61. util.exportExcel(response, list, "钥匙数据");
  62. }
  63. /**
  64. * 获取钥匙详细信息
  65. */
  66. @ApiOperation("获取钥匙详细信息")
  67. @Parameter(name = "keyId", description = "keyId")
  68. @PreAuthorize("@ss.hasPermi('iscs:key:query')")
  69. @GetMapping(value = "/selectIsKeyById")
  70. public CommonResult<IsKey> selectIsKeyById(Long keyId)
  71. {
  72. return CommonResult.success(isKeyService.selectIsKeyByKeyId(keyId));
  73. }
  74. /**
  75. * 新增钥匙
  76. */
  77. @ApiOperation("新增钥匙")
  78. @PreAuthorize("@ss.hasPermi('iscs:key:add')")
  79. @Log(title = "钥匙", businessType = BusinessType.INSERT)
  80. @PostMapping("/insertIsKey")
  81. public CommonResult<Boolean> insertIsKey(@RequestBody @Parameter(name = "isKey", description = "新增数据类,放到body") IsKey isKey)
  82. {
  83. return CommonResult.success(isKeyService.insertIsKey(isKey) == 1);
  84. }
  85. /**
  86. * 修改钥匙
  87. */
  88. @ApiOperation("修改钥匙")
  89. @PreAuthorize("@ss.hasPermi('iscs:key:edit')")
  90. @Log(title = "钥匙", businessType = BusinessType.UPDATE)
  91. @PostMapping("/updateIsKey")
  92. public CommonResult<Boolean> updateIsKey(@RequestBody @Parameter(name = "isKey", description = "修改数据类,放到body") IsKey isKey)
  93. {
  94. return CommonResult.success(isKeyService.updateIsKey(isKey) == 1);
  95. }
  96. /**
  97. * 删除钥匙
  98. */
  99. @ApiOperation("删除钥匙")
  100. @PreAuthorize("@ss.hasPermi('iscs:key:remove')")
  101. @Log(title = "钥匙", businessType = BusinessType.DELETE)
  102. @PostMapping("/deleteIsKeyByKeyIds")
  103. public CommonResult<Boolean> deleteIsKeyByKeyIds(String keyIds)
  104. {
  105. return CommonResult.success(isKeyService.deleteIsKeyByKeyIds(keyIds) != 0);
  106. }
  107. }