📄 whm_pwd_order.java
字号:
package ksnb;
import java.sql.*;
public class whm_pwd_order {
Connection con=null;
Statement st=null;
Statement st2=null;
ResultSet rs=null;
ResultSet rs2=null;
public conn cn = null;
public whm_pwd_order() {
try{
cn=new conn();
cn = new conn();
con = cn.getConncetion();
st = con.createStatement();
}catch(Exception e){
System.out.println("连接数据库异常:"+e.toString());
}
}
//对订单的查询
public ResultSet exec_sql(String sql){
System.out.println("sql:"+sql);
try {
rs = st.executeQuery(sql);
System.out.println("sql--完成");
} catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
return rs;
}
//对订单状态的修改
public void rework_order_status(String id,int status){
String sql="update Shop_Order_R_Info set Status="+status+" where Order_id='"+id+"'";
System.out.println(sql);
try{
st.executeUpdate(sql);
}catch(Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//获得大分类(货架)信息
public ResultSet getAclass(){
String sql="select * from Shop_P_Catalog";
System.out.println(sql);
try{
rs=st.executeQuery(sql);
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
return rs;
}
//获得小分类(货架)信息
public ResultSet getNclass(int parented){
String sql="select * from Shop_Catalog where Parented="+parented;
System.out.println(sql);
try{
rs=st.executeQuery(sql);
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
return rs;
}
//更新大分类
public void update_anclass(int id,String title){
String sql="update Shop_P_Catalog set Title='"+title+"' where P_Catalog_Id="+id;
try{
st.executeUpdate(sql);
System.out.println("更新大分类sql--完成");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//删除大分类
public void del_anclass(int id){
String sql="select * from Shop_Catalog where Parented="+id;
System.out.println("del_anclass:sql="+sql);
try{
rs=st.executeQuery(sql);//通过大分类id获得小分类
System.out.println("rs___OK");
st2 = con.createStatement();
//逐句删除小分类
while(rs.next()){
System.out.println("del——nclass");
st2.executeUpdate("delete Shop_Catalog where Catalog_Id="+rs.getInt("Catalog_Id"));
System.out.println("del——nclass_ok");
}
//删除此大分类的小分类后在将本大分类删除
st.executeUpdate("delete Shop_P_Catalog where P_Catalog_Id="+id);
System.out.println("del——anclass_ok");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//更新小分类
public void update_nclass(int id,String title){
String sql="update Shop_Catalog set Title='"+title+"' where Catalog_Id="+id;
try{
st.executeUpdate(sql);
System.out.println("更新小分类sql--完成");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//删除小分类
public void del_nclass(int id){
String sql="delete Shop_Catalog where Catalog_Id="+id;
try{
st.executeUpdate(sql);
System.out.println("删除小分类sql--完成");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//添加大分类
public void add_anclass(String title){
String sql="Insert Into Shop_P_Catalog values('"+title+"')";
try{
System.out.println("insert anclass sql:"+sql);
st.executeUpdate(sql);
System.out.println("add_anclass-----ok");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//添加小分类
public void add_nclass(String title,int id){
String sql="Insert Into Shop_Catalog values("+id+",'"+title+"')";
try{
st.executeUpdate(sql);
System.out.println("add_anclass-----ok");
}catch (Exception e) {
System.out.println("sql语句异常:"+e.toString());
}
}
//关闭连接
public void getClose(){
try{
cn.conClose();
st.close();
}catch(Exception e){
System.out.println("关闭异常:"+e.toString());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -