diff --git a/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java b/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java index 180baf2..5ea51c1 100644 --- a/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java +++ b/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java @@ -1,6 +1,12 @@ package com.codesdream.ase.repository.leaves; +import com.codesdream.ase.model.activity.Report; +import com.codesdream.ase.model.leaves.Leave; import org.springframework.data.repository.CrudRepository; -public interface LeaveRepository extends CrudRepository{ +import java.util.Optional; +public interface LeaveRepository extends CrudRepository{ + + Optional findByTitle(String title) ; + Optional findByCreator(String creatorName); } diff --git a/src/main/java/com/codesdream/ase/service/ILeavesService.java b/src/main/java/com/codesdream/ase/service/ILeavesService.java index 4f8b0af..0d7b994 100644 --- a/src/main/java/com/codesdream/ase/service/ILeavesService.java +++ b/src/main/java/com/codesdream/ase/service/ILeavesService.java @@ -1,4 +1,31 @@ package com.codesdream.ase.service; +import com.codesdream.ase.model.leaves.Leave; + + +import java.util.Optional; + public interface ILeavesService { + //通过标题查找活动 + Optional findLeaveByTitle(String title); + + //通过创建人姓名查找活动 + Optional findLeaveByCreator(String creatorName); + + //活动 + Leave save(Leave leave); + + + //请假删除 + void delete(Leave Leave); + + //请假信息更新 + Leave update(Leave Leave); + + //创建请假条目 + Leave createLeave(Leave Leave); + + //查询主要负责的活动 + //Leave findActivitiesInTheCharge(User user); + } diff --git a/src/main/java/com/codesdream/ase/service/LeavesService.java b/src/main/java/com/codesdream/ase/service/LeavesService.java index 7a36cce..a9c475d 100644 --- a/src/main/java/com/codesdream/ase/service/LeavesService.java +++ b/src/main/java/com/codesdream/ase/service/LeavesService.java @@ -13,40 +13,36 @@ public class LeavesService implements ILeavesService { @Resource private LeaveRepository leaveRepository; + @Override public Optional findLeaveByTitle(String title) { - return LeaveRepository.findByTitle(title); + return Optional.empty(); } @Override - public Optional findLeaveByCreator(String creatorName) { - return LeaveRepository.findByCreator(creatorName); + public Optional findLeaveByCreator(String creatorName) { + return Optional.empty(); } @Override - public Leave save(Leave Leave) { - return LeaveRepository.save(Leave); + public Leave save(Leave leave) { + return leaveRepository.save(leave); + } + + + @Override + public void delete(Leave leave) { + leaveRepository.delete(leave); } @Override - public Leave addReport(Leave Leave, Report report) { - Leave.setReport(report); - return update(Leave); + public Leave update(Leave leave) { + return leaveRepository.save(leave); } @Override - public void delete(Leave Leave) { - LeaveRepository.delete(Leave); - } - - @Override - public Leave update(Leave Leave) { - return LeaveRepository.save(Leave); - } - - @Override - public Leave createLeave(Leave Leave) { - return LeaveRepository.save(Leave); + public Leave createLeave(Leave leave) { + return leaveRepository.save(leave); } /*@Override