/**
* 描述:findBySQL4IN
* @param sql 格式如:select id,name from table where id in (:keyName)
* @param paramsList
* @return
* @throws Exception
* @CreateOn 2017-4-1 上午10:11:34
* @author chun_chang
*/
public List findBySQL4IN(String sql, String keyName, String ids) throws Exception {
try {
SQLQuery query = null;
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
query = session.createSQLQuery(sql);
query.setParameterList(keyName, ids.split(","));
return query.list();
} catch (RuntimeException re) {
throw re;
}
}