/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.wechat.dao;


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

import org.springframework.stereotype.Repository;

import com.beust.jcommander.internal.Maps;
import com.wechat.global.base.dao.impl.BaseDao;
import com.wechat.model.dbEntity.Area;

/**
 * 单表生成DAO接口
 * 
 * @author tangwc
 * @version 2018-05-23
 */
@Repository
public class AreaDao extends BaseDao {
	

	/**
	 * 
	 * @param parentId 父Id
	 * @param type 类型
	 * @param lang 
	 * @return
	 */
	public List<Area> getAllArea(String parentId,String type, String lang){
		Map<String,Object> maps = Maps.newHashMap();
		maps.put("parentId", parentId);
		maps.put("type", type);
		maps.put("lang", lang);
		return super.select("AreaMapper.getAllArea",maps);
	}
	
	public List<Area> getAllAreaByParentIdList(List<String> parentId,String type, String lang){
		Map<String,Object> maps = Maps.newHashMap();
		maps.put("parentId", parentId);
		maps.put("type", type);
		maps.put("lang", lang);
		return super.select("AreaMapper.getAllAreaByParentIdList",maps);
	}
	
	public List<Area> getall(){
		Map<String,Object> maps = Maps.newHashMap();
		maps.put("lang", "cn");
		return super.select("AreaMapper.getall",maps);
	}
	public int updateAreaEnName(Area area){
		return super.update("AreaMapper.updateAreaEnName",area);
	}
	public int updateAreaEnNameByCode(Area area){
		return super.update("AreaMapper.updateAreaEnNameByCode",area);
	}
	
	
	/**
	 * @param codeList
	 * @param lang
	 * @return
	 */
	public List<String> getNamesByCodes(List<String> codeList, String lang){
		Map<String,Object> maps = Maps.newHashMap();
		maps.put("codeList", codeList);
		maps.put("lang", lang);
		return super.select("AreaMapper.getNamesByCodes",maps);
	}
	
}