- 生成配置文件:mybatis-config.xml(核心配置文件)
SELECT * FROM food join menu on food.menu_id = menu.menu_id where user_id = #{userId,jdbcType=INTEGER}
- mapper接口的路径
- result:
- resultType:返回单条
- resultMap: 返回集合
-
select:
-
id: 接口方法名
-
resultType:sql语句执行的返回值
-
parameterType: 参数类型
-
SELECT * FROM food join menu on food.menu_id = menu.menu_id where user_id = #{userId,jdbcType=INTEGER}
-
-
-
insert:
- 没有返回值
map当参数
1.4 模糊查询参数传递通配符%李%
1.5 generator二、配置优化 2.1 配置环境
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8ropkrm8-1652711597965)(C:Users70402AppDataRoamingTyporatypora-user-imagesimage-20220117232058918.png)]
三、动态SQL-
if
//查询user表,如果查询title不为空则按照给定title查询,否则查询所有
-
where
//sql语句where后面不能直接跟and 所以使用where标签,当匹配到第二个时自动删除and



