longhu 2 settimane fa
parent
commit
c40b2ff14e

+ 2 - 2
src/main/java/com/hr/controller/IpInterfaceController.java

@@ -114,8 +114,8 @@ public class IpInterfaceController {
     @PostMapping("/token/generate")
     public BaseReturnDto<SecretVO> generateToken(){
         SecretVO vo = new SecretVO();
-        String secret = RandomStringUtils.random(256, "0123456789abcdef");
-        String token = RandomStringUtils.random(64, "0123456789abcdef");
+        String secret = RandomStringUtils.random(64, "0123456789abcdef");
+        String token = RandomStringUtils.random(32, "0123456789abcdef");
         vo.setToken(token);
         vo.setSecret(secret);
         return BaseReturnDto.success(vo);

+ 2 - 2
src/main/java/com/hr/param/PageParam.java

@@ -7,8 +7,8 @@ import lombok.Data;
 public class PageParam {
 
     @Schema(description = "当前页码")
-    private Integer pageNum;
+    private Integer pageNum = 1;
     @Schema(description = "每页展示条数")
-    private Integer pageSize;
+    private Integer pageSize = 10;
 
 }

+ 1 - 1
src/main/java/com/hr/service/impl/IpAccountServiceImpl.java

@@ -59,7 +59,7 @@ public class IpAccountServiceImpl implements IpAccountService {
     public Page<IpAccountVO> paginQuery(IpAccountParam ipAccountParam, Integer current, Integer size) {
         IpAccountPO ipAccountPO = new IpAccountPO();
         BeanUtils.copyProperties(ipAccountParam, ipAccountPO);
-        Pageable pageAble = PageRequest.of(current, size);
+        Pageable pageAble = PageRequest.of(current -1, size);
         Specification<IpAccountPO> spec = (root, query, cb) -> {
 
             List<Predicate> predicates = new ArrayList<>();

+ 1 - 1
src/main/java/com/hr/service/impl/IpInterfaceServiceImpl.java

@@ -65,7 +65,7 @@ public class IpInterfaceServiceImpl implements IpInterfaceService {
          ExampleMatcher matcher = ExampleMatcher.matchingAll()
                  .withIgnoreNullValues()                              // 忽略 null 字段
                  .withIgnoreCase();
-         Pageable pageAble = PageRequest.of(current, size);
+         Pageable pageAble = PageRequest.of(current - 1 , size);
          Example<IpInterfacePO> example = Example.of(ipInterfacePO, matcher);
          Page<IpInterfacePO> page = ipInterfaceRepository.findAll(example, pageAble);
          List<IpInterfaceVO> resultList = new ArrayList<>();

+ 1 - 1
src/main/java/com/hr/service/impl/IpTokenInterfaceServiceImpl.java

@@ -105,7 +105,7 @@ public class IpTokenInterfaceServiceImpl implements IpTokenInterfaceService {
                 .withIgnoreCase();
         IpTokenInterfacePO po = new IpTokenInterfacePO();
         po.setStatus("normal");
-        Pageable pageAble = PageRequest.of(pageParam.getPageNum(), pageParam.getPageSize());
+        Pageable pageAble = PageRequest.of(pageParam.getPageNum() -1, pageParam.getPageSize());
         Example<IpTokenInterfacePO> example = Example.of(po, matcher);
         Page<IpTokenInterfacePO> result = ipTokenInterfaceRepository.findAll(example, pageAble);
         List<IpTokenInterfacePO> content = result.getContent();