<code>
boolean isAlready=false;
Date addStart = LeaveDateStart();
Date addEnd = LeaveDateEnd();
for (CheckEmployeeLeaveLog ent :list
) {
Date lastStart=ent.getLeaveDateStart();
Date lastEnd=ent.getLeaveDateEnd();
if (((lastStart.before(addEnd) ||lastStart.equals(addEnd))
&&(lastStart.after(addStart)) ||lastStart.equals(addStart))
||
((lastEnd.before(addEnd) ||lastStart.equals(addEnd))
&&(lastEnd.after(addStart)) ||lastStart.equals(addEnd))) {
isAlready=true;
break;
}
}
//判斷當前時間段是否已經請過假
if(isAlready){
String msg ="該時間段已經請過假";
return error(msg);
}
</code>