首页 > 其他分享 >5

5

时间:2024-11-20 10:00:12浏览次数:1  
标签: springframework Result org import 打卡 annotation

package com.example.demo11.Controller;
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("下班打卡异常");
}

}

标签:,springframework,Result,org,import,打卡,annotation
From: https://www.cnblogs.com/luoqingci/p/18556204

相关文章