@Test public void getUsers() throws Exception { mvc.perform(get("/cms/log/users") .contentType(MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers. jsonPath("$.items").isArray()); }
@GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired public PageResponseVO getUsers( @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{count}") Long count, @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page}") Long page) { IPage<String> iPage = logService.getUserNames(page, count); return PageResponseVO.genPageResult(iPage.getTotal(), iPage.getRecords(), page, count); }
LogController { @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired public PageResponseVO getUsers( @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{count}") Long count, @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page}") Long page) { IPage<String> iPage = logService.getUserNames(page, count); return PageResponseVO.genPageResult(iPage.getTotal(), iPage.getRecords(), page, count); } }
LogController { @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired public PageResponseVO getUsers( @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{count}") Long count, @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page}") Long page) { IPage<String> iPage = logService.getUserNames(page, count); return PageResponseVO.genPageResult(iPage.getTotal(), iPage.getRecords(), page, count); }  }
LogController { @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired public PageResponseVO getUsers( @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{count}") Long count, @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page}") Long page) { IPage<String> iPage = logService.getUserNames(page, count); return PageResponseVO.genPageResult(iPage.getTotal(), iPage.getRecords(), page, count); }  @GetMapping("") @RouteMeta(permission = "查询所有日志", module = "日志", mount = true) @GroupRequired PageResponseVO getLogs(
            @RequestParam(name = "start", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date start,
            @RequestParam(name = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end,
            @RequestParam(name = "name", required = false) String name,
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page); @GetMapping("/search") @RouteMeta(permission = "搜索日志", module = "日志", mount = true) @GroupRequired PageResponseVO searchLogs(
            @RequestParam(name = "start", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date start,
            @RequestParam(name = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end,
            @RequestParam(name = "name", required = false) String name,
            @RequestParam(name = "keyword", required = false, defaultValue = "") String keyword,
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page); @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired PageResponseVO getUsers(
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page); }
LogController { @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired public PageResponseVO getUsers( @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{count}") Long count, @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page}") Long page) { IPage<String> iPage = logService.getUserNames(page, count); return PageResponseVO.genPageResult(iPage.getTotal(), iPage.getRecords(), page, count); }  @GetMapping("") @RouteMeta(permission = "查询所有日志", module = "日志", mount = true) @GroupRequired PageResponseVO getLogs(
            @RequestParam(name = "start", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date start,
            @RequestParam(name = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end,
            @RequestParam(name = "name", required = false) String name,
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page); @GetMapping("/search") @RouteMeta(permission = "搜索日志", module = "日志", mount = true) @GroupRequired PageResponseVO searchLogs(
            @RequestParam(name = "start", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date start,
            @RequestParam(name = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end,
            @RequestParam(name = "name", required = false) String name,
            @RequestParam(name = "keyword", required = false, defaultValue = "") String keyword,
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page); @GetMapping("/users") @RouteMeta(permission = "查询日志记录的用户", module = "日志", mount = true) @GroupRequired PageResponseVO getUsers(
            @RequestParam(name = "count", required = false, defaultValue = "10")
            @Min(value = 1, message = "{count}") Long count,
            @RequestParam(name = "page", required = false, defaultValue = "0")
            @Min(value = 0, message = "{page}") Long page);  }