|
|
|
@ -66,13 +66,15 @@ public class DemoDbController extends AbstractDBAccessProvider {
|
|
|
|
|
*/ |
|
|
|
|
public static DataBean delete( final String id ){ |
|
|
|
|
try{ |
|
|
|
|
DemoEntity entity = accessor.runQueryAction((context)-> |
|
|
|
|
context.getDAO(DemoDao.class).getById(id) |
|
|
|
|
); |
|
|
|
|
if( null == entity ){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return accessor.runDMLAction(new DBAction<DataBean>() { |
|
|
|
|
@Override |
|
|
|
|
public DataBean run(DAOContext context) throws Exception { |
|
|
|
|
DemoEntity entity = context.getDAO(DemoDao.class).getById(id); |
|
|
|
|
if( null == entity ){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
context.getDAO(DemoDao.class).remove( id ); |
|
|
|
|
List<LinkEntity> list = context.getDAO(LinkDao.class).removeByKey(entity.getKey()); |
|
|
|
|
return toDataBean(entity,list); |
|
|
|
|