(1)接口中编写方法

public Emp getEmpByStep(Integer id);
public Dept getDeptById(Integer id);

(2)Mapper文件

 1   <!-- 使用association进行分步查询 -->
 2   <resultMap type="com.eu.bean.Emp" id="MyStep">
 3       <id column="id" property="id"/>
 4       <result column="last_name" property="lastName"/>
 5       <result column="gender" property="geder"/>
 6       <result column="email" property="email"/>
 7       <association property="dept" 
 8       select="com.eu.dao.DeptDao.getDeptById"
 9       column="d_id">
10       </association>
11   </resultMap>
12  <select id="getEmpByStep" resultMap="MyStep">
13       select * from emp where id = #{id}
14   </select>

 

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2021-12-16
  • 2021-07-17
  • 2022-01-27
  • 2021-07-14
  • 2021-12-23
猜你喜欢
  • 2021-12-14
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案