package cn.net.caoyao.cpzshandset.service.bll;

import java.util.List;

import android.content.Context;
import cn.net.caoyao.cpzshandset.bean.TruckAddressBean;
import cn.net.caoyao.cpzshandset.common.config.ConfigDBCreateService;
import cn.net.caoyao.cpzshandset.common.util.CacheGet;
import cn.net.caoyao.cpzshandset.db.dal.ythImage.YthImageTruckAddressDal;
import cn.net.caoyao.cpzshandset.db.presenter.TruckAddressDal;

public class TruckAddressBll {
	private TruckAddressDal dal;
	public TruckAddressBll(Context context) {
		dal = new YthImageTruckAddressDal(context);
		ConfigDBCreateService service = new ConfigDBCreateService();
		dal = service.createTruckAddressDal(new CacheGet(), context);
	}

	/**
	 * 插入本地生成的详细地址信息
	 * @param consigeeBean
	 */
	public void insertNativeTruckAddress(TruckAddressBean addressBean){
		if (dal == null) {
			return;
		}
		dal.insertNativeTruckAddress(addressBean);
	}
	/**
	 * 插入服务器获取的详细地址信息
	 * @param consigeeBean
	 */
	public void insertOnlineTruckAddress(TruckAddressBean addressBean){
		if (dal == null) {
			return;
		}
		dal.insertOnlineTruckAddress(addressBean);
	}
	/**
	 * 插入详细地址信息列表
	 * @param consigeeBeans
	 */
	public void insertTruckAddressList(List<TruckAddressBean> addressBeans){
		if (dal == null || addressBeans == null) {
			return;
		}
		dal.insertTruckAddressList(addressBeans);
	}
	
	public <T> void insertT(List<T> list){
		
	}
	/**
	 * 删除所有的汽车详细地址信息
	 */
	public void deleteAllTruckTruckAddress(){
		if (dal == null) {
			return;
		}
		dal.deleteAllTruckTruckAddress();
	}
	/**
	 * 根据城市的Code码 查询所有的汽车详细地址信息
	 * @param cityCode
	 * @return
	 */
	public List<TruckAddressBean> queryTruckAddressByCityCode(int cityCode){
		if (dal == null) {
			return null;
		}
		return dal.queryTruckAddressByCityCode(cityCode);
	}
	
	/**
	 * 根据城市的Code码 查询所有的汽车详细地址信息
	 * @param cityCode
	 * @return
	 */
	public List<String> queryTruckAddressNameByCityCode(int cityCode){
		if (dal == null) {
			return null;
		}
		return dal.queryTruckAddressNameByCityCode(cityCode);
	}
	/**
	 * 查询所有的汽车详细地址信息
	 * @return
	 */
	public List<TruckAddressBean> queryAllTruckTruckAddress(){
		if (dal == null) {
			return null;
		}
		return dal.queryAllTruckTruckAddress();
	}
	/**
	 * 通过条件查询详细地址信息
	 * @param conditionStr
	 * @return
	 */
	public List<TruckAddressBean> searchTruckAddressByCondition(int cityCode,String conditionStr){
		if (dal == null) {
			return null;
		}
		return dal.searchTruckAddressByCondition(cityCode, conditionStr);
	}

	/**
	 * 通过条件查询详细地址信息
	 * @param conditionStr
	 * @return
	 */
	public List<String> searchTruckAddressNameByCondition(int cityCode,String conditionStr){
		if (dal == null) {
			return null;
		}
		return dal.searchTruckAddressNameByCondition(cityCode, conditionStr);
	}
}
