import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询学生列表
export function listStudent(query) {
  return request({
    url: '/sim/student/list',
    method: 'get',
    params: query
  })
}

// 查询学生详细
export function getStudent(userId) {
  return request({
    url: '/sim/student/' + parseStrEmpty(userId),
    method: 'get'
  })
}

// 新增学生
export function addStudent(data) {
  return request({
    url: '/sim/student',
    method: 'post',
    data: data
  })
}

// 修改学生
export function updateStudent(data) {
  return request({
    url: '/sim/student',
    method: 'put',
    data: data
  })
}

// 删除学生
export function delStudent(userId) {
  return request({
    url: '/sim/student/' + userId,
    method: 'delete'
  })
}

// 学生密码重置
export function resetStudentPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/sim/student/resetPwd',
    method: 'put',
    data: data
  })
}
