接著上一篇更新: https://www.oschina.net/news/110055/mars-java-2-1-7-released
由於2.1.7版本存在一些不完美的地方(只是不夠完美,並非bug),所以緊急補推了這個版本
@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(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而自動過濾掉不想更新或者插入的欄位
[admin
]