Mybatis Example

下段代码有误
 Example example = new Example(ProductLine.class);
        example.createCriteria().andEqualTo("teamCount", userTeam); //默认使用第一个Criteria
        example.createCriteria().andEqualTo("period", period); 
        List<ProductLine> productLines = ProductLineMapper.selectByExample(example);

应该改为

 Example example = new Example(ProductLine.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("teamCount", userTeam);
        criteria.andEqualTo("period", period);
        List<ProductLine> productLines = ProductLineMapper.selectByExample(example);

 或

 Example example = new Example(ProductLine.class);
        example.createCriteria().andEqualTo("teamCount", userTeam).andEqualTo("period", period);
        List<ProductLine> productLines = ProductLineMapper.selectByExample(example);

 

 





posted @ 2020-03-26 20:27  Raki0101  阅读(196)  评论(0)    收藏  举报