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

📄 sort.java

📁 一个网购物系统有JAVA 写成...稍加修改就可以成为毕业设计用..希望对你们有用
💻 JAVA
字号:
package com.wssd;

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

public class Sort extends ExecuteDB
{
	//定义成员变量	
	private long SortID;    
	private String SortName;       
	private String strSql;
	
	//初始化成员变量值
	public Sort()
	{
		this.SortID=0;        
		this.SortName="";		
		this.strSql=""; 
	}   
	
	//向goods数据表中添加一条新记录
	public boolean add()
	{	
		this.strSql="insert into sorts ";
		this.strSql=this.strSql + "(SortName) ";        
		this.strSql=this.strSql + "values('" + this.SortName + "')";
		
		boolean isAdd = super.exeSql(this.strSql);		
		return isAdd;
	}
		
	//修改成员变量SortID对应的商品类别信息
	public boolean modify()
	{
		this.strSql="update sorts set ";	
		this.strSql=this.strSql + "SortName=" + "'" + this.SortName + "'";
		this.strSql=this.strSql + " where SortID=" + this.SortID;		
		
		boolean isUpdate = super.exeSql(this.strSql);		
		return isUpdate;
	}
	
	//判断商品类别名称是否存在
	public boolean exist()
	{
		this.strSql="select * from sorts ";
		this.strSql=this.strSql + " where SortName='" + this.SortName + "'"; 	
		try
		{
			ResultSet rs = super.exeQuery(this.strSql); 
			if (rs.next())
				return true;
			else
				return false;		
		}
		catch(Exception e)
		{		    
			return false;
		}
	}
	
	//删除类sSortID中对应的商品类别信息
	public boolean delete(String sSortID)
	{
		this.strSql="delete from sorts where SortID in (";
		this.strSql=this.strSql + sSortID + ")";
	
		boolean isDelete = super.exeSql(this.strSql);		
		return isDelete;
	}   
	
	//获取类成员变量SortID对应的商品类别信息
	public boolean  init()
	{
		this.strSql="select * from sorts where SortID=";
		this.strSql=this.strSql + this.SortID;        
		try
		{
			ResultSet rs = super.exeQuery(this.strSql);
			if (rs.next())
			{
				SortID=rs.getLong("SortID");                
				SortName=rs.getString("SortName"); 
				return true;               
			}
			else
				return false;
		}
		catch(Exception e)
		{		 
			return false;
		}        
	}
	
	//获取所有商品类别信息,返回一个ResultSet类型对象
	public ResultSet show_sorts()
	{
		this.strSql="select * from sorts";
		ResultSet rs = null;		
		try
		{
			rs = super.exeQuery(this.strSql); 
		}
		catch(Exception ex)
		{
			System.out.println(ex.toString());   
		}
		return rs;	
	}
   
   	//设置类成员变量SortID的值 
	public void setSortID(long SortID)
	{
		this.SortID = SortID;	
	}   

	//获取类成员变量SortID的值  
	public long getSortID()
	{
		return this.SortID;	
	} 
	
	 //设置类成员变量SortName的值 
 	public void setSortName(String SortName)
	{
		this.SortName = SortName;	
	}   

	//获取类成员变量SortName的值  
	public String getSortName()
	{
		return this.SortName;	
	} 	
}

⌨️ 快捷键说明

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