package com.example.demo11.Controller;标签:,springframework,Result,org,import,打卡,annotation From: https://www.cnblogs.com/luoqingci/p/18556204
import com.example.demo11.Service.AttendanceService;
import com.example.demo11.entity.Attendance;
import com.example.demo11.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
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;
//质量检测
@RestController
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@PostMapping("/startTime")
public Result<String> startTime(@RequestBody Attendance attendance) {
Boolean flag = attendanceService.insertAttendance(attendance);
if (flag) {
return Result.success("上班打卡成功");
}
return Result.error("上班打卡异常");
}
@PostMapping("/endTime")
public Result<String> endTime(@RequestBody String userId) {
Boolean flag = attendanceService.updateAttendance(userId);
if (flag) {
return Result.success("下班打卡成功");
}
return Result.error("下班打卡异常");
}
}