package cn.com.countrygarden.bi.main.dao.mediaResource;

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

import javax.transaction.Transactional;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import cn.com.countrygarden.bi.main.core.Mapper;
import cn.com.countrygarden.bi.main.dto.CustomerDto;
import cn.com.countrygarden.bi.main.model.mediaResource.Customer;

@Repository
@Transactional
public interface CustomerMapper extends Mapper<Customer>{

	long selectCustomerCount(CustomerDto dto);

	List<Map<String, Object>> selectCustomer(CustomerDto dto);

	@Select("select ifnull(max(sort),0) from t_media_customer")
	Integer getNextSort();

	int dels(@Param("customerIds")String[] customerIds);

	Map<String,String> findOne(Customer po);

	int updateOne(Customer po);

	int verifyCustomerName(@Param("customerName")String customerName, @Param("customerId")String customerId);

	@Select("select count(customer_id) from t_media_customer where customer_no = #{str}")
	int verifyCustomerNo(String str);

	@Select("select right(ifnull(max(customer_no),0)+1,4) from t_media_customer where customer_no like concat(#{year},'%')")
	String findNextOn(String year);

}
