@Test public void createOneLog() { String message = "put your face to the light!"; String permission = "查看lin的信息"; Long userId = 100L; String userName = "pedro"; String method = "GET"; String path = "/"; Integer status = 200; logService.createLog(message, permission, userId, userName, method, path, status); QueryWrapper<LogDO> condition = new QueryWrapper<>(); condition.eq("message", message); LogDO logDO = logMapper.selectOne(condition); assertEquals(logDO.getPermission(), permission); }
@Override public boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status) { LogDO record = LogDO.builder() .message(message) .userId(userId) .username(username) .statusCode(status) .method(method) .path(path) .build(); if (permission != null) { record.setPermission(permission); } return this.baseMapper.insert(record) > 0; }
LogServiceImpl extends ServiceImpl<LogMapper, LogDO> implements LogService { @Override public boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status) { LogDO record = LogDO.builder() .message(message) .userId(userId) .username(username) .statusCode(status) .method(method) .path(path) .build(); if (permission != null) { record.setPermission(permission); } return this.baseMapper.insert(record) > 0; } }
LogServiceImpl extends ServiceImpl<LogMapper, LogDO> implements LogService { @Override public boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status) { LogDO record = LogDO.builder() .message(message) .userId(userId) .username(username) .statusCode(status) .method(method) .path(path) .build(); if (permission != null) { record.setPermission(permission); } return this.baseMapper.insert(record) > 0; }  }
LogServiceImpl extends ServiceImpl<LogMapper, LogDO> implements LogService { @Override public boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status) { LogDO record = LogDO.builder() .message(message) .userId(userId) .username(username) .statusCode(status) .method(method) .path(path) .build(); if (permission != null) { record.setPermission(permission); } return this.baseMapper.insert(record) > 0; }  @Override IPage<LogDO> getLogs(Long page, Long count, String name, Date start, Date end); @Override IPage<LogDO> searchLogs(Long page, Long count, String name, String keyword, Date start, Date end); @Override IPage<String> getUserNames(Long page, Long count); @Override boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status); }
LogServiceImpl extends ServiceImpl<LogMapper, LogDO> implements LogService { @Override public boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status) { LogDO record = LogDO.builder() .message(message) .userId(userId) .username(username) .statusCode(status) .method(method) .path(path) .build(); if (permission != null) { record.setPermission(permission); } return this.baseMapper.insert(record) > 0; }  @Override IPage<LogDO> getLogs(Long page, Long count, String name, Date start, Date end); @Override IPage<LogDO> searchLogs(Long page, Long count, String name, String keyword, Date start, Date end); @Override IPage<String> getUserNames(Long page, Long count); @Override boolean createLog(String message, String permission, Long userId, String username, String method, String path, Integer status);  }