📄 sorts.java
字号:
package dlut;
import java.sql.*;
public class Sorts extends ExecuteDB
{
private long sortID;
private String sortName;
private int tag;
private String strSql;
public Sorts()
{
this.sortID=0;
this.sortName="";
this.tag=0;
this.strSql="";
}
public boolean addSort()
{
this.strSql="insert into sorts ";
this.strSql=this.strSql + "(";
this.strSql=this.strSql + "SortName,";
this.strSql=this.strSql + "Tag";
this.strSql=this.strSql + ") ";
this.strSql=this.strSql + "values(";
this.strSql=this.strSql + "'" + this.sortName + "',";
this.strSql=this.strSql + "'" + this.tag + "'";
this.strSql=this.strSql + ")";
System.out.println(strSql);
boolean isAdd = super.exeSql(this.strSql);
return isAdd;
}
public boolean modifySort()
{
this.strSql="update sorts set ";
this.strSql=this.strSql + "SortName=" + "'" + this.sortName + "',";
this.strSql=this.strSql + "Tag=" + this.tag;
this.strSql=this.strSql + " where SortID=" + this.sortID;
boolean isUpdate = super.exeSql(this.strSql);
return isUpdate;
}
public boolean isExist()
{
this.strSql="select * from sorts ";
this.strSql=this.strSql + " where SortName='" + this.sortName + "'";
try
{
ResultSet rs = super.exeSqlQuery(this.strSql);
if (rs.next())
{
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
return false;
}
}
public boolean deleteSort(String deleteSortID)
{
this.strSql="delete from sorts where SortID in (";
this.strSql=this.strSql + deleteSortID + ")";
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
public boolean init()
{
this.strSql="select * from sorts where SortID=";
this.strSql=this.strSql + this.sortID;
try
{
ResultSet rs = super.exeSqlQuery(this.strSql);
if (rs.next())
{
sortID=rs.getLong("SortID");
sortName=rs.getString("SortName");
tag=rs.getInt("Tag");
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
return false;
}
}
public ResultSet showSorts()
{
this.strSql="select * from sorts";
ResultSet rs = null;
try
{
rs = super.exeSqlQuery(this.strSql);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
return rs;
}
public void setSortID(long SortID)
{
this.sortID = SortID;
}
public long getSortID()
{
return this.sortID;
}
public void setSortName(String SortName)
{
this.sortName = SortName;
}
public String getSortName()
{
return this.sortName;
}
public void setTag(int Tag)
{
this.tag = Tag;
}
public int getTag()
{
return this.tag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -