一对多 多对一 多对多 多条语句只出现一条的问题
生活随笔
收集整理的這篇文章主要介紹了
一对多 多对一 多对多 多条语句只出现一条的问题
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<?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>
原因在于個(gè)別開發(fā)者或同學(xué)沒有寫主表的empno, 會(huì)出現(xiàn)查詢結(jié)果有數(shù)據(jù),但是結(jié)果只有一條的情況。
JAVA就業(yè)套餐課:https://edu.csdn.net/combo/detail/1230
總結(jié)
以上是生活随笔為你收集整理的一对多 多对一 多对多 多条语句只出现一条的问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis there is no
- 下一篇: myeclipse maven 报错ja