package com.bjtdba.userCenter.dao;

import com.bjtdba.entity.userCenter.User;
import com.bjtdba.userCenter.entity.UserEntity;
import com.bjtdba.userCenter.vo.UserInviteVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

@Repository
@Mapper
public interface UserDao {

    int updatePhoneByphone(String phoneDel,int is_del,String phone);

    User selectUserByOpenid(String openid);

    List<UserInviteVo> selectUserByUidandNickname(Integer uid, String nickname);

    User selectUserByPhone(String phone);

    int updateUserWechatByPhone(String phone, String wechat_user_id,String ali_user_id);

    int insterUser(User user);

    int updateUserscore(int uid, BigDecimal score);

    User selectById(int uid);

    int updateUserspreadUid(int uid, int spreadUid, Date spreadTime);

    User queryUser(User user);

    void updateUserMerIdByPhone(int mer_id, Integer uid);

    void updateSpreadCount(int uid, int spread_count);

    List<UserEntity> getUserList(
            @Param("account") String account,
            @Param("nickname") String nickname,
            @Param("uid") Long uid,
            @Param("status") Integer status,
            @Param("offset") int offset,
            @Param("pageSize") int pageSize
    );

    long getUserListCount(
            @Param("account") String account,
            @Param("nickname") String nickname,
            @Param("uid") Long uid,
            @Param("status") Integer status
    );

    UserEntity getUserInfoByAccount(@Param("account") String account);

    UserEntity getUserInfoByUidForUpdate(@Param("uid") Integer uid);

    int updateUserScore(@Param("uid") Integer uid,
                        @Param("newScore") BigDecimal newScore);

    int updateUserContribute(@Param("uid") Integer uid,
                        @Param("newContribute") BigDecimal newContribute);

    int updateUserByUid(UserEntity userEntity);

    int insertUserByUserEntity(@Param("userEntity") UserEntity userEntity);
}
