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

📄 kindmodel.java

📁 仓库管理
💻 JAVA
字号:
package com.store.model;

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

import com.store.common.StoreHouseConnection;
import com.store.entity.Kind;

public class KindModel 
{
//	public void saveKind(Kind kind)
//	{
//		try
//		{
//			System.out.println(kind.getKindId());
//			StoreHouseConnection storeCon=new StoreHouseConnection();
//			Connection con=storeCon.getConnection();
//			Statement st=con.createStatement();
//			int row=st.executeUpdate("insert into kind(kindname) values('"+kind.getKindName()+"')");
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		
//	}
//	public void deleteKindById(String id)
//	{
//		try
//		{
//			StoreHouseConnection storeCon=new StoreHouseConnection();
//			Connection con=storeCon.getConnection();
//			Statement st=con.createStatement();
//			st.executeUpdate("delete from kind where kindid="+id);
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//	}
//	public ArrayList getKindList(int page,int row,String table)
//	{
//		ArrayList lst=new ArrayList();
//		int temp=1;
//		try
//		{
//			StoreHouseConnection storeCon=new StoreHouseConnection();
//			Connection con=storeCon.getConnection();
//			Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//		    ResultSet rs= st.executeQuery("select * from "+table);
//		  
//		    if(rs.absolute(page*row-row+1))
//		    {
//		    	do
//		    	{
//		    		if(temp==4)
//		    		{
//		    			temp=1;
//		    			break;
//		    		}
//		    		 String kind[]=new String[rs.getMetaData().getColumnCount()];
//		    		 for(int i=1;i<=rs.getMetaData().getColumnCount();i++)
//		    		 {
//		    			 kind[i-1]=rs.getString(i);
//		    		 }
//		    		lst.add(kind);
//		    		temp++;
//		    	}while(rs.next());
//		    }
//		    
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		return lst;
//	}
//	public int selectTotalPage()
//	
//	{
//		int row=0;
//		int totalPage=0;
//		try
//		{
//			StoreHouseConnection storeCon=new StoreHouseConnection();
//			Connection con=storeCon.getConnection();
//			Statement st=con.createStatement();
//			ResultSet rs=st.executeQuery("select count(*) from kind");
//		   if(rs.next())
//		   {
//			row=rs.getInt(1);
//			if((row%3)==0)
//			{
//				totalPage=row/3;
//			}
//			else
//			{
//				totalPage=(row/3)+1;
//			}
//		   }
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		return totalPage;
//	}
//	public Kind getKindById(String id)
//	{
//		Kind kind=new Kind();
//		try
//		{
//			StoreHouseConnection storeCon=new StoreHouseConnection();
//			Connection con=storeCon.getConnection();
//			Statement st=con.createStatement();
//			ResultSet rs=st.executeQuery("select * from kind where kindid="+id);
//		    if(rs.next())
//		    {
//		    	kind.setKindId(rs.getInt(1));
//		    	kind.setKindName(rs.getString(2));
//		    }
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		return kind;
//	}

}

⌨️ 快捷键说明

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