Mars-java 发布 2.1.7-hotfix 版本

接着上一篇更新: 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而自动过滤掉不想更新或者插入的字段

猜你喜欢

转载自www.oschina.net/news/110102/mars-java-2-1-7-hotfix-released