package com.ruoyi.mall.mapper;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ruoyi.mall.domain.MallMemberCoupon;
import com.ruoyi.mall.domain.MallMemberUser;
import com.ruoyi.mall.domain.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 会员Mapper接口
 *
 * @author ruoyi
 * @date 2021-11-25
 */
public interface MallMemberUserMapper
{
    /**
     * 插入登录记录
     * @param mallMemberLoginLog
     * @return
     */
    public int insertLoginLog(MallMemberLoginLog mallMemberLoginLog);

    /**
     * 查询会员
     *
     * @param id 会员主键
     * @return 会员
     */
    public MallMemberUser selectMallMemberUserById(Long id);

    /**
     * 查询指定推送信息接收人员
     * @return
     */
    public List<MallMemberUser> selectBossMemberUser();

    public MallMemberUser queryByOpenid(String openid);
    public MallMemberUser queryByPhone(@Param("phone") String phone);

    /**
     * 查询会员列表
     *
     * @param mallMemberUser 会员
     * @return 会员集合
     */
    public List<MallMemberUser> selectMallMemberUserList(MallMemberUser mallMemberUser);

    /**
     * 新增会员
     *
     * @param mallMemberUser 会员
     * @return 结果
     */
    public int insertMallMemberUser(MallMemberUser mallMemberUser);

    /**
     * 修改会员
     *
     * @param mallMemberUser 会员
     * @return 结果
     */
    public int updateMallMemberUser(MallMemberUser mallMemberUser);

    /**
     * 删除会员
     *
     * @param id 会员主键
     * @return 结果
     */
    public int deleteMallMemberUserById(Long id);

    /**
     * 批量删除会员
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteMallMemberUserByIds(Long[] ids);

    public MemberUserVO selectMemberVOUserById(Long l);

    /*
    * 查询收藏
    * */
    public int selectCollectCount(Map<String, Object> params);

    /*
    * 收藏
    * */
    public void insertMemberGoods(MemberCollectVO memberGoods);

    /*
     * 取消收藏
     * */
    public void deleteMemberGoodsByParam(Map<String, Object> params);

    /*
     * 批量取消收藏
     * */
    public int deleteCollectByGoodsIds(@Param("ids") List<Integer> ids,@Param("userId")Integer userId);

    /*
    * 收藏列表
    * */
    public List<IndexGoodsVO> queryCollectByUserUserId(Long userId);

    /*
     * 足迹列表
     * */
    public List<IndexGoodsVO> queryFoodMarkByUserUserId(Long userId);

    /*
     * 查询足迹
     * */
    public MemberFootMarkVO selectFootMarkVOUserById(MemberFootMarkVO footMarkVO);

    /*
     * 更新足迹
     * */
    public void updateFootMarkVO(MemberFootMarkVO footMarkVO);

    /*
     * 插入足迹
     * */
    public void insetIntoFootMarkVO(MemberFootMarkVO footMarkVO);

    public MemberCollectVO selectIsCollectBy(MemberCollectVO collectVO);

    public Map<String,Object> checkUserCoupon(@Param("userId") Long userId, @Param("couponId") String couponId);

    public void insertUserCoupon(MallMemberCoupon memberCoupon);

    public List<MallMemberCoupon> getMyCoupons(Long userId);

    public List<MallMemberCoupon> getEnableCoupons(Map<String,Object> param);

    //查看优惠券是否可用
    public Map<String,Object> checkCouponUsed(@Param("couponId") String couponId, @Param("userId") Long userId);

    public MallMemberCoupon checkCouponUsedNew(@Param("couponId") Long couponId, @Param("userId") Long userId);



    //又该优惠券状态为使用
    public void updateCouponUsed(@Param("couponId") String couponId, @Param("userId") Long userId);

    public int selectCollectCountByUserId(Long userId);

    public int selectCouponCountByUserId(Long userId);

    public int selectFootCountByUserId(Long userId);

    /**
     * 查询会员未下单天数（订单须付款）
     *
     * @param userId 会员主键
     * @return 会员
     */
    public int queryNoOrderDaysByUserId(Long userId);

    /**
     * 业务员查询名下客户
     *
     * @param params salesmanId 业务员ID
     * @return 会员集合
     */
    public List<Map<String, Object>> getSalesmanUserList(Map<String, Object> params);

    /**
     * 用户积分列表
     *
     * @param params userId 用户ID
     * @return 积分集合
     */
    public List<Map<String, Object>> getUserIntegralList(Map<String, Object> params);

    /**
     * 用户总积分
     *
     * @param params userId 用户ID
     * @return 用户总积分
     */
    public BigDecimal getUserAllIntegral(Map<String, Object> params);
}
