📄 hibernateactivitydao.java
字号:
package cn.myapps.core.dynaform.activity.dao;
import cn.myapps.base.action.ParamsTable;
import cn.myapps.base.dao.DataPackage;
import cn.myapps.base.dao.HibernateBaseDAO;
import cn.myapps.core.dynaform.activity.ejb.Activity;
public class HibernateActivityDAO extends HibernateBaseDAO implements
ActivityDAO {
public HibernateActivityDAO(String voClassName) {
super(voClassName);
}
public DataPackage findByViewid(String id, String application)
throws Exception {
String hql = "from " + _voClazzName + " act where act.parentView.id='"
+ id + "'";
ParamsTable params=new ParamsTable();
params.setParameter("application",application);
params.setParameter("_orderby", "orderno");
return super.getDatapackage(hql, params);
}
public DataPackage findByFormid(String id, String application)
throws Exception {
String hql = "from " + _voClazzName + " act where act.parentForm.id='"
+ id + "'";
ParamsTable params=new ParamsTable();
params.setParameter("application",application);
params.setParameter("_orderby", "orderno");
return super.getDatapackage(hql, params);
}
public Activity getPreviousActivity(String id, int oderno, String flag) throws Exception {
String hql = "FROM " + _voClazzName + " vo where vo.parentView.id='"
+ id + "'" + " and vo.orderno in (select max(act.orderno) "
+ "from " + _voClazzName + " act where act.parentView.id='"
+ id + "'" + " and act.orderno <" + oderno + ")";
if (flag.equals(Activity.Activity_BelongTo_Form))
hql = "FROM " + _voClazzName + " vo where vo.parentForm.id='" + id
+ "'" + " and vo.orderno in (select max(act.orderno) "
+ "from " + _voClazzName + " act where act.parentForm.id='"
+ id + "'" + " and act.orderno <" + oderno + ")";
return (Activity) getData(hql);
}
public Activity getNextActivity(String id, int oderno, String flag) throws Exception {
String hql = "FROM " + _voClazzName + " vo where vo.parentView.id='"
+ id + "'" + " and vo.orderno in (select min(act.orderno) "
+ "from " + _voClazzName + " act where act.parentView.id='"
+ id + "'" + " and act.orderno >" + oderno + ")";
if (flag.equals(Activity.Activity_BelongTo_Form))
hql = "FROM " + _voClazzName + " vo where vo.parentForm.id='" + id
+ "'" + " and vo.orderno in (select min(act.orderno) "
+ "from " + _voClazzName + " act where act.parentForm.id='"
+ id + "'" + " and act.orderno >" + oderno + ")";
return (Activity) getData(hql);
}
public Activity getActivityByMaxOderNO(String viewid, String formid) throws Exception {
String hql = "FROM " + _voClazzName + " vo where vo.parentView.id='"
+ viewid + "'" + " and vo.orderno in (select max(act.orderno)"
+ " from " + _voClazzName + " act where act.parentView.id='"
+ viewid + "') ";
if (formid != null && formid.trim().length() > 0)
hql = "FROM " + _voClazzName + " vo where vo.parentForm.id='"
+ formid + "'"
+ " and vo.orderno in (select max(act.orderno)" + " from "
+ _voClazzName + " act where act.parentForm.id='" + formid
+ "') ";
return (Activity) getData(hql);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -