@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 接口的 重要方法的更多相关文章

  1. MyBatis逆向工程生成的Example类的方法总结

    很早之前就在项目开发中多次使用MyBatis逆向工程生成的Example类,但一直没有对其下的方法做一个简单的总结,现总结如下:一.mapper接口中的方法解析mapper接口中的部分常用方法及功能如 ...

  2. mybatis逆向工程生成mapper报错

    Result Maps collection already contains value for xxxMapper.BaseResultMap错误解决办法一.问题描述今天在做项目时,遇到一个错误: ...

  3. 【坑】Mybatis 多次逆向工程生成mapper文件

    在使用 mybatis 逆向工程的时候,多次逆向工程生成的文件,是不会产生覆盖的,而是追加: 假如,你第一次逆向,发生数据库的某个字段类型错了,修改以后再次逆向,那么得到的 mapper文件,将是 2 ...

  4. 逆向工程生成的Mapper.xml以及*Example.java详解

    逆向工程生成的接口中的方法详解 在我上一篇的博客中讲解了如何使用Mybayis逆向工程针对单表自动生成mapper.java.mapper.xml.实体类,今天我们先针对mapper.java接口中的 ...

  5. MyBatis 逆向工程——根据数据表自动生成model、xml映射文件、mapper接口

    MyBatis Generator(MBG)的使用 MBG可以根据数据表生成对应的model.xml映射文件.mapper接口,只是简单的生成,还需要根据需求修改. 1.下载jar包 https:// ...

  6. MyBatis逆向工程中的Mapper接口以及Example的实例函数及详解

    一.mapper接口中的方法解析 mapper接口中的函数及方法 方法 功能说明 int countByExample(UserExample example) thorws SQLException ...

  7. mybatis 映射生成mapper和pojo ---逆向工程的使用过程

    使用逆向工程生成mapper和pojo 2. 新建一个项目,随便叫什么 3.导入mybatis-generator-core .mybatis.mybatis-spring.log4j等jar 4.在 ...

  8. Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring

    Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring 非原创[只为记录],原博文地址:https://www.cnblogs.com/ ...

  9. (转)Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring

    Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring Mybatis在与Spring集成的时候可以配置MapperFactoryBea ...

随机推荐

  1. excel解决日常问题记录

    =MOD(ROW(),2)和=TEXT(B2487-B2486,"[h]:mm:ss"),我利用excel分析出了延迟的数据 比较2个字符串是否一样:=EXACT(A2,F2) 公 ...

  2. winform 异步更新ui

    http://download.csdn.net/download/mingge38/9378852

  3. 大文件的分片传,断点续传,md5校验

    一.概述 所谓断点续传,其实只是指下载,也就是要从文件已经下载的地方开始继续下载.在以前版本的HTTP协议是不支持断点的,HTTP/1.1开始就支持了.一般断点下载时才用到Range和Content- ...

  4. PISCES: A Programmable, Protocol-Independent Software Switch

    Name of article:PISCES: A Programmable, Protocol-Independent Software Switch Origin of the article:S ...

  5. SpringMVC学习笔记之---RESTful风格

    RESTful风格 (一)什么是RESTful (1)RESTful不是一套标准,只是一套开发方式,构架思想 (2)url更加简洁 (3)有利于不同系统之间的资源共享 (二)概述 RESTful具体来 ...

  6. ApiException

    ApiException 用于在catch中throw 异常,可以添加异常信息, throw new ApiException("线下绑卡异常!"); public class A ...

  7. 原生实现ajax解析--XMLHttpRequest

    ajax基础: Asynchronous JavaScript and XML,意思就是用JavaScript执行异步网络请求. 如果仔细观察一个Form的提交,你就会发现,一旦用户点击“Submit ...

  8. sqli-labs(31)

    0x01找闭合 这里是WAF的jsp调到php的同样 第二个参数构造 偷看源码 闭合是") 我们尝试一下构造爆破数据库名 login.php?id=&id=-") unio ...

  9. Python 使用Qt进行开发(二)

    上次简单实现了显示窗口,下面我们在窗口中加入一些部件. 1,我们在窗口中使用 setToolTip() 方法添加一个文本提示,在窗口中鼠标暂停几秒即可显示该文本信息. class test(): de ...

  10. WPF SAP水晶报表例子和打包Setup

    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x=" ...