How to Use DetachedCriteria and Criteria, detachedcriteria
How to Use DetachedCriteria and Criteria
/*
* Download statistics
* @ Return
*/
Public String downloadStatistics (){
Logger.info ("directory content statistics being downloaded ");
String type = getServletRequest (). getParameter ("type ");
DetachedCriteria dc = DetachedCriteria. forClass (TbXymlb. class)
. Add (Restrictions. and (Restrictions. isNotNull ("sfsjtc"), Restrictions. isNotNull ("mlnrb ")))
. AddOrder (Order. asc ("diyu"). addOrder (Order. asc ("cydw "));
Logger.info ("execution query parameter: {}", type );
If (DOWNLOAD_TYPE_ZY.equals (type )){
Dc. add (Restrictions. eq ("diyu", "99 "));
} Else if (DOWNLOAD_TYPE_DF.equals (type )){
Dc. add (Restrictions. ne ("diyu", "99 "));
}
// Execute the query
List <TbXymlb> xymls = xymlService. query (dc );
Try {
DownloadName = "mlnr_tj.xls ";
DownloadFile = buildXLSStream (xymls );
} Catch (Exception error ){
Logger. error ("Download error", error );
}
Return SUCCESS;
}
Then add your own understanding