?? jddaoimpl.java
字號:
package org.ch02zf.dao.daoImpl;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.jsp.jstl.sql.Result;
import org.ch02zf.dao.JDDao;
import org.ch02zf.entity.JD;
import org.ch02zf.entity.QX;
public class JDDaoImpl implements JDDao {
public Result getJD() {
// TODO Auto-generated method stub
CommonDao cd = new CommonDao();
cd.setConn(BasicDao.getCon());
String sqlvalue = "select * from tbl_jd order by qxid ";
cd.setSqlvalue(sqlvalue);
Result result = null;
try {
result = cd.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
public List getJDNums() {
// TODO Auto-generated method stub
CommonDao cd = new CommonDao();
cd.setConn(BasicDao.getCon());
String sqlvalue = "select count(*) as num from tbl_jd group by qxid order by qxid ";
cd.setSqlvalue(sqlvalue);
Result result = null ;
List list = new ArrayList();
try {
result = cd.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for(Map item:result.getRows())
{
list.add((Integer)item.get("num"));
}
return list;
}
public JD getJDbyId(int jdid) {
// TODO Auto-generated method stub
CommonDao cd = new CommonDao();
cd.setConn(BasicDao.getCon());
String sql = "select * from tbl_jd where jdid = "+jdid+"order by qxid ";
cd.setSqlvalue(sql);
Result result = null;
JD jd = new JD();
try {
result = cd.executeQuery();
if(result.getRowCount()>0)
{
jd.setJdid((Integer)result.getRows()[0].get("jdid"));
jd.setQxid((Integer)result.getRows()[0].get("qxid"));
jd.setJd((String)result.getRows()[0].get("jd"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jd;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -