mybatis-plus使用要注意的事项

首先给大家推荐一下我老师大神的人工智能教学网站。教学不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵黄段子!点这里可以跳转到网站

使用mybatis-plus时,数据库表名只能是user而不能写成t_user

mybatis-plus的entitywapper拼接的sql解析:

User user = new User();
user.setName(name);
EntityWrapper<User> eWrapper = new EntityWrapper<User>(user);

if (id!=null) {
    eWrapper.where("id!={1}",id);
    }
return this.selectList(eWrapper); 

sql语句为:

SELECT  id,login_name AS loginName,`name`,`password`,salt,sex,age,phone,user_type AS userType,`status`,org_id AS orgId,ip,created,updated,last_login AS lastLogin  FROM user  
 WHERE  `name`=? 
AND (id!={1})

User user = new User();
user.setName(name);
EntityWrapper<User> eWrapper = new EntityWrapper<User>(user);

if (id!=null) {
    eWrapper.where("id!={0}",id);
    }
return this.selectList(eWrapper); 

sql语句为:

SELECT  id,login_name AS loginName,`name`,`password`,salt,sex,age,phone,user_type AS userType,`status`,org_id AS orgId,ip,created,updated,last_login AS lastLogin  FROM user  
 WHERE  `name`=? 
AND (id!={?})

点这里可以跳转到人工智能网站

发表评论