1. 程式人生 > >mybatis in集合查詢

mybatis in集合查詢

java 程式碼

ic class SpecialReportDao extends BaseDao{
	/**
	 * 得到使用者的所有的渠道專題
	 * privs:許可權
	 * */
	public List<ReportIndex> getSpecialReport(String privs){
		Map map = new HashMap();
		map.put("privs", privs);
		return this.queryForList("SPECIAL_REPORT.getSpecialReport", map);
	}

mybatis 查詢
<select id="getSpecialReport" parameterType="map" resultMap="reportIndexMap">
 		select * from TB_JN_CDE_INDEX where report_type  = 3 and index_id in (  ${privs} )
 	</select>

執行後的sql
 select * from TB_JN_CDE_INDEX where report_type = 3
 and index_id in ( 601,60101,6010101,6010102 )