package org.xyzh.workcase.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.xyzh.api.workcase.dto.TbWorkcaseDTO;
import org.xyzh.common.core.page.PageParam;

/**
 * @description    工单数据访问层
 * @filename    TbWorkcaseMapper.java
 * @author    yslg
 * @copyright xyzh
 * @since 2025-12-18
 */
@Mapper
public interface TbWorkcaseMapper {

    /**
     * 插入工单
     */
    int insertWorkcase(TbWorkcaseDTO workcase);

    /**
     * 更新工单（只更新非null字段）
     */
    int updateWorkcase(TbWorkcaseDTO workcase);

    /**
     * 逻辑删除工单
     */
    int deleteWorkcase(TbWorkcaseDTO workcase);

    /**
     * 根据ID查询工单
     */
    TbWorkcaseDTO selectWorkcaseById(@Param("workcaseId") String workcaseId);

    /**
     * 查询工单列表
     */
    List<TbWorkcaseDTO> selectWorkcaseList(@Param("filter") TbWorkcaseDTO filter);

    /**
     * 分页查询工单
     */
    List<TbWorkcaseDTO> selectWorkcasePage(@Param("filter") TbWorkcaseDTO filter, @Param("pageParam") PageParam pageParam);

    /**
     * 统计工单数量
     */
    long countWorkcases(@Param("filter") TbWorkcaseDTO filter);

}
