1.通过id查询某张表的数据
BizObject byID = QueryFactory.getInstance(“表名”).getByID(this._objId);
2.定位
this.pushLocation(Bundle.getString(“国际化标签”), “地址”);
例如:
this.pushLocation(Bundle.getString(“special_tracking.list”), “/terminal.SpecialTrackingAH.list”);
3.权限
@CandoCheck(“权限名称”)
4.json字符串变为BizObject
JsonTool.toBiz();
例如:
String json= terminalService.getListPage(sn,page);
BizObject biz = JsonTool.toBiz(json);
5.抛出异常
throw new ErrorException(“异常内容”);
6.检查BizObject是否返回成功,如果不成功,则抛出异常
this.checkBizObjectCode(biz);
7.添加返回数据(不知道为什么要添加两个)
this.setAttribute(OBJLIST, biz.get(Field.Common.DATAS));
this.setAttribute(“objlist”, list);
8.下一个地址
this._nextUrl = " ";
9.事务管理
//开始事务
ActionHandler.currentSession().beginTrans();
//事务回滚全部
ActionHandler.currentSession().rollbackAll();
//事务回滚
ActionHandler.currentSession().rollback();
//更新或者新加
ActionHandler.currentSession().addOrUpdate(BizObject);
//更新
ActionHandler.currentSession().update(BizObject);
//添加
ActionHandler.currentSession().add(BizObject);
//事务关闭
ActionHandler.currentSession().close();
//删除
ActionHandler.currentSession().delete(BizObject);
//插入
ActionHandler.currentSession().insert();
10.下一个页面提示
this._tipInfo ="";
例如:
this._tipInfo = SysUtil.getRespMsg(CodeNormal.CODE_8007.name());
11.日志的引用
import org.apache.log4j.Logger;
private Logger logger = Logger.getLogger(this.getClass());
12.判断数据是否为空
if (StringUtils.isNotBlank(数据)) { }
13.获取当前登录用户的根机构
String root_id=this._curuser.getString(“inst_root_id”);