项目--在线教育
注意事项:
mybatis:做的工作是 数据库操作。
Mybatis Plus 主键生成策略:
自动增长
UUID 每次随机生成唯一的值 不能排序
Redis生成ID
mp自带策略 默认
twitter的snowflake算法
MP修改 自动填充
mp实现自动填充
设置默认值:
handler文件的insert override方法里面
乐观锁:
关键是注解 @Version
添加version 字段,version的包是 苞米豆 的包
mp查询
mp删除
性能分析
mp实现复杂的查询
lt:less than 小于
le:less than or equal to 小于等于
eq:equal to 等于
ne:not equal to 不等于
ge:greater than or equal to 大于等于
gt:greater than 大于
1、ge、gt、le、lt、isNull、isNotNull
SQL:UPDATE user SET deleted=1 WHERE deleted=0 AND name IS NULL AND age >= ? AND email IS NOT NULL
2、eq、ne
SELECT id,name,age,email,create_time,update_time,deleted,version FROM user WHERE deleted=0 AND name = ?
3、between、notBetween
SELECT COUNT(1) FROM user WHERE deleted=0 AND age BETWEEN ? AND ?
4、allEq
SELECT id,name,age,email,create_time,update_time,deleted,version
FROM user WHERE deleted=0 AND name = ? AND id = ? AND age = ?
5、like、notLike、likeLeft、likeRight
SELECT id,name,age,email,create_time,update_time,deleted,version
FROM user WHERE deleted=0 AND name NOT LIKE ? AND email LIKE ?
靠技术实力称霸,千面鬼手大人万岁!