package com.jwipc.sys.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.sys.entity.PurchaseGroup;
import com.jwipc.sys.entity.UserPurchaseGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwipc.sys.model.po.UserPurchaseGroupPO;
import com.jwipc.sys.model.query.UserPurchaseGroupUpdateQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 采购组分配人员关联表 Mapper 接口
 * </p>
 *
 * @author zhangjie
 * @since 2024-01-29
 */
public interface UserPurchaseGroupMapper extends BaseMapper<UserPurchaseGroup> {

    /**
     * 根据用户id获取优先展示的采购组编码
     *
     * @param userId 用户id
     * @return 采购组编码
     */
    String getMarkPurchaseGroupCodeByUserId(@Param("userId") Long userId);

    Set<String> getUserPurchaseGroupCode(@Param("userId")Long userId);

    List<UserPurchaseGroupPO> findPageByQuery(@Param("query") UserPurchaseGroupUpdateQuery query);

    List<UserPurchaseGroupPO> findPageByQuery(Page<PurchaseGroup> dbPage,@Param("query") UserPurchaseGroupUpdateQuery query);
}
