mybatis or查询

无敌的宇宙
无敌的宇宙
擅长邻域:Java,HTML,JavaScript,MySQL,支付,退款,图片上传

分类: Java 专栏: java 标签: mybatis or查询

2023-03-01 13:35:45 458浏览

mybatis or查询
public  List<EtStuWarning> getList( EtStuWarning o){


        LambdaQueryWrapper<EtStuWarning> lambdaQueryWrapper = Wrappers.lambdaQuery();

        if (Objects.nonNull(o.getStuname()) && o.getStuname().trim().length()>0 ) {
            lambdaQueryWrapper.like(EtStuWarning ::getStuname, o.getStuname());
        }
        if (Objects.nonNull(o.getStuno()) && o.getStuno().trim().length()>0 ) {
            lambdaQueryWrapper.like(EtStuWarning ::getStuno, o.getStuno());
        }

        if (Objects.nonNull(o.getMajor()) && o.getMajor().trim().length()>0 ) {
            lambdaQueryWrapper.like(EtStuWarning ::getMajor, o.getMajor());
        }

        if ( o.getTid()!=null ) {
            lambdaQueryWrapper.eq(EtStuWarning ::getTid, o.getTid());
        }
        if ( o.getCid()!=null ) {
            lambdaQueryWrapper.eq(EtStuWarning::getCid, o.getCid());
        }

        if ( o.getSelType()!=null && o.getSelType().equals("s") ) {

            lambdaQueryWrapper .and(wq -> wq
                    .gt(EtStuWarning::getNotSignNum, 2)
                    .or()
                    .gt(EtStuWarning::getNotTestNum,0));


        }

        List<EtStuWarning> li = stuWarningDao.selectList(lambdaQueryWrapper);

        return li;
    }

好博客就要一起分享哦!分享海报

此处可发布评论

评论(0展开评论

暂无评论,快来写一下吧

展开评论

客服QQ 1913284695