排除本身
<select id="getdata" parameterClass="map" resultClass="hmap">
SELECT
TO_CHAR(XRGFN_START,'yyyy-mm-dd') XRGFN_START, TO_CHAR(XRGFN_EXPIRE,'yyyy-mm-dd') XRGFN_EXPIRE
FROM XRGFN_MSTR where 1=1
and UPPER(XRGFN_PART)=UPPER(#XRGFN_PART#)
and (
<![CDATA[ (TO_CHAR(nvl(XRGFN_START, sysdate), 'yyyy-mm-dd') <= UPPER(#XRGFN_START#)
and TO_CHAR(nvl(XRGFN_EXPIRE, sysdate), 'yyyy-mm-dd') >= UPPER(#XRGFN_START#))
or (TO_CHAR(nvl(XRGFN_START, sysdate), 'yyyy-mm-dd') <= UPPER(#XRGFN_EXPIRE#)
and TO_CHAR(nvl(XRGFN_EXPIRE, sysdate), 'yyyy-mm-dd') >= UPPER(#XRGFN_EXPIRE#))
or (TO_CHAR(nvl(XRGFN_START, sysdate), 'yyyy-mm-dd') >= UPPER(#XRGFN_START#)
and TO_CHAR(nvl(XRGFN_EXPIRE, sysdate), 'yyyy-mm-dd') <= UPPER(#XRGFN_EXPIRE#))
]]>
)
<isNotEmpty property="XRGFN_SEQ">
<![CDATA[ and XRGFN_SEQ <> #XRGFN_SEQ# ]]>
</isNotEmpty>
and upper(XRGFN_DOMAIN)=<include refid="common.getUserDomain"/>
</select>
public String comparisonRQ(String str1, String str2, String str3,
String str4) throws Exception {
String mesg = "";
// SimpleDateFormat rq = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try {
Date dt1 = df.parse(str1);
Date dt2 = df.parse(str2);
Date dt3 = df.parse(str3);
Date dt4 = df.parse(str4);
if(dt1.getTime()==dt3.getTime()&&dt2.getTime()==dt4.getTime()){
mesg="";
}
else{
if(dt4.getTime()>dt1.getTime()&&dt2.getTime()>dt4.getTime()){
mesg = "交集";//重合
}
if ( dt3.getTime()>dt1.getTime() && dt2.getTime()>dt3.getTime()) {
mesg = "交集";//重合
}
if (dt3.getTime()<dt1.getTime() && dt4.getTime() >dt2.getTime() ) {
mesg = "交集";//重合
}
}
}catch (ParseException e) {
e.printStackTrace();
throw new ParseException(e.getMessage(), 0);
}catch(Exception e){
e.printStackTrace();
throw new Exception(e);
}
return mesg;
}