import request from '/@/utils/request';

/**
 * 分页查询活动记录列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/classactivity/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增活动记录
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/classactivity',
    method: 'post',
    data
  });
};

/**
 * 获取详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/classactivity/detail',
    method: 'get',
    params: { id }
  });
};

/**
 * 编辑活动记录
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/classactivity/edit',
    method: 'post',
    data
  });
};

/**
 * 删除活动记录
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/classactivity/delete',
    method: 'post',
    data: ids
  });
};

/**
 * 按学年学期统计各班级举办活动次数
 * @param schoolYear 学年
 * @param schoolTerm 学期
 */
export const statisticsByYearTerm = (schoolYear?: string, schoolTerm?: string) => {
  return request({
    url: '/stuwork/classactivity/statistics',
    method: 'get',
    params: { schoolYear, schoolTerm }
  });
};

