提交 f3802cb6 编写于 作者: xignzi's avatar xignzi

get方法支持try模式

release:8.1.0.556.1
上级 8c1278ab
...@@ -168,10 +168,21 @@ public interface IBaseService<T extends BaseData, F extends BaseFilter> { ...@@ -168,10 +168,21 @@ public interface IBaseService<T extends BaseData, F extends BaseFilter> {
} }
default <K extends Serializable> T get(K key) throws Throwable { default <K extends Serializable> T get(K key) throws Throwable {
T dto = (T)forwardAction("Get",key); return get(key,false);
if(dto!=null) }
afterAction("Get",dto);
default <K extends Serializable> T get(K key, boolean btry) throws Throwable {
try {
T dto = (T) forwardAction("Get", key);
if (dto != null)
afterAction("Get", dto);
return dto; return dto;
} catch (Throwable e) {
if (btry) {
return null;
}
throw e;
}
} }
default <K extends Serializable> T onGet(K key) throws Throwable { default <K extends Serializable> T onGet(K key) throws Throwable {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册