wap網(wǎng)站建設(shè)公司新聞?lì)^條今天最新消息
mybatis
There is no getter for property named 'car_port_ids' in 'class java.lang.String
出現(xiàn)這種錯(cuò)誤我這邊是mapper.xml子查詢字段不對(duì)導(dǎo)致的
我把查詢結(jié)果的列的字段放進(jìn)去結(jié)果不識(shí)別car_port_ids
可能我這種字段本身就有問題
技術(shù)博客 http://idea.coderyj.com/
1.解決
<resultMap id="BaseResultMap" type="com.cspid.entity.SysDevice"><id column="id" jdbcType="VARCHAR" property="id"/><result column="line_id" jdbcType="VARCHAR" property="lineId"/><result column="car_port_ids" jdbcType="VARCHAR" property="carPortIds"/><result column="power_state" jdbcType="VARCHAR" property="powerState"/><result column="charge_model_id" jdbcType="VARCHAR" property="chargeModelId"/><result column="park_name" jdbcType="VARCHAR" property="parkName"/><collection property="carportList" select="selectCarportList"column="{carPortIds=car_port_ids}" ofType="com.cspid.entity.SysCarport" javaType="arraylist"></collection>
如果不以別名的方式傳遞 直接報(bào)錯(cuò)
{carPortIds=car_port_ids}
2.子查詢 carPortIds
不能是car_port_ids
這樣直接報(bào)錯(cuò)了
<select id="selectCarportList" resultMap="BaseResultMapCarport">select cp.* from sys_carport cp<where><if test="1">and cp.id in<foreach item="ed" index="index" collection="carPortIds.split(',')" open="(" separator="," close=")">'${ed}'</foreach></if></where></select>