package com.fs.store.mapper;

import java.util.List;
import com.fs.store.domain.FsUserPromoterApply;
import com.fs.store.param.FsUsePromoterApplyParam;
import com.fs.store.vo.FsUserPromoterApplyVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 推广员申请Mapper接口
 * 
 * @author fs
 * @date 2023-02-28
 */
public interface FsUserPromoterApplyMapper 
{
    /**
     * 查询推广员申请
     * 
     * @param applyId 推广员申请ID
     * @return 推广员申请
     */
    public FsUserPromoterApply selectFsUserPromoterApplyById(Long applyId);

    /**
     * 查询推广员申请列表
     * 
     * @param fsUserPromoterApply 推广员申请
     * @return 推广员申请集合
     */
    public List<FsUserPromoterApply> selectFsUserPromoterApplyList(FsUserPromoterApply fsUserPromoterApply);

    /**
     * 新增推广员申请
     * 
     * @param fsUserPromoterApply 推广员申请
     * @return 结果
     */
    public int insertFsUserPromoterApply(FsUserPromoterApply fsUserPromoterApply);

    /**
     * 修改推广员申请
     * 
     * @param fsUserPromoterApply 推广员申请
     * @return 结果
     */
    public int updateFsUserPromoterApply(FsUserPromoterApply fsUserPromoterApply);

    /**
     * 删除推广员申请
     * 
     * @param applyId 推广员申请ID
     * @return 结果
     */
    public int deleteFsUserPromoterApplyById(Long applyId);

    /**
     * 批量删除推广员申请
     * 
     * @param applyIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteFsUserPromoterApplyByIds(Long[] applyIds);
    @Select("select * from fs_user_promoter_apply where user_id=#{userId}")
    FsUserPromoterApply selectFsUserPromoterApplyByUserId(long userId);
    @Select({"<script> " +
            "select a.*,u.nickname,u.phone from fs_user_promoter_apply a left join fs_user u on u.user_id=a.user_id  " +
            "where 1=1 " +
            "<if test = 'maps.nickname != null and  maps.nickname != \"\"    '> " +
            "and u.nickname =#{maps.nickname} " +
            "</if>" +
            "<if test = 'maps.phone != null and  maps.phone != \"\"    '> " +
            "and u.phone =#{maps.phone} " +
            "</if>" +
            "order by a.apply_id desc " +
            "</script>"})
    List<FsUserPromoterApplyVO> selectFsUserPromoterApplyListVO(@Param("maps")FsUsePromoterApplyParam fsUserPromoterApply);
}
