An important method of generating mapper interface in reverse engineering

Source: Internet
Author: User

@Test

public void Testselectbyexample () {

Itemsexample itemsexample = new Itemsexample ();

Itemsexample.criteria Criteria = Itemsexample.createcriteria ();

Fuzzy query

Criteria.andnamelike ("% pen%");

Criteria.andnameequalto ("desktop");

list<items> list = Itemsmapper.selectbyexample (itemsexample);

SYSTEM.OUT.PRINTLN (list);

}

Press primary key to update all properties

@Test

public void Testupdatebyprimarykey () {

Items items = Itemsmapper.selectbyprimarykey (1);

Itemsmapper.updatebyprimarykey (items);

}

Press primary key, update not empty property

@Test

public void Testupdatebyprimarykeyselective () {

Items items = new items ();

Itemsmapper.updatebyprimarykeyselective (items);

}

Update all properties by condition; example: condition; recored: Update Object

@Test

public void Testupdatebyprimarykeya () {

Items record = null;

itemsexample example = null;

Itemsmapper.updatebyexampleselective (record, example);

}

Order by

@Test

public void Testfindall () {

itemsexample example = new Itemsexample ();

Example.setorderbyclause ("Createtime desc");

Itemsmapper.selectbyexample (example);

}

An important way to generate mapper interfaces for reverse engineering

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.