String content = content(map);
String m4="";//开始月
String m4_1="";//后一月
String sqlString = "select t.m4,t.m4_1 from contract_information t where t.id="+ map.get("id1");
List<Map<String, Object>> listinfo = findBySql(sqlString, null,Map.class);
if (listinfo != null && listinfo.size() > 0) {
for (int i = 0; i < listinfo.size(); i++) {
m4 = listinfo.get(i).get("m4").toString();
m4_1 = listinfo.get(i).get("m4").toString();
}
}
String sql = " SELECT top "
+ map.get("pageSize")
+ " * FROM ( SELECT ROW_NUMBER() OVER (ORDER BY c.id) AS RowNumber,c.* "
+ "from contract_serviceplan c where c.s3=0 " + content
+ " ) as a " + "WHERE S3=0 AND RowNumber > "
+ map.get("pageSize") + "*(" + map.get("pageNo") + "-1) ";
List<Map<String, Object>> list = findBySql(sql, null, Map.class);
if (list != null && list.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
for (int i = 0; i < list.size(); i++) {
Calendar st=Calendar.getInstance();
Calendar et=Calendar.getInstance();
try {
st.setTime(sdf.parse(m4));
et.setTime(sdf.parse(m4_1));
} catch (ParseException e) {
e.printStackTrace();
}
st.add(Calendar.MONTH,i); //将当前日期加一个月
et.add(Calendar.MONTH,i+1); //将当前日期加两个月
String stime=sdf.format(st.getTime()); //返回String型的时间
String etime=sdf.format(et.getTime()); //返回String型的时间
list.get(i).put("time", stime + " 至 " + etime);
}
}
return list;