CityDaoImpl.java 1.67 KB
package com.diligrp.website.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.diligrp.website.dao.CityDao;
import com.diligrp.website.domain.City;
import com.diligrp.website.util.dao.impl.BaseDaoImpl;

@Component("CityDao")
public class CityDaoImpl extends BaseDaoImpl<City> implements CityDao {

	private static final String STATEMENT = CityDaoImpl.class.getCanonicalName();

	@Override
	public List<City> getCityListByParentId(Integer pid) {
		return getSqlSessionTemplate().selectList(STATEMENT + ".getCityListByParentId", pid);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.diligrp.website.dao.CityDao#getParentCityListById(java.lang.Integer)
	 */
	@Override
	public List<City> getParentCityListById(Integer pid) {
		List<City> list = getSqlSessionTemplate().selectList(STATEMENT + ".getParentCityListByRegionId", pid);
		return list;
	}

	@Override
	public List<City> getCityByText(String cityName, int cityLevel) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("cityName", cityName);
		param.put("cityLevel", cityLevel);
		return getSqlSessionTemplate().selectList(STATEMENT + ".getCityByText", param);
	}

	@Override
	public List<City> getCityListByCityIds(List cityIds) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("cityIds", cityIds);
		List<City> list = getSqlSessionTemplate().selectList(STATEMENT + ".getCityListByCityIds", param);
		return list;
	}

	@Override
	public List<City> getCityListByCountryId(Long countryId) {
		List<City> list = getSqlSessionTemplate().selectList(STATEMENT + ".getCityListByCountryId", countryId);
		return list;
	}
}