歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

第七章:文件系統管理

  //日期區間處理  >=yyyy-MM-dd    <yyyy-MM-dd +1

  

  private Date dateStart;

  private Date dateEnd;

 

  if (map.get("dateStart")!=null&&!"".equals(map.get("dateStart"))) {

    where.append(" and awardsDate >= ?");

    params.add(map.get("dateStart"));

  }

  if (map.get("dateEnd")!=null&&!"".equals(map.get("dateEnd"))) {

   //有問題   時間加1

   where.append(" and awardsDate < ?");

   Date dateEndd=(Date)map.get("dateEnd");

   Calendar calendar=Calendar.getInstance();

   calendar.clear();

   calendar.setTime(dateEndd);

   calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+1);//讓日期加1

   params.add(calendar.getTime());

  }

 

hql語句  在from  後不支持   子查詢

 1.不能加入除對象之外的屬性

 2.如果從多個數據中找到一個特殊的數據,可根據where  判斷進行篩選

 如:

  SELECT  COUNT(*)

    FROM C_RegistrationBroadcastSituation as rbsCount

    where rbsCount.filmManagementId=rbsAll.filmManagementId

    and rbsCount.buyer =rbsAll.buyer)as cou

    from C_RegistrationBroadcastSituation as rbsAll

    where rbsAll.broadCastDate=(

     SELECT min(rbs.broadCastDate)as broadCastDate

   FROM C_RegistrationBroadcastSituation as rbs

   where rbs.filmManagementId=rbsAll.filmManagementId

    and rbs.buyer =rbsAll.buyer

  )

 

//如何把查詢的值   放到  vo 對象中

StringBuffer hql = new StringBuffer("select new com.targ.cftvc.broadcastSituation.vo.BroadcastSituationStatisticsVO(rbsAll,playTime) ");

  

 

Copyright © Linux教程網 All Rights Reserved