generator 生成的example类 示例
1. 搜索数据库Id不为空打元组
java代码
@RequestMapping("/test") public String execute() { /* 先创建一个example */ GoodsExample goodsExample = new GoodsExample(); /* 然后创建criteria对象 */ GoodsExample.Criteria criteria = goodsExample.createCriteria(); criteria.andCategoryIdIsNotNull(); List<Goods> goodses = goodsMapper.selectByExample(goodsExample); System.out.println(goodses); return "dd"; }
上述代码相当于一下sql语句
select * from shop_user where id is not null;