如何在mybatis 中傳多個參數 List getIdByRand(@Param(“question”) Question question,@Param(“sectionIdList”) List sectionIdList);
@param(“”) 映射參數到 xml 的 傳入參數
xml: parameterType=”map” 參數類型要寫成map
如何在mybatis 中遍歷 集合?
現在要遍歷 List sectionIdList=new ArrayList<>(); 這個東西
sectionId=#{}
collection=”” //要遍歷的 參數 ,為 傳進來的參數 item 在此情景中傳進來的是string 的集合 item相當于 for循環中的控制變量 separator 分離來每個循環語句的 這里是OR
open,close 用來開始和關閉這個集合的。
examp:
sectionId=#{sectionId}
循環展開: ( sectionId=” or sectionId=” or sectionId=”’
)
新聞熱點
疑難解答