package com.nokia.tsl_data.dao;

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

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface TargetTsRatioDao {

    /**
     * 按月查询管理端目标万投率
     * 
     * @param monthId
     * @return
     */
    @Select("select city_name, management_target_ts_ratio from report_auto.target_ts_ratio where month_id = #{monthId}")
    List<Map<String, Object>> selectMangementTargetTsRatioForMonth(String monthId);

    /**
     * 按月查询客户端目标万投率
     * 
     * @param monthId
     * @return
     */
    @Select("select city_name, customer_target_ts_ratio from report_auto.target_ts_ratio where month_id = #{monthId}")
    List<Map<String, Object>> selectCustomerTargetTsRatioForMonth(String monthId);

    @Select("select city_name, management_target_ts_ratio, customer_target_ts_ratio from report_auto.target_ts_ratio")
    List<Map<String, Object>> findAll();

    @Update("update report_auto.target_ts_ratio set management_target_ts_ratio = #{value} where month_id = #{monthId} and city_name = #{city}")
    void updateMangementTargetTsRatio(@Param("monthId") String monthId,@Param("city") String city,@Param("value") double value);
}
