package com.xhkjedu.sapi.controller.itemtool;

import com.xhkjedu.sapi.service.itemtool.StudentTodoService;
import com.xhkjedu.sapi.vo.itemtool.StudentTodoVo;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName StudentTodoController
 * Description TODO 学生端代办事项数量
 * Author WN
 * Date 2022/2/22 11:40
 **/
@RestController
@RequestMapping("/std")
public class StudentTodoController {

    @Resource
    private StudentTodoService studentTodoService;

    @PostMapping("/td_num")
    public ResultVo listTodoNum(@RequestBody List<StudentTodoVo> todos) {
        Integer studentid = N_Utils.isListEmpty(todos)?null:todos.get(0).getStudentid();
        N_Utils.validation(new Object[]{studentid,"学生id",1});
        try {
            List<StudentTodoVo> list = studentTodoService.listTodoNum(todos);
            return new ResultVo(0, "获取学生代办事项列表成功！",list);
        } catch (Exception e) {
            return new ResultVo(1, "获取学生代办事项列表失败");
        }
    }
}
