dojo省份地市级联之省份Dao实现类
ProvinceDaoImpl.java:
/** * */ package com.you.dao.impl; import java.util.ArrayList; import java.util.List; import com.you.dao.ProvinceDao; import com.you.model.Province; /** * @author YHD * */ public class ProvinceDaoImpl implements ProvinceDao { /** * @author YHD */ @Override public List<Province> findProvince() { List<Province> proList = new ArrayList<Province>(); String sql = "select t.province_id,t.province_desc from t_dic_province_tab order by t.province_id "; sqlQuery query = getSession.createsqlQuery(sql); List<Object[]> items = query.list(); if(null != items && items.size() > 0) { Province pro; for(Object[] obj:items) { pro = new Province(); if(null != obj[0]) { pro.setId(obj[0].toString()); } if(null != obj[1]) { pro.setName(obj[1].toString()); } proList.add(pro); } } return proList; } }
注意:导入jar包