mybatis foreach報錯It was either not specified and/or could not be found for the javaType Type handler


或許是慣性思維,在mybatis使用foreach循環調用的時候,很多時候都是傳一個對象,傳一個List的情況很少,所以寫代碼有時候會不注意就用慣性思維方法做了。
今天向sql傳參,傳了一個List作為參數,然后在xml里再foreach循環調用。然后報錯信息如:

mybatis foreach報錯It was either not specified and/or could not be found for the javaType
Type handler was null on parameter mapping for property '__flowStepCode_0

Mapper接口

List<AllocationHandlerInfoVo> listAllocatedHandlerInfo(@Param("flowStepCodeList")List<ApprStepModel> flowStepCodeList);

原來是這樣:#{flowStep},處理方法,換成#{flowStep.flowStepCode},List是個集合來的,要注意,寫博客記錄

 <if test="flowStepCodeList != null and flowStepCodeList.size() > 0">
    		 fh.flow_step_code in
    		<foreach collection="flowStepCodeList" item="flowStep" index="index" open="(" close=")" separator=",">
    					#{flowStep.flowStepCode}
    		</foreach>		    	
</if>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM