📄 doctypeservice.java
字号:
package com.hdlb.service;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import com.hdlb.dao.IDocType;
import com.hdlb.factory.DAOFactory;
import com.hdlb.hibernate.TDoctype;
public class DocTypeService implements IDocTypeService {
public List getDocType() {
IDocType doctype = DAOFactory.getDocTypeDAO();
List list = doctype.createQuery("from TDoctype doctype")
.list();
return list;
}
public String getDocTypeById(int id) {//bang ni gai jin xia dai ma.xing ma?
System.out.println("in DocTypeService getDocTypeById method");
IDocType doctypeDAO = DAOFactory.getDocTypeDAO();
String queryString = "select doctype from TDoctype doctype where doctype.fid=?";
try {
Query q = doctypeDAO.createQuery(queryString);
q.setInteger(0,id);
TDoctype dt = new TDoctype();
dt = (TDoctype)q.list().get(0);
return dt.getFtypename();
} catch (Exception e) {
/*
* if(){
* }else{
* }
* */
e.printStackTrace();
}
return null;
// Query q = doctypeDAO.createQuery("select doctype from TDoctype doctype where doctype.fid=?");
// q.setInteger(0,id);
// List names = q.list();//这里错了
// Iterator iterator = names.iterator();
// String type = "";
// while(iterator.hasNext()) {
// TDoctype doctype = (TDoctype) iterator.next();
// type = doctype.getFtypename();
// System.out.println(doctype.getFid() + "\t" + doctype.getFtypename());
// }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -