Mars-java 发布 2.1.7-hotfix 版本

栏目: 软件资讯 · 发布时间: 5年前

内容简介:接着上一篇更新: https://www.oschina.net/news/110055/mars-java-2-1-7-released 由于2.1.7版本存在一些不完美的地方(只是不够完美,并非bug),所以紧急补推了这个版本 更新点如下: 原来 MarsGet注解 查询数...

接着上一篇更新: https://www.oschina.net/news/110055/mars-java-2-1-7-released

由于2.1.7版本存在一些不完美的地方(只是不够完美,并非bug),所以紧急补推了这个版本

更新点如下:

原来 MarsGet注解 查询数据的时候只能返回Map

@MarsGet(tableName = "userinfo",primaryKey = "id")
public abstract Map<String,Object> selectById(int id);

现在改成了,不仅可以返回Map还可以返回自己的实体类

@MarsGet(tableName = "userinfo",primaryKey = "id")
public abstract 要返回的实体类 selectById(int id);

原来 MarsSelect注解 查询数据的时候只能返回泛型为Map的List

@MarsSelect(sql = "select * from userinfo where name = #{name} and age = ${age}")
public abstract List<Map<String,Object>> selectList(DemoEntity demoEntity);

现在改成了,不仅可以返回Map还可以返回自己的实体类

@MarsSelect(sql = "select * from userinfo where name = #{name} and age = ${age}", resultType = 要返回的实体类.class)
public abstract List<要返回的实体类> selectList(DemoEntity demoEntity);

 

另外,推荐实体类里不要用int,double等基本类型,统一通Integer,Double等包装器类型,这样在MarsUpdate的时候可以通过赋值为null而自动过滤掉不想更新或者插入的字段


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The  C Programming Language

The C Programming Language

Brian W. Kernighan、Dennis M. Ritchie / Prentice Hall / 1988-4-1 / USD 67.00

Presents a complete guide to ANSI standard C language programming. Written by the developers of C, this new version helps readers keep up with the finalized ANSI standard for C while showing how to ta......一起来看看 《The C Programming Language》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码