聚合查询的时候报错
Cause: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.sxt.mapper.HostMapper.hostPowerResultMap
java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.sxt.mapper.HostMapper.hostPowerResultMap
xml文件
<resultMap id="hostResultMap" type="com.sxt.pojo.Host">
<id column="hid" property="hid" />
<result column="hname" property="hname" />
<result column="hpwd" property="hpwd" />
<result column="hphone" property="hphone" />
<result column="starttime" property="starttime" />
<result column="status" property="status" />
<result column="strong" property="strong" />
<result column="ordernumber" property="ordernumber" />
<association property="hostPower" javaType="com.sxt.pojo.HostPower" resultMap="hostPowerResultMap" autoMapping="true">
<!-- <id column="hpid" property="hpid"/>-->
<!-- <result column="hpstar" property="hpstar" />-->
<!-- <result column="hpstart_begindate" property="hpstartBegindate" />-->
<!-- <result column="hpstar_enddate" property="hpstarEnddate" />-->
<!-- <result column="hp_order_power" property="hpOrderPower" />-->
<!-- <result column="hpstar_begintime" property="hpstarBegintime" />-->
<!-- <result column="hpstar_endtime" property="hpstarEndtime" />-->
<!-- <result column="hpdiscount" property="hpdiscount" />-->
<!-- <result column="hp_dis_starttime" property="hpDisStarttime" />-->
<!-- <result column="hp_dis_endtime" property="hpDisEndtime" />-->
<!-- <result column="hpprice" property="hpprice" />-->
<!-- <result column="hpcosts" property="hpcosts" />-->
<!-- <result column="hostid" property="hostid" />-->
</association>
</resultMap>
<select id="selHostInfo" resultMap="hostResultMap">
select * from t_host h left join t_host_power p
on h.hid = p.hostid
<where>
<if test="hostCondition.hname!='' and hostCondition.hname != null" >
and h.hname like concat('%',#{hostCondition.hname},'%')
</if>
<if test="hostCondition.status != '' and hostCondition.status != null">
and h.status = #{hostCondition.status}
</if>
<if test="hostCondition.hpstar != '' and hostCondition.hpstar != null">
and p.hpstar = #{hostCondition.hpstar}
</if>
<if test="hostCondition.hpdiscount != '' and hostCondition.hpdiscount != null">
and p.hpdiscount = #{hostCondition.hpdiscount}
</if>
</where>
order by h.strong
<if test="hostCondition.strong != '' and hostCondition.strong != null">
${hostCondition.strong}
</if>
</select>
<resultMap id="hostPowerResultMap" type="com.sxt.pojo.HostPower">
<id column="hpid" property="hpid" />
<result column="hpstar" property="hpstar" />
<result column="hpstart_begindate" property="hpstartBegindate" />
<result column="hpstar_enddate" property="hpstarEnddate" />
<result column="hp_order_power" property="hpOrderPower" />
<result column="hpstar_begintime" property="hpstarBegintime" />
<result column="hpstar_endtime" property="hpstarEndtime" />
<result column="hpdiscount" property="hpdiscount" />
<result column="hp_dis_starttime" property="hpDisStarttime" />
<result column="hp_dis_endtime" property="hpDisEndtime" />
<result column="hpprice" property="hpprice" />
<result column="hpcosts" property="hpcosts" />
<result column="hostid" property="hostid" />
</resultMap>
解决
需要将类的变量和列名转换放在内(注释内),或者将另一个类的转换放在当前xml的内