SERVICE层:
String period = (String)queryCondition.get("period");
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DATE);
Date periodFormat = DateUtil.formDate(Integer.parseInt(period.substring(0, 4)), Integer.parseInt(period.substring(4, 6)) , day); // 传入当前的年月日
queryCondition.put("date", periodFormat);
DAO层:
String hql = "from CpmOrg a where a.orgG = :orgg and a.porg = :porg and a.frdate<= :date and (a.todate>= :date or a.todate is null) and a.fscard = 'Y' order by a.preorg";
本文介绍了一个关于SERVICE层处理日期格式并传递给DAO层进行数据库查询的例子。具体包括了如何从字符串中解析日期,并将该日期用于构造查询条件。
334

被折叠的 条评论
为什么被折叠?



