package cn.reghao.tnb.auth.app.db.mapper;

import cn.reghao.jutil.jdk.web.db.BaseMapper;
import cn.reghao.tnb.auth.api.dto.AccountInfo;
import cn.reghao.tnb.auth.app.model.po.UserAccount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author reghao
 * @date 2021-11-16 09:35:39
 */
@Mapper
public interface UserAccountMapper extends BaseMapper<UserAccount> {
    void updateUserMobile(long userId, String mobile);
    void updateUserEmail(long userId, String email);
    void updateSetPassword(@Param("userId") long userId,
                           @Param("encodedPassword") String encodedPassword,
                           @Param("salt") String salt);
    @Deprecated
    void updateUserProfile(@Param("userId") long userId,
                           @Param("username") String username,
                           @Param("screenName") String screenName);
    void updateUserScreenName(@Param("userId") long userId, @Param("screenName") String screenName);
    void updateUserAvatar(@Param("userId") long userId, @Param("avatarUrl") String avatarUrl);

    Long findMaxUserId();
    UserAccount findByUsername(String username);
    UserAccount findByEmail(String email);
    UserAccount findByMobile(String mobile);
    Long findUserIdByUsername(String username);
    UserAccount findByUserId(long userId);
    AccountInfo findAccountInfo(long userId);
    List<AccountInfo> findAccountInfos(List<Long> list);
    AccountInfo findAccountInfoByMobile(String mobile);
    AccountInfo findAccountInfoByEmail(String email);
    AccountInfo findAccountInfoByUsername(String username);
}
