import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentVO, StudentForm, StudentQuery } from '@/api/ygpassport/student/types';

/**
 * 查询学生详情列表
 * @param query
 * @returns {*}
 */

export const listStudent = (query?: StudentQuery): AxiosPromise<StudentVO[]> => {
  return request({
    url: '/ygpassport/student/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询学生详情详细
 * @param id
 */
export const getStudent = (id: string | number): AxiosPromise<StudentVO> => {
  return request({
    url: '/ygpassport/student/' + id,
    method: 'get'
  });
};

/**
 * 查询学生详情详细
 * @param stuNo
 */
export const getStudentByStuNo = (data: JSON): AxiosPromise<StudentVO> => {
  return request({
    url: '/ygpassport/student/getInfoByStuNo',
    method: 'post',
    data: data
  });
};

/**
 * 新增学生详情
 * @param data
 */
export const addStudent = (data: StudentForm) => {
  return request({
    url: '/ygpassport/student',
    method: 'post',
    data: data
  });
};

/**
 * 修改学生详情
 * @param data
 */
export const updateStudent = (data: StudentForm) => {
  return request({
    url: '/ygpassport/student',
    method: 'put',
    data: data
  });
};

/**
 * 删除学生详情
 * @param id
 */
export const delStudent = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/student/' + id,
    method: 'delete'
  });
};
