?? branddao.java
字號:
package com.shopping.dao;
import java.sql.*;
import java.util.*;
import com.comm.db.*;
import com.comm.vo.*;
public class BrandDao {
public void add(GenericVO gvo) throws SQLException {
String name = gvo.getItemStr("NAME");
Vector param = new Vector();
String sql = "INSERT INTO brand (name) VALUES (?)";
param.addElement(name);
DBFactory.getDBI().execute(sql, param);
}
public void modify(GenericVO gvo) throws SQLException {
String brandId = gvo.getItemStr("BRAND_ID");
String name = gvo.getItemStr("NAME");
Vector param = new Vector();
String sql = "UPDATE brand SET name=? WHERE brand_id=?";
param.addElement(name);
param.addElement(brandId);
DBFactory.getDBI().execute(sql, param);
}
public void delete(int brandId) throws SQLException {
String sql = "DELETE FROM brand WHERE brand_id=" + brandId;
DBFactory.getDBI().execute(sql);
}
public GenericVO getDetail(int brandId) throws SQLException {
String sql = "SELECT * FROM brand WHERE brand_id=" + brandId;
return (GenericVO) DBFactory.getDBI().getResult(sql).elementAt(0);
}
public Vector get() throws SQLException {
String sql = "SELECT * FROM brand WHERE status=1 ORDER BY brand_id";
return DBFactory.getDBI().getResult(sql);
}
public void updateLogo1(int brandId, String logo1) throws SQLException {
String sql = "UPDATE brand SET logo1='" + logo1 + "' WHERE brand_id=" +
brandId;
DBFactory.getDBI().execute(sql);
}
public void updateLogo2(int brandId, String logo2) throws SQLException {
String sql = "UPDATE brand SET logo2='" + logo2 + "' WHERE brand_id=" +
brandId;
DBFactory.getDBI().execute(sql);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -