标签:cond ati mapper rap sys use app bat not
@Test public void testCondition() { String name = "王"; String email = ""; condition(name, email); } private void condition(String name, String email) { QueryWrapper<User> wrapper = new QueryWrapper<>(); //需要六行,太麻烦 // if(StringUtils.isNotBlank(name)){ // wrapper.like("name",name); // } // if(StringUtils.isNotBlank(name)){ // wrapper.like("name",name); // } wrapper.like(StringUtils.isNotBlank("name"), "name", name) .like(StringUtils.isNotBlank("email"), "email", email); List<User> users = userMapper.selectList(wrapper); for (User user : users) { System.out.println(user.toString()); } }
使用这种condition条件可以让语句看起来更加简洁一下
标签:cond ati mapper rap sys use app bat not
原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/11909184.html