package com.ktg.iscs.mapper;

import com.ktg.common.mapper.BaseMapperX;
import com.ktg.common.query.LambdaQueryWrapperX;
import com.ktg.iscs.domain.IsJobTicketUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 作业票用户Mapper接口
 *
 * @author cgj
 * @date 2024-10-18
 */
@Mapper
public interface IsJobTicketUserMapper extends BaseMapperX<IsJobTicketUser>
{
    /**
     * 查询作业票用户
     *
     * @param recordId 作业票用户主键
     * @return 作业票用户
     */
    IsJobTicketUser selectIsJobTicketUserByRecordId(Long recordId);

    /**
     * 查询作业票用户列表
     *
     * @param isJobTicketUser 作业票用户
     * @return 作业票用户集合
     */
    List<IsJobTicketUser> selectIsJobTicketUserList(IsJobTicketUser isJobTicketUser);

    /**
     * 新增作业票用户
     *
     * @param isJobTicketUser 作业票用户
     * @return 结果
     */
    int insertIsJobTicketUser(IsJobTicketUser isJobTicketUser);

    /**
     * 修改作业票用户
     *
     * @param isJobTicketUser 作业票用户
     * @return 结果
     */
    int updateIsJobTicketUser(IsJobTicketUser isJobTicketUser);

    /**
     * 删除作业票用户
     *
     * @param recordId 作业票用户主键
     * @return 结果
     */
    int deleteIsJobTicketUserByRecordId(Long recordId);

    /**
     * 批量删除作业票用户
     *
     * @param recordIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteIsJobTicketUserByRecordIds(Long[] recordIds);

    default List<IsJobTicketUser> selectIsJobTicketUserListByTicketId(Long ticketId) {
        return selectList(new LambdaQueryWrapperX<IsJobTicketUser>().eq(IsJobTicketUser::getTicketId, ticketId));
    }

    List<IsJobTicketUser> getMyJob(@Param(value = "userId") Long userId);
}
