<select id= "Finduserinfolistformap" resultmap= "Baseresultmap" >
SELECT p.name, U.u_name,u.company,u.procomany,u.mobile,u.email, R.money
From Iw_user u
Left JOIN Raiseentry R on R.userid=u.id
Left JOIN Project P on R.sourceid=p.projectid
</select>
After careful verification, the attributes in the Baseresultmap are all complete, but the number of record bars returned when the statement executes is inconsistent with queries directly in the database.
But after changing to the following statement, (more than one query field u.id)
<select id= "Finduserinfolistformap" resultmap= "Baseresultmap" >
SELECT u.id, P.name, U.u_name,u.company,u.procomany,u.mobile,u.email, R.money
From Iw_user u
Left JOIN raiseentry R on r.userid=u.id
Left JOIN Project P on r.sourceid=p.projectid </select>
The query results are normal. Baidu has found that some people have encountered this situation (http://www.iteye.com/problems/95931), the solution is:
1) SELECT * From ....
2) Select r.userid,u.id, R.sourceid,p.projectid (include these fields) ...
3) Encapsulate the field you want to query into a Dto object, and in Mapper.xml, define a resultmap,type that points to the Dto object, which is the mapping that requires querying the fields and the Dto object properties.
MyBatis correlation Query, the number of records queried is inconsistent with the database direct query, how to solve?