This commit is contained in:
Vindicator645 2020-03-15 15:17:47 +08:00
parent 205b7e2602
commit 2277f5c8e4
3 changed files with 50 additions and 21 deletions

View File

@ -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<Leave, Integer>{
Optional<Leave> findByTitle(String title) ;
Optional<Leave> findByCreator(String creatorName);
}

View File

@ -1,4 +1,31 @@
package com.codesdream.ase.service;
import com.codesdream.ase.model.leaves.Leave;
import java.util.Optional;
public interface ILeavesService {
//通过标题查找活动
Optional<Leave> findLeaveByTitle(String title);
//通过创建人姓名查找活动
Optional<Leave> findLeaveByCreator(String creatorName);
//活动
Leave save(Leave leave);
//请假删除
void delete(Leave Leave);
//请假信息更新
Leave update(Leave Leave);
//创建请假条目
Leave createLeave(Leave Leave);
//查询主要负责的活动
//Leave findActivitiesInTheCharge(User user);
}

View File

@ -13,40 +13,36 @@ public class LeavesService implements ILeavesService {
@Resource
private LeaveRepository leaveRepository;
@Override
public Optional<Leave> findLeaveByTitle(String title) {
return LeaveRepository.findByTitle(title);
return Optional.empty();
}
@Override
public Optional<leave> findLeaveByCreator(String creatorName) {
return LeaveRepository.findByCreator(creatorName);
public Optional<Leave> 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