报错原因:我们使用多表查association类型
<resultMap id="NodeVOResult" type="com.dkd.manage.vo.NodeVO">
<result property="id" column="id" />
<result property="regionId" column="region_id" />
<result property="partnerId" column="partner_id" />
<result property="nodeName" column="node_name" />
<result property="address" column="address" />
<result property="businessType" column="business_type" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="vmCount" column="vm_count" />
<association property="region" javaType="Region">
select id, region_name from tb_region where id = #{regionId}
</association>
<association property="region" javaType="region" column="region_id"
select="com.dkd.manage.mapper.RegionMapper.selectRegionById"/>
我们定位到
<association property="region" javaType="Region">
select id, region_name from tb_region where id = #{regionId}
</association>
此处报错,我们换种写法
<association property="region" javaType="region" column="region_id"
select="com.dkd.manage.mapper.RegionMapper.selectRegionById"/>
此时不再报错,解释以上代码:
column指,使用某一列作为参数进行查询操作
select指,使用mapper中的某一个方法,
形如:
package com.dkd.manage.mapper;
import java.util.List;
import com.dkd.manage.domain.Node;
import com.dkd.manage.vo.NodeVO;
public interface NodeMapper
{
/**
* 查询点位管理
*
* @param id 点位管理主键
* @return 点位管理
*/
public Node selectNodeById(Long id);
}