当前位置 : 主页 > 编程语言 > java >

mybatis Example多条件查询

来源:互联网 收集:自由互联 发布时间:2021-06-28
mybatis Example多条件查询 StudentExample studentExample = new StudentExample();studentExample.setOrderByClause("create_time DESC");String[] trainingType = userList.get(0).getTrainingType().split(",");//教育筛选if(trainingType.lengt
mybatis Example多条件查询
StudentExample studentExample = new StudentExample();
studentExample.setOrderByClause("create_time DESC");
String[] trainingType = userList.get(0).getTrainingType().split(",");
//教育筛选
if(trainingType.length > 0 && StringUtils.isNotBlank(userList.get(0).getBusinessCircle())){
    for(int i = 0;i < trainingType.length;i++){
        studentExample.or().andBusinessCircleEqualTo(userList.get(0).getBusinessCircle()).andTrainingTypeLike("%"+trainingType[i]+"%");
    }
}
List
 
   studentList = studentService.selectByExample(studentExample);
 
网友评论