package com.ktg.iscs.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ktg.common.annotation.Log; import com.ktg.common.core.controller.BaseController; import com.ktg.common.enums.BusinessType; import com.ktg.common.pojo.CommonResult; import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.iscs.domain.IsKey; import com.ktg.iscs.service.IIsKeyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 钥匙Controller * * @author cgj * @date 2024-11-19 */ @Api(tags = "钥匙") @RestController @RequestMapping("/iscs/key") public class IsKeyController extends BaseController { @Autowired private IIsKeyService isKeyService; /** * 查询钥匙分页 */ @ApiOperation("查询钥匙-分页") @Parameters({ @Parameter(name = "page", description = "Page"), @Parameter(name = "isKey", description = "实体参数") }) @PreAuthorize("@ss.hasPermi('iscs:key:list')") @GetMapping("/getIsKeyPage") public CommonResult> getIsKeyPage(Page page, IsKey isKey) { Page result = isKeyService.page(page, Wrappers.lambdaQuery() .orderByDesc(IsKey::getKeyId)); return CommonResult.success(result); } /** * 导出钥匙列表 */ @ApiOperation("导出钥匙列表") @Parameter(name = "isKey", description = "实体参数") @PreAuthorize("@ss.hasPermi('iscs:key:export')") @Log(title = "钥匙", businessType = BusinessType.EXPORT) @PostMapping("/exportIsKey") public void exportIsKey(HttpServletResponse response, IsKey isKey) { List list = isKeyService.selectIsKeyList(isKey); ExcelUtil util = new ExcelUtil(IsKey.class); util.exportExcel(response, list, "钥匙数据"); } /** * 获取钥匙详细信息 */ @ApiOperation("获取钥匙详细信息") @Parameter(name = "keyId", description = "keyId") @PreAuthorize("@ss.hasPermi('iscs:key:query')") @GetMapping(value = "/selectIsKeyById") public CommonResult selectIsKeyById(Long keyId) { return CommonResult.success(isKeyService.selectIsKeyByKeyId(keyId)); } /** * 新增钥匙 */ @ApiOperation("新增钥匙") @PreAuthorize("@ss.hasPermi('iscs:key:add')") @Log(title = "钥匙", businessType = BusinessType.INSERT) @PostMapping("/insertIsKey") public CommonResult insertIsKey(@RequestBody @Parameter(name = "isKey", description = "新增数据类,放到body") IsKey isKey) { return CommonResult.success(isKeyService.insertIsKey(isKey) == 1); } /** * 修改钥匙 */ @ApiOperation("修改钥匙") @PreAuthorize("@ss.hasPermi('iscs:key:edit')") @Log(title = "钥匙", businessType = BusinessType.UPDATE) @PostMapping("/updateIsKey") public CommonResult updateIsKey(@RequestBody @Parameter(name = "isKey", description = "修改数据类,放到body") IsKey isKey) { return CommonResult.success(isKeyService.updateIsKey(isKey) == 1); } /** * 删除钥匙 */ @ApiOperation("删除钥匙") @PreAuthorize("@ss.hasPermi('iscs:key:remove')") @Log(title = "钥匙", businessType = BusinessType.DELETE) @PostMapping("/deleteIsKeyByKeyIds") public CommonResult deleteIsKeyByKeyIds(String keyIds) { return CommonResult.success(isKeyService.deleteIsKeyByKeyIds(keyIds) != 0); } }