?? producttabledao.java
字號:
package com.dao;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.ibatis.common.resources.Resources;
import java.io.Reader;
import java.io.IOException;
import java.util.List;
import java.sql.SQLException;
import com.tool.pagetool.*;
import com.bean.*;
public class ProductTableDAO extends PageDAO{
public static List selectAllProductTable() throws SQLException {
return sqlMapper.queryForList("selectAllProductTable");
}
public static ProductTable selectProductTableByproductId(int id) throws SQLException {
return (ProductTable) sqlMapper.queryForObject("selectProductTableByproductId", new Integer(id));
}
public static boolean selectIsHasProduct(String whereStr)throws SQLException{
boolean flag = false;
Object obj = sqlMapper.queryForObject("selectIsHasProduct",whereStr);
if(obj!=null)flag=true;
return flag;
}
public static boolean selectIsReferProduct(ProductTable producttable)throws SQLException{
boolean flag = false;
ProductTable tmpProduct =ProductTableDAO.selectProductTableByproductId(producttable.getProductId());
System.out.println("tmpProduct.getReferFlag()=" +tmpProduct.getReferFlag());
if(tmpProduct.getReferFlag()>0) flag = true;
return flag;
}
public static void insertProductTable(ProductTable producttable) throws SQLException {
sqlMapper.insert("insertProductTable", producttable);
}
public static void updateProductTable(ProductTable producttable) throws SQLException {
sqlMapper.update("updateProductTable", producttable);
}
public static void deleteProductTableByproductId(int id) throws SQLException {
sqlMapper.delete("deleteProductTableByproductId", new Integer(id));
}
public int selectCount(Page page) throws SQLException{
return ((Integer)sqlMapper.queryForObject("selectProductTableCount",page)).intValue();
}
public int selectCount() throws SQLException{
return ((Integer)sqlMapper.queryForObject("selectProductTableCountNotP")).intValue();
}
public List selectForPage(Page page) throws SQLException{
List pageList = sqlMapper.queryForList("selectProductTableForPage",page);
return pageList;
}
public static void startTransation()throws SQLException{
sqlMapper.startTransaction();
}
public static void startTransation(int i)throws SQLException{
sqlMapper.startTransaction(i);
}
public static void rollback() throws SQLException{
sqlMapper.endTransaction();
}
public static void commit()throws SQLException{
sqlMapper.commitTransaction();
}
public static int getLastId() throws SQLException{
Object obj = sqlMapper.queryForObject("selectProductTableLastId");
if(obj==null) return 0;
else
return ((Integer)obj).intValue();
}
public static List selectAllProductTableNameID() throws SQLException {
return sqlMapper.queryForList("selectProductTableNameID");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -