Directly on the code
Daoimpl:
/**
* Development Transfer page display, query search data, and pagination display
* @param ZRDP search criteria Encapsulate Object
* @return
*/
@SuppressWarnings ("Unchecked")
Public list<zrdpxx> Showallzrdpxxpageindex (zrdpxx zrdp,int pageindex,string keys) {
String sql = "SELECT * from zrdpxx where Dpxx_htaiztai = 2";
if (zrdp!=null) {
if (Zrdp.getdpxxid ()!=null&&!zrdp.getdpxxid (). Equals ("")) {
sql+= "and dpxx_id =" +zrdp.getdpxxid ();
}
if (Zrdp.getdpxxqyu ()!=null&&!zrdp.getdpxxqyu (). Equals ("-Select Region-")) {
sql+= "and Dpxx_qyu = '" +zrdp.getdpxxqyu () + "'";
}
if (Zrdp.getdpxxpyetai ()!=null&&!zrdp.getdpxxpyetai (). Equals ("")) {
sql+= "and Dpxx_pyetai = '" +zrdp.getdpxxpyetai () + "'";
}
if (Zrdp.getdpxxzyetai ()!=null&&!zrdp.getdpxxzyetai (). Equals ("0") &&!zrdp.getdpxxzyetai (). equals ("null")) {
sql+= "and Dpxx_zyetai = '" +zrdp.getdpxxzyetai () + "'";
}
if (Zrdp.getbigmji ()!=0&&ZRDP.GETSMLMJ ()!=-1) {
SQL + = "and Dpxx_mji between" +ZRDP.GETSMLMJ () + "and" +zrdp.getbigmji ();
}
Both start time and end time have values
if (Zrdp.getbegintime ()!=null&&!zrdp.getbegintime (). Equals ("") &&zrdp.getendtimes ()!=null& &!zrdp.getendtimes (). Equals ("null")) {
SQL + = "and Dpxx_fbusjian between '" +zrdp.getbegintime () + "' and '" +zrdp.getendtimes () + "'";
}
Only start time
if (Zrdp.getbegintime ()!=null&&!zrdp.getbegintime (). Equals ("") &&zrdp.getendtimes () ==null) {
SQL + = "and Dpxx_fbusjian between '" +zrdp.getbegintime () + "' And Now ()";
}
if (! (" Title Address Phone "). Equals (keys) {
SQL + = "and (Dpxx_bti like '%" +keys+ "% ' or tel-like '%" +keys+ "% ' or Dpxx_jtidzhi like '%" +keys+ "% ')";
}
SQL + = "ORDER by Dpxx_fbusjian Desc";
}
Return GetSession (). createsqlquery (SQL). Addentity (Zrdpxx.class). Setfirstresult ((pageindex-1) *20). Setmaxresults ( ). List ();
}
// public int getallzrdpcounts () {
// Object oo = getsession (). Createsqlquery ("SELECT count (dpxx_id) from Zrdpxx where Dpxx_htaiztai =2"). Uniqueresult ();
// Return Integer.parseint (Oo.tostring ());
// }
//
/**
* Development Transfer page display, query meet the conditions of development transfer store information
* @param ZRDP search criteria Encapsulate Object
* @return
*/
@SuppressWarnings ("Unchecked")
public int showallzrdpxx (zrdpxx zrdp,string keys) {
String sql = "SELECT count (dpxx_id) from zrdpxx where Dpxx_htaiztai = 2";
if (zrdp!=null) {
if (Zrdp.getdpxxid ()!=null&&!zrdp.getdpxxid (). Equals ("")) {
sql+= "and dpxx_id =" +zrdp.getdpxxid ();
}
if (Zrdp.getdpxxqyu ()!=null&&!zrdp.getdpxxqyu (). Equals ("-Select Region-")) {
sql+= "and Dpxx_qyu = '" +zrdp.getdpxxqyu () + "'";
}
if (Zrdp.getdpxxpyetai ()!=null&&!zrdp.getdpxxpyetai (). Equals ("")) {
sql+= "and Dpxx_pyetai = '" +zrdp.getdpxxpyetai () + "'";
}
if (Zrdp.getdpxxzyetai ()!=null&&!zrdp.getdpxxzyetai (). Equals ("0") &&!zrdp.getdpxxzyetai (). equals ("null")) {
sql+= "and Dpxx_zyetai = '" +zrdp.getdpxxzyetai () + "'";
}
if (Zrdp.getbigmji ()!=0&&ZRDP.GETSMLMJ ()!=-1) {
SQL + = "and Dpxx_mji between" +ZRDP.GETSMLMJ () + "and" +zrdp.getbigmji ();
}
Both start time and end time have values
if (Zrdp.getbegintime ()!=null&&!zrdp.getbegintime (). Equals ("") &&zrdp.getendtimes ()!=null& &!zrdp.getendtimes (). Equals ("null")) {
SQL + = "and Dpxx_fbusjian between '" +zrdp.getbegintime () + "' and '" +zrdp.getendtimes () + "'";
}
Only start time
if (Zrdp.getbegintime ()!=null&&!zrdp.getbegintime (). Equals ("") &&zrdp.getendtimes () ==null) {
SQL + = "and Dpxx_fbusjian between '" +zrdp.getbegintime () + "' And Now ()";
}
if (! (" Title Address Phone "). Equals (keys) {
SQL + = "and (Dpxx_bti like '%" +keys+ "% ' or tel-like '%" +keys+ "% ' or Dpxx_jtidzhi like '%" +keys+ "% ')";
}
}
Object oo = getsession (). createsqlquery (SQL). Uniqueresult ();
Return Integer.parseint (Oo.tostring ());
}
Action:
/**
* Development transfer Display, append object search
* @return Collection
*/
public String Getzrdpxxbyzr () {
if (pid==1) {
allcounts = Zrdao.showallzrdpxx (Zrdpxx,keys);
}
forkaifazrlist = Zrdao.showallzrdpxxpageindex (ZRDPXX, PID, keys);
kfmap.put ("Allkaifazr", allcounts);
kfmap.put ("Allkaifazrpageindex", forkaifazrlist);
if (forkaifazrlist!=null) {
Span style= "White-space:pre" > return "SHOWALLSUC";
}
return "fail";
}
Js:
function Showws () {
Zrshopids =$.trim ($ ("#txt_infoid"). Val ());
var isnums = IsNaN (zrshopids);
var yanzhengs =/^\s*$/;
var isspaces =yanzhengs.test (Zrshopids);
if (isnums) {
Zrshopids=-1;
}
if (isspaces) {
Zrshopids = "";
}
if ($ ("#txt_infoid"). Val (). IndexOf (".")! =-1) {
Alert ("Pro, please enter the correct store id! ");
}
else{
$ ("#showtable Tr:not (: First)"). Remove ();
$ ("#bottompage"). HTML ("");
$.post ("Zraction!getalldpxx.action", {"pid":p ageindex, "Zrdpxx.dpxxpyetai": $ ("#ddl_yetaicate"). Val (). Substring ( 3,7), "Zrdpxx.dpxxhtaiztai": $ ("#ddl_after"). Val (), "Zrdpxx.dpxxzyetai": $ ("#ddl_yetai"). Val (), " Zrdpxx.dpxxqtaiztai ": $ (" #ddl_before "). Val ()," Zrdpxx.dpxxhtaiztai ": $ (" #ddl_after "). Val ()," Zrdpxx.dpxxsfouzdin ": $ ("#istopno"). Val (), "tel": $.trim ($ ("#txt_key"). Val ()), "Dpidsss": Zrshopids, "Showwhotel": $ ("#showwhotel"). Val ()} ,
function (data) {
if (data["Zrdxpxxpageindexcount"].length<=0) {
Alert ("There is no data matching the current condition!") ");
}
else{
$.each (data["Zrdxpxxpageindexcount"],function (i,list) {
$tr =$ ("<tr></tr>");
$TD =$ ("<td align= ' center ' valign= ' top ' style= ' border-right:0; ' ><input type= ' checkbox ' name = ' row_checkbox ' id = ' checkdo ' value= ' "+list.dpxxid+" '/></td> ');
$TD 1=$ ("<td align= ' center ' valign= ' top ' ><a href= ' transfermanager24.1.jsp?dpidsss=" +list.dpxxid+ "' target= ' _blank ' > ' +list.dpxxid+ ' </a></td> ');
$TD 2 =$ ("<td align= ' center ' valign= ' top ' >" +list.dpxxfbusjian.substring (0,10) + "</td>");
Switch (List.dpxxxxilyuan) {
Case 1:
$TD 3 =$ ("<td align= ' center ' valign= ' top ' > Customer </td>"); , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp &NBSP;
Break
Case 4:
$TD 3 =$ ("<td align= ' center ' valign= ' top ' > Extranet </td>");
Break
Case 2:
$TD 3 =$ ("<td align= ' center ' valign= ' top ' > Newspaper </td>");
Break
Case 3:
$TD 3 =$ ("<td align= ' center ' valign= ' top ' > Sweep street </td>");
Break
Case 5:
$TD 3 =$ ("<td align= ' center ' valign= ' top ' > Other </td>");
Break
}
$TD 4 =$ ("<td align= ' center ' valign= ' top ' >" +list.dpxxzyetai+ "</td>");
$TD 5 =$ ("<td align= ' center ' valign= ' top ' >" +list.dpxxqyu+ "</td>");
$TD 7 =$ ("<td align= ' center ' valign= ' top ' >" +list.dpxxbti+ "</td>");
$TD 8 =$ ("<td align= ' center ' valign= ' top ' >" +list.dpxxjtidzhi+ "</td>");
$TD 13=$ ("<td align= ' center ' valign= ' top ' >" +list.mytel+ "</td>");
if (list.dpxxsfouzdin==1) {
$TD 9 =$ ("<td align= ' center ' valign= ' top ' > is </td>");
}
if (list.dpxxsfouzdin==2) {
$TD 9 =$ ("<td align= ' center ' valign= ' top ' > No </td>");
}
if (list.dpxxqtaiztai==1) {
$TD =$ ("<td align= ' center ' valign= ' top ' > Show </td>");
}
if (list.dpxxqtaiztai==2) {
$TD =$ ("<td align= ' center ' valign= ' top ' > Not show </td>");
}
Switch (List.dpxxhtaiztai) {
Case 1:
$TD =$ ("<td align= ' center ' valign= ' top ' > Shielding </td>");
Break
Case 2:
$TD =$ ("<td align= ' center ' valign= ' top ' style= ' color:green ' > Development </td>");
Break
Case 3:
$TD =$ ("<td align= ' center ' valign= ' top ' style= ' color:blue ' > Focus </td>");
Break
Case 4:
$TD =$ ("<td align= ' center ' valign= ' top ' style = ' color:red ' > Aftermarket </td>");
Break
Case 5:
$TD =$ ("<td align= ' center ' valign= ' top ' style= ' color: #A757A8 ' > Case </td>");
Break
}
$tr. Append ($td 1). Append ($td 2). Append ($td 3). Append ($td 4). Append ($td 5). Append ($td 7) Append ($td 8). Append ($td 9). Append ($TD). Append ($TD). Append ($td 12);
$ ("#showtable"). Append ($TR);
});
pagesize = data["Zrdxpxxallcount"]%maxresult==0?parseint (data["Zrdxpxxallcount"]/maxresult):p Arseint (data[" Zrdxpxxallcount "]/maxresult) +1;
var $uppage = $ ("<a href= ' Javascript:go (True) ' ><< previous    </a>") ;
var $span =$ ("<span style= ' font-size:12px ' > Total" +data["Zrdxpxxallcount"]+ "Strip  " +pageindex+ "page &NBSP;&NBSP Total "+pagesize+" page </span> ");
var $downpage =$ ("<a href= ' Javascript:go (false) ' >     next >>  ;   </a> ");
var $select = $ ("<select onchange= ' Javascript:gotos () ' id= ' Gotosid ' ></select>");
for (var i = 1;i<=pagesize;i++) {
$select. Append ("<option value=" +i+ ">" +i+ "page </option>");
}
$ ("#bottompage"). Append ($uppage). Append ($span). Append ($downpage). Append ($select);
$ ("#gotosid"). Find ("option[value=" "+pageindex+" "]"). attr ("Selected", "Selected");
}
});
}
}