package com.sunxung.factoring.mapper.weekWorkPlan;

import java.util.Date;
import java.util.List;

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

import com.sunxung.factoring.entity.weekWorkPlan.WeekWorkPlan;
import com.sunxung.factoring.entity.weekWorkPlan.vo.SearchWeekWorkPlan;
import com.sunxung.factoring.mapper.BaseMapper;

@Mapper
public interface WeekWorkPlanMapper extends BaseMapper<WeekWorkPlan> {

    /**
     * 根据上周计划ID查询下周继续的周计划. <br/>
     * 
     * @param lastWeekWorkId
     * @return
     */
    WeekWorkPlan getByLastWeekWorkId(Long lastWeekWorkId);

    /**
     * 验证同一天内是否存在标题相同的工作计划. <br/>
     *
     * @return
     */
    WeekWorkPlan getByTitleWorkTime(@Param("title") String title, @Param("workTime") Date workTime,
            @Param("userId") Long userId);

    /**
     * 获取周例会中上周工作计划. <br/>
     * 
     * @param search
     * @return
     */
    List<WeekWorkPlan> findLastWeekWorkPlans(SearchWeekWorkPlan search);

    /**
     * 统计周例会中上周工作计划条数. <br/>
     * 
     * @param search
     * @return
     */
    Integer countLastWeekWorkPlans(SearchWeekWorkPlan search);

    /**
     * 根据时间查询所有状态为进行中的计划. <br/>
     * 
     * @param workTime
     * @param workStateId
     * @return
     */
    List<WeekWorkPlan> findWorkingWorkPlanAll(@Param("workTime") Date workTime, @Param("workStateId") Long workStateId);
}
