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

📄 delorderlmdao.java

📁 网上购物源代码
💻 JAVA
字号:
/**
 * 
 */
package com.chinaaccpDao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

import com.chinaaccpbean.TempBean;

/**
 * @author Administrator
 *
 */
public class DelOrderLMDao {

	public boolean GetDelOrderMess(String id)
	{
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "delete from ordermess where orderid='"+id+"'";
			String sql2 = "delete from orderlist where id='"+id+"'";
			int row = st.executeUpdate(sql);
			int row2 = st.executeUpdate(sql2);
			if(row>0&&row2>0)
			{
				st.close();
				con.close();
				return true;
			}
			else
			{
				st.close();
				con.close();
				return false;
			}
			
		} 
		catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	
	public ArrayList GetTempInfo(String id)
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select productid,quantity from temptable where orderid='"+id+"'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				TempBean tb = new TempBean();
				tb.setProductid(rs.getInt(1));
				tb.setCount(rs.getInt(2));
				list.add(tb);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	public String GetUpdatePro(TempBean tb)
	{
		String info = null;
		Connection con =null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "update product set quantity=quantity+'"+tb.getCount()+"' where id='"+tb.getProductid()+"'";
			int row = st.executeUpdate(sql);
			if(row>0)
			{
				info = "取消订单成功";
				return info;
			}
		} catch (Exception e) {
			info=e.getMessage();
		}
		return info;
	}
}

⌨️ 快捷键说明

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