mybatis两表联合查询
来源:互联网 发布:excel表格找相同数据 编辑:程序博客网 时间:2024/05/17 11:05
tbl_emp包含字段:emp_id, emp_name, gender, email, d_id
tbl_dept包含字段:dept_id,dept_name
部分代码:
<resultMap type="com.atguigu.crud.bean.Employee" id="WithDeptBaseResultMap"> <id column="emp_id" property="empId" jdbcType="INTEGER" /> <result column="emp_name" property="empName" jdbcType="VARCHAR" /> <result column="gender" property="gender" jdbcType="CHAR" /> <result column="email" property="email" jdbcType="VARCHAR" /> <result column="d_id" property="dId" jdbcType="INTEGER" /> <!-- 指定联合查询出的部门的封装 --> <association property="department" javaType="com.atguigu.crud.bean.Department"> <id column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> </association> </resultMap>
<sql id="WithDept_Base_Column_List"> emp_id, emp_name, gender, email, d_id,dept_id,dept_name </sql>
<select id="selectByExampleWithDept" resultMap="WithDept_Base_Column_List"> select <if test="distinct" > distinct </if> <include refid="WithDept_Base_Column_List" /> from tbl_emp left join tbl_dept on tbl_emp.'d_id'=tbl_dept.'dept_id' <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null" > order by ${orderByClause} </if> </select>
阅读全文
0 0
- mybatis两表联合查询
- 两表联合查询
- MyBatis之多表联合查询
- mybatis 多表联合查询
- mysql两表联合查询
- MyBatis 多表联合查询及优化
- MyBatis 多表联合查询及优化
- MyBatis 多表联合查询及优化
- MyBatis 多表联合查询及优化
- MyBatis的多表联合查询
- MyBatis 多表联合查询及优化
- MyBatis 多表联合查询及优化
- mybatis多表联合查询及优化
- MyBatis第四步、多表联合查询
- MyBatis 多表联合查询及优化
- MyBatis 多表联合查询及优化
- MyBatis之三:多表联合查询
- Mybatis联合查询
- HDU
- 类
- 系统范围内拥有相同基址的DLL 以及这样做的原因
- 【python】Python速成(四) --函数式编程
- poj3067 Japan 树状数组+逆序对
- mybatis两表联合查询
- 欢迎使用CSDN-markdown编辑器
- SQL优化
- Java——使用缓冲流实现文件的拷贝
- Deeplearning4j 实战 (11):基于Nd4j的线性回归模型的实现
- 自定义 ViewGroup(二) 事件分发
- LoadRunner:Controller及结果分析 一、性能测试概述 1、关于性能测试目标: ①TPS ②一定并发用户数下功能点的响应时间 ③一定响应时间内功能点的并发用户数 性能测试不是
- [数学杂题 随机]【NOIP2014】解方程
- Java小数转换成百分数