import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentListVO, StudentListForm, StudentListQuery } from '@/api/ygpassport/studentList/types';

/**
 * 查询学生信息列表
 * @param query
 * @returns {*}
 */

export const listStudentList = (query?: StudentListQuery): AxiosPromise<StudentListVO[]> => {
  return request({
    url: '/student/studentList/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询学生信息详细
 * @param id
 */
export const getStudentList = (id: string | number): AxiosPromise<StudentListVO> => {
  return request({
    url: '/student/studentList/' + id,
    method: 'get'
  });
};

/**
 * 新增学生信息
 * @param data
 */
export const addStudentList = (data: StudentListForm) => {
  return request({
    url: '/student/studentList',
    method: 'post',
    data: data
  });
};

/**
 * 修改学生信息
 * @param data
 */
export const updateStudentList = (data: StudentListForm) => {
  return request({
    url: '/student/studentList',
    method: 'put',
    data: data
  });
};

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