package com.jiayue.ssi.mapper;

import com.jiayue.ssi.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 *  用户管理Mapper
 *
 * @author xsl
 * @since 2023-03-10
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    /**
     * 通过角色ID查找用户
     *
     * @param roleId 角色ID
     * @return 结果
     */
    public List<SysUser> selectUserByRole(String roleId);
    /**
     * 更改密码
     *
     * @param password 新密码
     * @return 结果
     */
    @Update("update sys_user t set t.password=#{password},t.last_update_pwd_time=null where t.id=#{id}")
    public int resetPassword(Long id, String password);
}
