Search in sources :

Example 61 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.

the class JenkinsRepositoryImpl method page.

@Override
public Page<Jenkins> page(JenkinsPageQry qry) {
    QueryWrapper<JenkinsDO> qw = new QueryWrapper<>();
    qw.eq("deleted", false);
    if (Objects.nonNull(qry.getJenkinsDTO()) && Objects.nonNull(qry.getJenkinsDTO().getName()))
        qw.like("name", qry.getJenkinsDTO().getName());
    IPage doPage = jenkinsMapper.selectPage(new PageDTO(qry.getPageIndex(), qry.getPageSize()), qw);
    return Page.of(doPage.getCurrent(), doPage.getSize(), doPage.getTotal(), jenkins2DOConvector.toDomainList(doPage.getRecords()));
}
Also used : IPage(com.baomidou.mybatisplus.core.metadata.IPage) PageDTO(com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) JenkinsDO(io.kenxue.cicd.infrastructure.repositoryimpl.middleware.jenkins.database.dataobject.JenkinsDO)

Example 62 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.

the class PipelineExecuteLoggerRepositoryImpl method page.

@Override
public Page<PipelineExecuteLogger> page(PipelineExecuteLoggerPageQry qry) {
    QueryWrapper<PipelineExecuteLoggerDO> qw = new QueryWrapper<>();
    qw.eq("deleted", false);
    if (Objects.nonNull(qry.getPipelineUuid()))
        qw.eq("pipeline_uuid", qry.getPipelineUuid());
    qw.orderByDesc("gmt_create");
    IPage doPage = pipelineExecuteLoggerMapper.selectPage(new PageDTO(qry.getPageIndex(), qry.getPageSize()), qw);
    return Page.of(doPage.getCurrent(), doPage.getSize(), doPage.getTotal(), pipelineExecuteLogger2DOConvector.toDomainList(doPage.getRecords()));
}
Also used : IPage(com.baomidou.mybatisplus.core.metadata.IPage) PageDTO(com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) PipelineExecuteLoggerDO(io.kenxue.cicd.infrastructure.repositoryimpl.pipeline.database.dataobject.PipelineExecuteLoggerDO)

Example 63 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.

the class PipelineNodeRepositoryImpl method page.

@Override
public Page<PipelineNode> page(PipelineNodePageQry qry) {
    QueryWrapper<PipelineNodeDO> qw = new QueryWrapper<>();
    IPage doPage = pipelineNodeMapper.selectPage(new PageDTO(qry.getPageIndex(), qry.getPageSize()), qw);
    return Page.of(doPage.getCurrent(), doPage.getSize(), doPage.getTotal(), pipelineNode2DOConvector.toDomainList(doPage.getRecords()));
}
Also used : IPage(com.baomidou.mybatisplus.core.metadata.IPage) PageDTO(com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) PipelineNodeDO(io.kenxue.cicd.infrastructure.repositoryimpl.application.database.dataobject.PipelineNodeDO)

Example 64 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.

the class ProjectInfoRepositoryImpl method page.

@Override
public Page<ProjectInfo> page(ProjectInfoPageQry qry) {
    QueryWrapper<ProjectInfoDO> qw = new QueryWrapper<>();
    UserDTO user = UserThreadContext.getUser();
    UserDO userDO = userMapper.selectOne(new QueryWrapper<UserDO>().eq("user_id", user.getUserId()));
    String uuid = userDO.getUuid();
    qw.eq("user_uuid", uuid);
    ProjectTypeEnum projectType = qry.getProjectType();
    IPage<ProjectInfoDO> doPage;
    PageDTO pageDTO = new PageDTO(qry.getPageIndex(), qry.getPageSize());
    if (projectType == ProjectTypeEnum.JOIN) {
        doPage = projectInfoMapper.queryRelatedProject(pageDTO, userDO.getUuid(), qry.getProjectInfoDTO().getUsername(), qry.getProjectInfoDTO().getProjectName());
    } else {
        if (Objects.nonNull(qry.getProjectInfoDTO()) && StringUtils.isNotBlank(qry.getProjectInfoDTO().getProjectName()))
            qw.like("project_name", qry.getProjectInfoDTO().getProjectName());
        doPage = projectInfoMapper.selectPage(pageDTO, qw);
        doPage.getRecords().forEach(v -> v.setUsername(userDO.getUserName()));
    }
    return Page.of(doPage.getCurrent(), doPage.getSize(), doPage.getTotal(), projectInfo2DOConvector.toDomainList(doPage.getRecords()));
}
Also used : PageDTO(com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO) ProjectInfoDO(io.kenxue.cicd.infrastructure.repositoryimpl.project.database.dataobject.ProjectInfoDO) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) UserDO(io.kenxue.cicd.infrastructure.repositoryimpl.sys.database.dataobject.UserDO) UserDTO(io.kenxue.cicd.coreclient.dto.sys.user.UserDTO) ProjectTypeEnum(io.kenxue.cicd.sharedataboject.project.enums.ProjectTypeEnum)

Example 65 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.

the class UserRepositoryImpl method getByUserId.

public User getByUserId(String userId) {
    QueryWrapper<UserDO> wrapper = new QueryWrapper<>();
    wrapper.eq("user_id", userId);
    UserDO userDO = userMapper.selectOne(wrapper);
    Assert.notNull(userDO, "There is no User for : " + userId);
    User user = DomainFactory.getUser();
    BeanUtils.copyProperties(userDO, user);
    return user;
}
Also used : User(io.kenxue.cicd.domain.domain.sys.User) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) UserDO(io.kenxue.cicd.infrastructure.repositoryimpl.sys.database.dataobject.UserDO)

Aggregations

QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)723 Transactional (org.springframework.transaction.annotation.Transactional)98 IPage (com.baomidou.mybatisplus.core.metadata.IPage)82 UserRolesVo (top.hcode.hoj.pojo.vo.UserRolesVo)74 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)72 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)65 ArrayList (java.util.ArrayList)61 Session (org.apache.shiro.session.Session)61 StatusFailException (top.hcode.hoj.common.exception.StatusFailException)60 StatusForbiddenException (top.hcode.hoj.common.exception.StatusForbiddenException)55 Problem (top.hcode.hoj.pojo.entity.problem.Problem)50 UpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper)45 Date (java.util.Date)44 HttpServletRequest (javax.servlet.http.HttpServletRequest)35 HashMap (java.util.HashMap)34 RequiresAuthentication (org.apache.shiro.authz.annotation.RequiresAuthentication)34 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)34 ApiOperation (io.swagger.annotations.ApiOperation)32 HttpSession (javax.servlet.http.HttpSession)31 Judge (top.hcode.hoj.pojo.entity.judge.Judge)30