package com.keao.edu.user.controller;


import com.keao.edu.common.controller.BaseController;
import com.keao.edu.common.entity.HttpResponseResult;
import com.keao.edu.common.page.PageInfo;
import com.keao.edu.common.page.QueryInfo;
import com.keao.edu.user.api.entity.StudentAttendance;
import com.keao.edu.user.service.StudentAttendanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("studentAttendance")
@Api(tags = "学员考勤服务")
public class StudentAttendanceController extends BaseController {

	@Autowired
	private StudentAttendanceService studentAttendanceService;
	
	@ApiOperation("分页查询")
	@GetMapping(value = "/list")
	public HttpResponseResult<PageInfo<StudentAttendance>> getList(QueryInfo queryInfo) {
		return succeed(studentAttendanceService.queryPage(queryInfo));
	}

	@ApiOperation("更新学员考勤")
	@PostMapping(value = "/api/upsetStudentAttendance")
	public HttpResponseResult upsetAttendance(Long examRegistrationId,Integer signFlag) {
		studentAttendanceService.upsetAttendance(examRegistrationId,signFlag);
		return succeed();
	}
}
