首页 > 移动平台 > 详细

逆向工程 生成mapper 接口的 重要方法

时间:2016-04-22 16:07:00      阅读:446      评论:0      收藏:0      [点我收藏+]

@Test

public void testSelectByExample() {

ItemsExample itemsExample = new ItemsExample();

ItemsExample.Criteria criteria = itemsExample.createCriteria();

//模糊查询

criteria.andNameLike("%笔%");

//criteria.andNameEqualTo("台式机");

List<Items> list = itemsMapper.selectByExample(itemsExample);

System.out.println(list);

}

 

//按 主键, 更新所有属性

@Test

public void testUpdateByPrimaryKey() {

Items items = itemsMapper.selectByPrimaryKey(1);

itemsMapper.updateByPrimaryKey(items);

}        

 

//按 主键, 更新 不为空 属性

@Test

public void testUpdateByPrimaryKeySelective() {

Items items = new Items();

itemsMapper.updateByPrimaryKeySelective(items);

}

 

//按 条件, 更新所有属性;example:条件;recored:更新对象

@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);                

}

逆向工程 生成mapper 接口的 重要方法

原文:http://www.cnblogs.com/do-better/p/5421463.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!