package com.fs.project.mapper;

import com.fs.project.domain.ProjectTaskType;
import com.fs.project.vo.ProjectOptionVO;
import com.fs.project.vo.QueryAllDataVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 项目任务类型Mapper接口
 *
 * @author fs
 * @date 2025-12-30
 */
public interface ProjectTaskTypeMapper {
    /**
     * 查询项目任务类型
     *
     * @param id 项目任务类型主键
     * @return 项目任务类型
     */
    public ProjectTaskType selectProjectTaskTypeById(Long id);

    /**
     * 查询项目任务类型列表
     *
     * @param projectTaskType 项目任务类型
     * @return 项目任务类型集合
     */
    public List<ProjectTaskType> selectProjectTaskTypeList(ProjectTaskType projectTaskType);

    /**
     * 新增项目任务类型
     *
     * @param projectTaskType 项目任务类型
     * @return 结果
     */
    public int insertProjectTaskType(ProjectTaskType projectTaskType);

    /**
     * 修改项目任务类型
     *
     * @param projectTaskType 项目任务类型
     * @return 结果
     */
    public int updateProjectTaskType(ProjectTaskType projectTaskType);

    /**
     * 删除项目任务类型
     *
     * @param id 项目任务类型主键
     * @return 结果
     */
    public int deleteProjectTaskTypeById(Long id);

    /**
     * 批量删除项目任务类型
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteProjectTaskTypeByIds(Long[] ids);

    List<ProjectOptionVO> selectProjectOptionsByDept(@Param("deptId") Long deptId, @Param("projectName") String projectName);

    @Delete("delete from project_task_type where project_id = #{projectId}")
    void deleteByProjectId(Long projectId);

    @Select("select * from project_task_type where project_id = #{projectId} and del_flag = 0")
    List<ProjectTaskType> selectByProjectId(Long id);

    @Delete({
            "<script>",
            "delete from project_task_type where project_id in",
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"
    })
    void deleteByProjectIds(@Param("ids")Long[] ids);

    List<ProjectTaskType> queryAllData(QueryAllDataVO projectTaskType);
}
