📄 hibernatepagedao.java
字号:
package cn.myapps.core.page.dao;
import java.util.Collection;
import cn.myapps.base.action.ParamsTable;
import cn.myapps.base.dao.DataPackage;
import cn.myapps.core.dynaform.form.dao.HibernateFormDAO;
import cn.myapps.core.page.ejb.Page;
public class HibernatePageDAO extends HibernateFormDAO implements PageDAO {
public HibernatePageDAO(String voClassName) {
super(voClassName);
}
public Page findDefaultPage(String application) throws Exception {
String hql = "from " + _voClazzName + " vo where vo.defHomePage='1'";
if (application != null && application.length() > 0) {
hql += (" and applicationid = '" + application + "' ");
}
return (Page) getData(hql);
}
public Page findByName(String name, String application) throws Exception {
String hql = "FROM " + _voClazzName + " vo WHERE name='" + name + "'";
if (application != null && application.length() > 0) {
hql += (" and applicationid = '" + application + "' ");
}
return (Page) getData(hql);
}
public DataPackage getDatasExcludeMod(ParamsTable params, String application)
throws Exception {
String hql = "FROM " + _voClazzName + " vo WHERE vo.module is null";
String _currpage = params.getParameterAsString("_currpage");
String _pagelines = params.getParameterAsString("_pagelines");
int page = (_currpage != null && _currpage.length() > 0) ? Integer
.parseInt(_currpage) : 1;
int lines = (_pagelines != null && _pagelines.length() > 0) ? Integer
.parseInt(_pagelines) : Integer.MAX_VALUE;
if (application != null && application.length() > 0) {
hql += (" and applicationid = '" + application + "' ");
}
return getDatapackage(hql, params, page, lines);
}
public Collection getPagesByModule(String moduleid, String application)
throws Exception {
String hql = "FROM " + _voClazzName + " vo WHERE vo.module.id='"
+ moduleid + "' AND vo.type = 0";
ParamsTable params = new ParamsTable();
params.setParameter("application", application);
return getDatas(hql, params);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -