📄 exportfiledao.java
字号:
package org.better.hr.dao;
import java.util.List;
import org.better.hr.comm.Util;
import org.better.hr.entity.ExportFile;
import org.better.hr.entity.ExportFileList;
import org.better.hr.entity.HumanFile;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class ExportFileDao extends HibernateDaoSupport {
/**
* 查询方法,根据查询条件和字段拼接查询语句
* @return
*/
public List find(HumanFile condition,ExportFileList list){
String sql = "select "; //查询语句
for(int i=0; i<list.size(); i++)
{
ExportFile file = (ExportFile)list.get(i);
sql += file.getColumnEN() + " , ";
}
if(sql.endsWith(", "))
sql = sql.substring(0,sql.length() - 2);
sql += "from HumanFile where 1 = 1";
if(!Util.isNullOrBlank(condition.getFirstKindName()))
sql += " and firstKindName = '" + condition.getFirstKindName() + "'";
if(!Util.isNullOrBlank(condition.getSecondKindName()))
sql += " and secondKindName = '"+ condition.getSecondKindName() + "'";
if(!Util.isNullOrBlank(condition.getThirdKindName()))
sql += " and thirdKindName = '"+ condition.getThirdKindName() + "'";
if(!Util.isNullOrBlank(condition.getStr_startTime()))
sql += " and RegistTime >= '"+ condition.getStr_startTime() + "'";
if(!Util.isNullOrBlank(condition.getStr_endTime()))
sql += " and RegistTime <= '"+ condition.getStr_endTime() + "'";
return this.getHibernateTemplate().find(sql);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -