在一个数据库表对应的实体类的Mapperxml中,同时查询4张表,xml配置方面该怎么写啊?急!!!谢谢
在member_rate的mapper文件里写sql.member_rate的实体类里,我添加了其余三张表的字段....
在member_rate的mapper文件里写sql. member_rate的实体类里,我添加了其余三张表的字段.
展开
展开全部
类似下面这段,主要是把要配的list<Company>用 <collection>标签配置起来,然后查询的时候把对应的字段查出来,这样mybatis就会自动给你映射了
<resultMap id="RepairMap" type="com.xxx.model.Repair">
<id property="rId" column="r_id" javaType="java.lang.String"/>
<result property="rNo" column="r_no" javaType="java.lang.String"/>
<result property="rTestNo" column="r_testNo" javaType="java.lang.String"/>
<result property="rTwoCode" column="r_twoCode" javaType="java.lang.String"/>
<result property="rPublishTime" column="r_publishTime" javaType="java.util.Date"/>
<result property="rEndTime" column="r_endTime" javaType="java.util.Date"/>
<result property="rPersonId" column="r_personId" javaType="java.lang.String"/>
<result property="rPerson" column="r_person" javaType="java.lang.String"/>
<collection property="repairSet" ofType="com.xxx.model.RepairList">
<id property="rlId" column="rl_id" javaType="java.lang.String"/>
<result property="rlRNo" column="rl_rno" javaType="java.lang.String"/>
<result property="rlItemName" column="rl_itemName" javaType="java.lang.String"/>
<result property="rlItemDefect" column="rl_itemDefect" javaType="java.lang.String"/>
<result property="rlItemType" column="rl_itemType" javaType="java.lang.String"/>
<result property="rlPublishTime" column="rl_publishTime" javaType="java.util.Date"/>
<result property="rlFinishTime" column="rl_finishTime" javaType="java.util.Date"/>
<result property="rlDesc" column="rl_desc" javaType="java.lang.String"/>
<result property="rlCL" column="rl_CL" javaType="java.lang.Float"/>
<result property="rlWX" column="rl_WX" javaType="java.lang.Float"/>
</collection>
<collection property="test" ofType="com.xxx.model.Test">
<id property="tId" column="t_id" javaType="java.lang.String"/>
<result property="tNo" column="t_no" javaType="java.lang.String"/>
<result property="tTwoCode" column="t_twoCode" javaType="java.lang.String"/>
<result property="tTime" column="t_time" javaType="java.util.Date"/>
<result property="tAUFNR" column="t_AUFNR" javaType="java.lang.String"/>
<result property="tOrderForm" column="t_orderForm" javaType="java.lang.String"/>
<result property="tRowItems" column="t_rowItems" javaType="java.lang.String" />
<result property="tProductLine" column="t_productLine" javaType="java.lang.String"/>
<result property="tXHMS" column="t_XHMS" javaType="java.lang.String"/>
<result property="tResult" column="t_result" javaType="java.lang.Boolean"/>
<result property="tDefect" column="t_defect" javaType="java.lang.String"/>
<result property="tPersonId" column="t_personId" javaType="java.lang.String" />
<result property="tPerson" column="t_person" javaType="java.lang.String"/>
<result property="tCount" column="t_count" javaType="java.lang.Integer"/>
</collection>
</resultMap>
<resultMap id="RepairMap" type="com.xxx.model.Repair">
<id property="rId" column="r_id" javaType="java.lang.String"/>
<result property="rNo" column="r_no" javaType="java.lang.String"/>
<result property="rTestNo" column="r_testNo" javaType="java.lang.String"/>
<result property="rTwoCode" column="r_twoCode" javaType="java.lang.String"/>
<result property="rPublishTime" column="r_publishTime" javaType="java.util.Date"/>
<result property="rEndTime" column="r_endTime" javaType="java.util.Date"/>
<result property="rPersonId" column="r_personId" javaType="java.lang.String"/>
<result property="rPerson" column="r_person" javaType="java.lang.String"/>
<collection property="repairSet" ofType="com.xxx.model.RepairList">
<id property="rlId" column="rl_id" javaType="java.lang.String"/>
<result property="rlRNo" column="rl_rno" javaType="java.lang.String"/>
<result property="rlItemName" column="rl_itemName" javaType="java.lang.String"/>
<result property="rlItemDefect" column="rl_itemDefect" javaType="java.lang.String"/>
<result property="rlItemType" column="rl_itemType" javaType="java.lang.String"/>
<result property="rlPublishTime" column="rl_publishTime" javaType="java.util.Date"/>
<result property="rlFinishTime" column="rl_finishTime" javaType="java.util.Date"/>
<result property="rlDesc" column="rl_desc" javaType="java.lang.String"/>
<result property="rlCL" column="rl_CL" javaType="java.lang.Float"/>
<result property="rlWX" column="rl_WX" javaType="java.lang.Float"/>
</collection>
<collection property="test" ofType="com.xxx.model.Test">
<id property="tId" column="t_id" javaType="java.lang.String"/>
<result property="tNo" column="t_no" javaType="java.lang.String"/>
<result property="tTwoCode" column="t_twoCode" javaType="java.lang.String"/>
<result property="tTime" column="t_time" javaType="java.util.Date"/>
<result property="tAUFNR" column="t_AUFNR" javaType="java.lang.String"/>
<result property="tOrderForm" column="t_orderForm" javaType="java.lang.String"/>
<result property="tRowItems" column="t_rowItems" javaType="java.lang.String" />
<result property="tProductLine" column="t_productLine" javaType="java.lang.String"/>
<result property="tXHMS" column="t_XHMS" javaType="java.lang.String"/>
<result property="tResult" column="t_result" javaType="java.lang.Boolean"/>
<result property="tDefect" column="t_defect" javaType="java.lang.String"/>
<result property="tPersonId" column="t_personId" javaType="java.lang.String" />
<result property="tPerson" column="t_person" javaType="java.lang.String"/>
<result property="tCount" column="t_count" javaType="java.lang.Integer"/>
</collection>
</resultMap>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询