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

// 查询用户列表
export function listUser(query) {
  return request({
    url: '/system/user/student/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getUser(userId) {
  return request({
    url: '/system/user/student/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 新增用户
export function addUser(data) {
  return request({
    url: '/system/user/student',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateUser(data) {
  return request({
    url: '/system/user/student',
    method: 'put',
    data: data
  })
}

// 删除用户
export function delUser(userId) {
  return request({
    url: '/system/user/student/' + userId,
    method: 'delete'
  })
}

// 用户密码重置
export function resetUserPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/system/user/student/resetPwd',
    method: 'put',
    data: data
  })
}

// 用户状态修改
export function changeUserStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/system/user/student/changeStatus',
    method: 'put',
    data: data
  })
}


// 查询授权角色
export function getAuthRole(userId) {
  return request({
    url: '/system/user/student/authRole/' + userId,
    method: 'get'
  })
}
// 查询专业列表
export function getListAll() {
  return request({
    url: '/system/major/listAll',
    method: 'get'
  })
}

// 保存授权角色
export function updateAuthRole(data) {
  return request({
    url: '/system/user/student/authRole',
    method: 'put',
    params: data
  })
}

// 启用停用学生账号
export function putUserTeacher(data) {
  return request({
    url: '/system/user/student',
    method: 'PUT',
    data: data
  })
}

//学生重置密码
export function putUserResetPwd(data) {
  return request({
    url: '/system/user/student/resetPwd',
    method: 'PUT',
    data: data
  })
}

//学生删除
export function delUserInfo(id) {
  return request({
    url: '/system/user/student/'+ id,
    method: 'delete',
  })
}

//班级模糊查询
export function getWorkList(query) {
  return request({
    url: '/system/class/listAll',
    method: 'get',
    params: query
  })
}

//专业模糊查询
export function getMajorList(query) {
  return request({
    url: '/system/major/listAll',
    method: 'get',
    params: query
  })
}

//导师模糊查询
export function getTeacherOption(data) {
  return request({
    url: '/system/user/teacher/option',
    method: 'post',
    data: data
  })
}


//学生类别/学籍状态查询字典接口
export function getVague(query) {
  return request({
    url: '/system/dict/data/getVague',
    method: 'get',
    params: query
  })
}

//新增班级接口
export function addSystemClass(data) {
  return request({
    url: '/system/class',
    method: 'post',
    data: data
  })
}

//新增学生接口
export function addUserStudent(data) {
  return request({
    url: '/system/user/student',
    method: 'post',
    data: data
  })
}

//编辑学生接口
export function putUserStudent(data) {
  return request({
    url: '/system/user/student',
    method: 'put',
    data: data
  })
}

//获取学生详情接口
export function getStudentInfo(userId) {
  return request({
    url: '/system/user/student/'+userId,
    method: 'get',
  })
}

//批量获取学生数据
export function studentBatchSelect(data) {
  return request({
    url: 'system/user/student/batchSelect/'+data,
    method: 'post',
  })
}

//批量修改学生卡号
export function studentUpdateCardNum(data) {
  return request({
    url: '/system/user/student/updateCardNum',
    method: 'put',
    data: data
  })
}


