Query your own connection

This commit is contained in:
JiaJu Zhuang
2023-08-26 20:59:39 +08:00
parent 93a1c12777
commit 02fabd5044
3 changed files with 10 additions and 0 deletions

View File

@ -46,4 +46,9 @@ public class OperationPageQueryParam extends PageQueryParam {
* operation type
*/
private String operationType;
/**
* 用户id
*/
private Long userId;
}

View File

@ -104,6 +104,9 @@ public class OperationServiceImpl implements OperationService {
if (StringUtils.isNotBlank(param.getOperationType())) {
queryWrapper.eq("operation_type", param.getOperationType());
}
if (param.getUserId() != null) {
queryWrapper.eq("user_id", param.getUserId());
}
Integer start = param.getPageNo();
Integer offset = param.getPageSize();
Page<OperationSavedDO> page = new Page<>(start, offset);

View File

@ -11,6 +11,7 @@ import ai.chat2db.server.tools.base.wrapper.result.ActionResult;
import ai.chat2db.server.tools.base.wrapper.result.DataResult;
import ai.chat2db.server.tools.base.wrapper.result.PageResult;
import ai.chat2db.server.tools.base.wrapper.result.web.WebPageResult;
import ai.chat2db.server.tools.common.util.ContextUtils;
import ai.chat2db.server.web.api.controller.operation.saved.converter.OperationWebConverter;
import ai.chat2db.server.web.api.controller.operation.saved.request.BatchTabCloseRequest;
import ai.chat2db.server.web.api.controller.operation.saved.request.OperationCreateRequest;
@ -54,6 +55,7 @@ public class OperationSavedController {
@GetMapping("/list")
public WebPageResult<OperationVO> list(OperationQueryRequest request) {
OperationPageQueryParam param = operationWebConverter.queryReq2param(request);
param.setUserId(ContextUtils.getUserId());
PageResult<Operation> dtoPageResult = operationService.queryPage(param);
List<OperationVO> operationVOS = operationWebConverter.dto2vo(dtoPageResult.getData());
return WebPageResult.of(operationVOS, dtoPageResult.getTotal(), request.getPageNo(), request.getPageSize());