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.TeacherAttendance;
import com.keao.edu.user.service.TeacherAttendanceService;
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("teacherAttendance")
@Api(tags = "教室考勤服务")
public class TeacherAttendanceController extends BaseController {

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

	@ApiOperation("更新教师考勤")
	@PostMapping(value = "/api/upsetTeacherAttendance")
	public HttpResponseResult upsetAttendance(Long roomId,Integer userId,Integer signFlag) {
		teacherAttendanceService.upsetAttendance(roomId,userId,signFlag);
		return succeed();
	}
}
