package com.bofeng.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.bofeng.entity.User;
import com.yvan.PageDb;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from tb_user where login_name=#{login_name}")
    User selectByLoginName(@Param("login_name") String loginName);

    String selectVersionById(Long userId);

    int updateLoginCount(@Param("user_id") Long userId);

    List<User> selectAll(PageDb pageDb);

    int updateInfo(Map p);

    int updatePassword(@Param("userId") Long userId,  @Param("password") String password, @Param("newPassword") String newPassword);

    int checkLoginName(User user);
}
