mybatis中级联查询后如何处理两个表的相同字段
时间: 2017-03-24来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
**mybatis中级联查询后如何处理两个表的相同字段**
现在出来了一个问题:我级联查询出来后,放置一个在Dept中,发现其中List中的employee对象中的status它直接是Dept的内容,并没有去找自己的内容。

部门: public class Dept { private Integer id ; private String name ; private String address ; private String status ; //状态位 private List<Employee> employees ; }


员工: public class Employee { private int id ; private String name; private String address ; private String status ; //状态位 }


级联映射表: <resultMap type="Dept" id="resultDeptMap"> <result property="id" column="d_id" /> <result property="name" column="d_name" /> <result property="address" column="d_address" /> <result property="status" column="status" /> <!-- 一对多 List 列表 collection:对关联查询到的多条记录映射到集合中 --> <collection property="employees" ofType="com.wm.mybatis.POJO.Employee" column="d_id" > <id property="id" column="e_id" javaType="int" jdbcType="INTEGER"/> <result property="name" column="e_name" javaType="string" jdbcType="VARCHAR"/> <result property="address" column="e_address" javaType="string" jdbcType="VARCHAR"/> <result property="d_id" column="d_id" javaType="int" jdbcType="INTEGER"/> <result property="status" column="status" /> </collection> </resultMap>



查询出来的结果:List<Employee>中Employee的status状态都是Dept的status,它没有对应到自己的状态位去。

请问大神们,怎么解决??有遇到过的没呢?

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行