Oracle 批量查詢 傳入List 返回List

直接上代碼

  • Dao層
List<DataMastDO> selectBrachNo(@Param("mastDos")List<DataMastDO> mastDos);
  • Mapper接口
<select id="selectBrachNo" resultType="com.bootdo.system.domain.DataMastDO">
		select * from ORW_DATA_MAST
		where
		 <foreach collection="mastDos" index="index" item="val" separator="or" open="(" close=")">
			 (orw_modelid = #{val.orwModelid} and orw_seqno=#{val.orwSeqno})
		 </foreach>

	</select>

注意:Dao中的 @Param(“mastDos”) 不寫會拋異常,找不到 mastDos這個屬性 其他註釋明天研究下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章