String sql="select c.NOTICE_NO,c.NOTICE_TITLE,c.NOTICE_CREATERTIME,c.NOTICE_CREATOR ,b.SYS_DEPT_ID,a.NOTICE_DEPT_STATE_ID,c.NOTICE_CREATORDEPT, d.SYS_USER_NAME,e.NOTICE_DEPT_STATE_NAME, f.SYS_DEPT_NAME ,g.SYS_DEPT_NAME from NOTICE_DEPT_STATETIME as a inner join notice_dept as b on b.NOTICE_DEPT_ID=a.NOTICE_DEPT_ID inner join NOTICE_INFO as c on c.NOTICE_ID=b.NOTICE_ID inner join SYS_USER_INFO as d on d.SYS_USER_ID=c.NOTICE_CREATOR inner join Notice_dept_state_map as e on e.NOTICE_DEPT_STATE_ID=a.NOTICE_DEPT_STATE_ID inner join sys_dept_info f on f.SYS_DEPT_ID=c.NOTICE_CREATORDEPT inner join sys_dept_info g on g.SYS_DEPT_ID=b.SYS_DEPT_ID where a.NOTICE_DEPT_STATE_ID in (1,5)";
SimpleDateFormat ss=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf=new SimpleDateFormat("EEE MMM dd HH:mm:ss 'UTC+0800' yyyy",Locale.ENGLISH);
try {
if(beginTime!=null&&beginTime.length()>0){
begin=sdf.parse(beginTime);
beginTime=ss.format(begin);
beginTime+=" 00:00:00";
sql+="and c.NOTICE_CREATERTIME>='"+beginTime+"'";
}
if(endTime!=null&&endTime.length()>0){
end=sdf.parse(endTime);
endTime=ss.format(end);
endTime+=" 23:59:59";
sql+=" and c.NOTICE_CREATERTIME <='"+endTime+"'";
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}