标签:控制 nes new guid size ide stat user blog
pid:指导记录主键
user_pid:用户主键
competition_project_pid:用户作品
/**
* 指导记录
* @date 2020/3/24 9:26
*/
@Repository
public interface CompetitionProjectGuideRepository extends JpaRepository<CompetitionProjectGuide, String> {
Optional<CompetitionProjectGuide> findFirstByCompetitionProjectPidOrderByUpdateAtDesc(Long pid);
}
public Optional<CompetitionProjectGuide> findFirstByCompetitionProjectPidOrderByUpdateAtDesc(Long pid) {
return repository.findFirstByCompetitionProjectPidOrderByUpdateAtDesc(pid);
}
@RequestMapping(method = {RequestMethod.GET}, value = "/task/project/guide")
public ResponseEntity getGuide(Long pid) {
Optional<CompetitionProjectGuide> guide = competitionProjectGuideService.findFirstByCompetitionProjectPidOrderByUpdateAtDesc(pid);
guide.orElseThrow(() -> new BusinessException(
HttpStatus.BAD_REQUEST, Translator.toLocale("guide.NotExists.message")));
return ResponseEntity.ok(guide);
}
可以通过findFirst或者findTop来获取
标签:控制 nes new guid size ide stat user blog
原文地址:https://www.cnblogs.com/mzdljgz/p/12567514.html