Open vagabond1-1983 opened 8 years ago
转:http://www.tuicool.com/articles/Uj67jaN 第一种方式 sql语句里join
<resultMap id="jobResultBeanMap" type ="com.jd.pop.qa.model.JobBean" > <result property ="id" column="id" /> <result property ="status" column="status" typeHandler ="com.jd.pop.qa.handler.EnumJobStatusHandler" /> <result property ="venderId" column="venderId"/> <result property ="venderType" column="venderType"/> <result property ="venderCountName" column ="venderCountName" /> <result property ="startTime" column="startTime"/> <result property ="endTime" column="endTime"/> <collection property ="resultbeans" javaType ="ArrayList" column="jobId" ofType ="com.jd.pop.qa.model.ResultBean" > <result property ="wareId" column="wareId"/> <result property ="skuIds" column="skuIds"/> <result property ="wareStatus" column ="wareStatus" /> <result property ="warePriceInfos" column ="warePriceInfos" /> <result property ="wareStoreInfo" column ="wareStoreInfo" /> <result property ="wareNotes" column="wareNotes"/> </collection> </resultMap> <!-- 关联查询 JobBean和ResultBean--> <select id="queryJobBean" parameterType="string" resultMap ="jobResultBeanMap" > select jb.id, jb.status, jb.venderId, jb.venderType, jb.venderCountName, jb.startTime, jb.endTime, rb.jobId as jobId, rb.wareId, rb.skuIds, rb.wareStatus, rb.warePriceInfos, rb.wareStoreInfo, rb.wareNotes from JobBean jb left outer join ResultBean rb on jb.id = rb.jobId where jb.id = #{jobId} </select>
转:http://www.tuicool.com/articles/Uj67jaN 第一种方式 sql语句里join