⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postmethoddao.java

📁 大象购物管理程序
💻 JAVA
字号:
package com.shopping.dao;

import java.sql.*;
import java.util.*;

import com.comm.db.*;
import com.comm.vo.*;

public class PostMethodDao {

    public void add(GenericVO gvo) throws SQLException {
        String name = gvo.getItemStr("NAME");
        String first = gvo.getItemStr("FIRST");
        String firstfee = gvo.getItemStr("FIRSTFEE");
        String next = gvo.getItemStr("NEXT");
        String nextfee = gvo.getItemStr("NEXTFEE");
        String other = gvo.getItemStr("OTHER");
        String otherfee = gvo.getItemStr("OTHERFEE");
        String time = gvo.getItemStr("TIME");

        Vector param = new Vector();
        String sql = "INSERT INTO postmethod (name, first, firstfee, next, nextfee, other, otherfee, time) " +
                     "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
        param.addElement(name);
        param.addElement(first);
        param.addElement(firstfee);
        param.addElement(next);
        param.addElement(nextfee);
        param.addElement(other);
        param.addElement(otherfee);
        param.addElement(time);

        DBFactory.getDBI().execute(sql, param);
    }

    public void modify(GenericVO gvo) throws SQLException {
        String postMethodId = gvo.getItemStr("POSTMETHOD_ID");
        String name = gvo.getItemStr("NAME");
        String first = gvo.getItemStr("FIRST");
        String firstfee = gvo.getItemStr("FIRSTFEE");
        String next = gvo.getItemStr("NEXT");
        String nextfee = gvo.getItemStr("NEXTFEE");
        String other = gvo.getItemStr("OTHER");
        String otherfee = gvo.getItemStr("OTHERFEE");
        String time = gvo.getItemStr("TIME");

        Vector param = new Vector();
        String sql = "UPDATE postmethod " +
                     "SET name = ?, first = ?, firstfee = ?, next = ?" +
                     ", nextfee = ?, other = ?, otherfee = ?, time = ? " +
                     "WHERE postmethod_id = ?";
        param.addElement(name);
        param.addElement(first);
        param.addElement(firstfee);
        param.addElement(next);
        param.addElement(nextfee);
        param.addElement(other);
        param.addElement(otherfee);
        param.addElement(time);
        param.addElement(postMethodId);

        DBFactory.getDBI().execute(sql, param);
    }

    public void delete(int postMethodId) throws SQLException {
        String sql = "DELETE FROM postmethod WHERE postmethod_id=" +
                     postMethodId;

        DBFactory.getDBI().execute(sql);
    }

    public GenericVO getDetail(int postMethodId) throws SQLException {
        String sql = "SELECT * FROM postmethod WHERE postmethod_id=" +
                     postMethodId;

        Vector r = DBFactory.getDBI().getResult(sql);
        if (r.size() > 0) {
            return (GenericVO) r.elementAt(0);
        } else {
            return null;
        }
    }

    public Vector get() throws SQLException {
        String sql = "SELECT * FROM postmethod ORDER BY postmethod_id";

        return DBFactory.getDBI().getResult(sql);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -