Leaving
This commit is contained in:
parent
205b7e2602
commit
2277f5c8e4
@ -1,6 +1,12 @@
|
|||||||
package com.codesdream.ase.repository.leaves;
|
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;
|
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);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,31 @@
|
|||||||
package com.codesdream.ase.service;
|
package com.codesdream.ase.service;
|
||||||
|
|
||||||
|
import com.codesdream.ase.model.leaves.Leave;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface ILeavesService {
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,40 +13,36 @@ public class LeavesService implements ILeavesService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LeaveRepository leaveRepository;
|
private LeaveRepository leaveRepository;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Leave> findLeaveByTitle(String title) {
|
public Optional<Leave> findLeaveByTitle(String title) {
|
||||||
return LeaveRepository.findByTitle(title);
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<leave> findLeaveByCreator(String creatorName) {
|
public Optional<Leave> findLeaveByCreator(String creatorName) {
|
||||||
return LeaveRepository.findByCreator(creatorName);
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Leave save(Leave Leave) {
|
public Leave save(Leave leave) {
|
||||||
return LeaveRepository.save(Leave);
|
return leaveRepository.save(leave);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Leave leave) {
|
||||||
|
leaveRepository.delete(leave);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Leave addReport(Leave Leave, Report report) {
|
public Leave update(Leave leave) {
|
||||||
Leave.setReport(report);
|
return leaveRepository.save(leave);
|
||||||
return update(Leave);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Leave Leave) {
|
public Leave createLeave(Leave leave) {
|
||||||
LeaveRepository.delete(Leave);
|
return leaveRepository.save(leave);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Leave update(Leave Leave) {
|
|
||||||
return LeaveRepository.save(Leave);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Leave createLeave(Leave Leave) {
|
|
||||||
return LeaveRepository.save(Leave);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
/*@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user