随笔 - 37,  文章 - 0,  评论 - 0,  阅读 - 15608

随笔分类 -  MyBatis

MyBatis查询:一对多映射关系
摘要:@Mapper public interface ParameterMapper { Dept GetDeptAndEmp(@Param("id") Integer did); } <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PU 阅读全文
posted @ 2022-06-10 23:10 西凉# 阅读(32) 评论(0) 推荐(0) 编辑
MyBatis查询:多对一映射关系
摘要:通过级联属性复制解决多对一的映射关系 通过association解决多对一的映射关系 通过级联属性复制解决多对一的映射关系 Mapper层 @Mapper public interface ParameterMapper { Emp GetEmpAndDept(@Param("id") Intege 阅读全文
posted @ 2022-06-10 22:21 西凉# 阅读(27) 评论(0) 推荐(0) 编辑
回顾jdbc
摘要:@Autowired private ParameterMapper parameterMapper; //回顾jdbc占位符拼接 @Test public void fun1() throws Exception { String username="张三"; Class.forName("com 阅读全文
posted @ 2022-06-10 22:02 西凉# 阅读(18) 评论(0) 推荐(0) 编辑
resultMap解决字段名和属性名不一致
摘要:id设置主键的映射关系 result设置普通字段的映射关系 就算属性名和字段名一样也要设置映射关系,不能省略! type是实体类 property:设置映射关系中的属性名,必须是type属性所设置的实体类类型中的属性名 column:设置映射关系中的字段名,必须是sql语句查询出的字段名 resul 阅读全文
posted @ 2022-06-10 19:35 西凉# 阅读(34) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示