About the use of tk.mybatis.Example

Source: Internet
Author: User

See the method as follows:

Paging Query 1 @RequestMapping (value= "Bootgridpage", produces= "Application/json;charset=utf-8") @ResponseBody Public bootgridpageinfoset fenye (int current,int rowcount,string sort,string nane,string ph) {P 
            Agehelper.startpage (Current,rowcount)//paging Example Example = new Example (ccompareccicmodel.class);   String By=jsonutil.getsortby (sort);//Parse field example.setorderbyclause (by);
                 Sort that field example.criteria Criteria = Example.createcriteria ();
                 if (Stringutil.isnotempty (Nane)) {criteria.andlike ("xm", "%" + nane + "%");
                 } if (Stringutil.isnotempty (ph)) {criteria.andlike ("rybh", "%" + ph + "%");
        }//Criteria.andequalto ("XM", "Tri Ying");//condition equal//Criteria.andgreaterthan ("XB", "1");//Greater Than
   Criteria.andlessthan ("XB", "2");/less than//Criteria.andisnotnull ("XM");//is NOT NULL     Criteria.andcondition ("xzdqh=", "110104"), and/or all conditions can be = like, can replace all//list<string> values=new A
        Rraylist<string> ();
        Values.add ("110104");
        Values.add ("440304");
        Criteria.andin ("Xzdqh", values);//in ()//Criteria.andbetween ("Csrq", "1956/01/08", "1966/10/21")/Time apart
        Example.criteria criteria2 = Example.createcriteria ();
        Criteria2.andcondition ("xzdqh=", "220104"); Example.or (). Andcondition ("xzdqh=", "220104");//or//Example.or (CRITERIA2);//or List<ccomparecci  
            Cmodel> List=service.selectbyexample (example);
            New bootgridpageinfoset<ccompareccicmodel> (list);
        return new bootgridpageinfoset<ccompareccicmodel> (list); }

See the comments in the code for details. Suggest or own one experiment, look at the output of the SQL statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.