| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package com.ktg.iscs.controller;
- 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.domain.vo.key.IsKeyVO;
- 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<Page<IsKeyVO>> getIsKeyPage(Page<IsKey> page, IsKey isKey)
- {
- // Page<IsKey> result = isKeyService.page(page, Wrappers.<IsKey>lambdaQuery()
- // .orderByDesc(IsKey::getKeyId));
- Page<IsKeyVO> result = isKeyService.getIsKeyPage(page, isKey);
- 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<IsKey> list = isKeyService.selectIsKeyList(isKey);
- ExcelUtil<IsKey> util = new ExcelUtil<IsKey>(IsKey.class);
- util.exportExcel(response, list, "钥匙数据");
- }
- /**
- * 获取钥匙详细信息
- */
- @ApiOperation("获取钥匙详细信息")
- @Parameter(name = "keyId", description = "keyId")
- // @PreAuthorize("@ss.hasPermi('iscs:key:query')")
- @GetMapping(value = "/selectIsKeyById")
- public CommonResult<IsKey> selectIsKeyById(Long keyId)
- {
- return CommonResult.success(isKeyService.selectIsKeyByKeyId(keyId));
- }
- @ApiOperation("通过NFC获取钥匙详细信息")
- @Parameter(name = "nfc", description = "nfc")
- @GetMapping("/selectIsKeyByNfc")
- public CommonResult<IsKey> selectIsKeyByNfc(String nfc) {
- return CommonResult.success(isKeyService.selectIsKeyByNfc(nfc));
- }
- /**
- * 新增钥匙
- */
- @ApiOperation("新增钥匙")
- // @PreAuthorize("@ss.hasPermi('iscs:key:add')")
- @Log(title = "钥匙", businessType = BusinessType.INSERT)
- @PostMapping("/insertIsKey")
- public CommonResult<Boolean> 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<Boolean> 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<Boolean> deleteIsKeyByKeyIds(String keyIds)
- {
- return CommonResult.success(isKeyService.deleteIsKeyByKeyIds(keyIds) != 0);
- }
- }
|