package cn.wisenergy.mapper;

import cn.wisenergy.model.app.WorkProject;
import cn.wisenergy.model.dto.ManagerProjectsDto;
import cn.wisenergy.model.vo.ModifyProjectVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenqi
 * @since 2021-01-19
 */
public interface WorkProjectMapper extends BaseMapper<WorkProject> {

    /**
     * 条件查询项目集合
     * @param map
     * @return
     */
    List<WorkProject> getProjectsByCriteria(Map<String, Object> map);



    /**
     *  获取项目
     * @param ids 项目id
     * @param isConclusion 是否结项
     * @return 项目实体类
     */
    List<WorkProject> getProjectsByIds(@Param("ids") List<Integer> ids, @Param("isConclusion") Integer isConclusion);

    /**
     * 获取可以管理的项目/商机
     * @param userId 拥挤id
     * @param type 类型
     * @param isConclusion 是否结项
     * @param deptIds 所属部门
     * @return
     */
    List<ManagerProjectsDto> getManagerProjectsDto(@Param("userId") Integer userId, @Param("type") Integer type, @Param("isConclusion") Integer isConclusion,@Param("deptIds") List<Integer> deptIds);

    int updateIsConclusionById(Integer id);

    int updateProject(ModifyProjectVo modifyProjectVo);

    List<WorkProject> getListByCriteria(Map<String,Object> map);

    List<Integer> getProjectIdByManager(Integer userId);

    List<WorkProject> getListByCentreIdAndIsConclusion(@Param("centreId") Integer centreId,@Param("isConclusion") Integer isConclusion);
}
