當前位置:
首頁 >
一对多 多对一 多对多 多条语句只出现一条的问题
發布時間:2024/1/23
29
豆豆
生活随笔
收集整理的這篇文章主要介紹了
一对多 多对一 多对多 多条语句只出现一条的问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><!-- 命名空間 xml與dao的連接 --><mapper namespace="com.aaa.dao.EmpMapper"><resultMap type="emp" id="empMap"><id column="empno" property="empno"/><association column="deptno" property="dept" javaType="dept"><id column="deptno" property="deptno"/></association></resultMap><select id="selectManytoOne" parameterType="int" resultMap="empMap">selecte.empno,e.ename,e.job,e.mgr,e.hiredate,e.sal,e.comm,e.deptno,d.dname,d.locfrom emp e left join dept d on e.deptno=d.deptnowhere d.deptno=#{deptno}</select></mapper>
原因在于個別開發者或同學沒有寫主表的empno, 會出現查詢結果有數據,但是結果只有一條的情況。
JAVA就業套餐課:https://edu.csdn.net/combo/detail/1230
總結
以上是生活随笔為你收集整理的一对多 多对一 多对多 多条语句只出现一条的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis there is no
- 下一篇: myeclipse maven 报错ja