登录中遇到账号和密码去数据库中查询因为查询是多条件的
所以需要使用QueryWrapper中allEq 而allEq如何添加条件使用map
位于mybatisplus的条件构造器的使用
QueryWrapperwrapper = new QueryWrapper<>(); Mapmm = new HashMap<>(); mm.put("account", uv.getAccount()); mm.put("passwd", uv.getPassword()); wrapper.allEq(mm); User user = us.getOne(wrapper); if (user == null) { map.put("code", 300); map.put("msg", "登录失败,账号密码错误"); System.out.println("登录失败,账号密码错误"); } else { map.put("code", 200); map.put("msg", "登录成功,生成令牌"+user.getName()); System.out.println("登录成功"); }