📄 messfun.java
字号:
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return re;
}
public String addsales(String salesno,String name,String rname,String tel,String sex,String password,String edit,String time,String work)
{//添加业务员
insert db =new insert();
String re="Error";
String sno = ex_chinese(salesno);
String sn = ex_chinese(name);
String rn = ex_chinese(rname);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String ssex = ex_chinese(sex);
String wor = ex_chinese(work);
String sqlsales="insert into salesman(salesno,name,rname,tel,sex,password,edit,edtime ,work) values('"+sno+"','"+sn+"','"+rn+"','"+te+"','"+ssex+"','"+pa+"','"+ed+"','"+tim+"','"+wor+"') ";
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String addgys(String supplierno,String suppliername,String principaal,String tel,String address,String password,String edit,String time ,String work)
{//添加供应商
insert db =new insert();
String re="Error";
String sno = ex_chinese(supplierno);
String sn = ex_chinese(suppliername);
String rn = ex_chinese(principaal);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String addr = ex_chinese(address);
String wor = ex_chinese(work);
String sqlsales="insert into supplier(supplierno,suppliername,principaal,tel,address,password,edit,edtime,work) values('"+sno+"','"+sn+"','"+rn+"','"+te+"','"+addr+"','"+pa+"','"+ed+"','"+tim+"','"+wor+"') ";
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String addleader(String leaderno,String name,String rname,String tel,String sex,String password,String edit,String time,String work)
{//添加LEDER
insert db =new insert();
String re="Error";
String sno = ex_chinese(leaderno);
String sn = ex_chinese(name);
String rn = ex_chinese(rname);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String ssex = ex_chinese(sex);
String wor = ex_chinese(work);
String sqlsales="insert into leader(leaderno,name,rname,tel,sex,password,edit,edtime,work) values('"+sno+"','"+sn+"','"+rn+"','"+te+"','"+ssex+"','"+pa+"','"+ed+"','"+tim+"','"+wor+"') ";
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String updatefit(String fno,String title,String aparam,String marprice,String ipotime,String warranty,String itype,String ipin,String stype,String spin)
{//更新配件信息
insert db =new insert();
String dtype="";
String dpin="";
if(itype!="")
{
dtype = ex_chinese(itype);//种类
}
else
{
dtype = ex_chinese(stype);//种类
}
if(ipin!="")
{
dpin = ex_chinese(ipin);//品牌
}
else
{
dpin = ex_chinese(spin);//种类
}
String ti = ex_chinese(title);
String Con = ex_chinese(aparam);
String mar = ex_chinese(marprice);
String ipo = ex_chinese(ipotime);
String warr = ex_chinese(warranty);
String re="";
String sql="update fitting set title='"+ti+"',aparam='"+Con+"',marprice='"+mar+"',ipotime='"+ipo+"',warranty='"+warr+"',type='"+dtype+"',pin='"+dpin+"' where fittingno='"+fno+"' ";
try
{
db.executeQuery(sql);
re=fno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return re;
}
public String updatesales(String salesno,String name,String rname,String tel,String sex,String password,String edit,String time,String work)
{//更新业务员
insert db =new insert();
String re="Error";
String sno = ex_chinese(salesno);
String sn = ex_chinese(name);
String rn = ex_chinese(rname);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String wor = ex_chinese(work);
String sqlsales="upate salesman set salesno='"+sno+"',name='"+sn+"',rname='"+rn+"',tel='"+te+"',sex='"+sex+"',password='"+pa+"',edit='"+ed+"',edtime='"+tim+"',work='"+wor+"' where salesno='"+sno+"' ";
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String updateleader(String leaderno,String name,String rname,String tel,String sex,String password,String edit,String time,String work)
{//添加LEDER
insert db =new insert();
String re="Error";
String sno = ex_chinese(leaderno);
String sn = ex_chinese(name);
String rn = ex_chinese(rname);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String ssex = ex_chinese(sex);
String wor = ex_chinese(work);
String sqlsales="update leader set leaderno='"+sno+"',name='"+sn+"',rname='"+rn+"',tel='"+te+"',sex='"+ssex+"',password='"+pa+"',edit='"+ed+"',edtime='"+tim+"',work='"+wor+"' where leaderno='"+sno+"' ";
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String updategys(String supplierno,String suppliername,String principaal,String tel,String address,String password,String edit,String time ,String work)
{//跟新供应商
insert db =new insert();
String re="Error";
String sno = ex_chinese(supplierno);
String sn = ex_chinese(suppliername);
String rn = ex_chinese(principaal);
String te = ex_chinese(tel);
String pa = ex_chinese(password);
String ed = ex_chinese(edit);
String tim = ex_chinese(time);
String addr = ex_chinese(address);
String sqlsales="ERROR";
if(work!=""){
String wor = ex_chinese(work);
sqlsales="update supplier set supplierno='"+sno+"',suppliername='"+sn+"',principaal='"+rn+"',tel='"+te+"',address='"+addr+"',password='"+pa+"',edit='"+ed+"',edtime='"+tim+"',work='"+wor+"' where supplierno='"+sno+"' ";
}
else {
sqlsales="update supplier set supplierno='"+sno+"',suppliername='"+sn+"',principaal='"+rn+"',tel='"+te+"',address='"+addr+"',password='"+pa+"',edit='"+ed+"',edtime='"+tim+"' where supplierno='"+sno+"' ";
}
try
{
db.executeQuery(sqlsales);
re=sno;
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
return sqlsales;
}
public String autoid(String name,String table)
{//提取自动编码
String k="10000";
int s=0;
connDB db =new connDB();
String sqlautoid="select "+name+" from "+table+"";
try
{
ResultSet auto=db.executeQuery(sqlautoid);
while(auto.next()) {
s++;
if(s!=0) k=auto.getString(""+name+"");
}
}
catch(Exception e){e.printStackTrace();}
finally{db.close();}
int x = Integer.parseInt(k)+1;
k=String.valueOf(x);
return k;
}
public int total(String table)
{//计算记录的总数
int sum=0;
connDB cb =new connDB();
String sqlsum="select * from "+table+"";
try
{
ResultSet totall=cb.executeQuery(sqlsum);
while(totall.next())
{
sum++;
}
}
catch(Exception e){e.printStackTrace();}
finally{cb.close();}
return sum;
}
public String idtoname(String name,String table,String where,String id)
{//登陆名转换
String na="error";
String nn = ex_chinese(name);
String tt = ex_chinese(table);
String ww = ex_chinese(where);
String ii = ex_chinese(id);
connDB bb =new connDB();
String sqlsum="select "+nn+" from "+tt+" where "+ww+"='"+ii+"' ";
try
{
ResultSet toname=bb.executeQuery(sqlsum);
while(toname.next())
{
na=toname.getString(""+name+"");
}
}
catch(Exception e){e.printStackTrace();}
finally{bb.close();}
return na;
}
public ResultSet pt(String a,String table)
{//获取品牌或者种类
String nn = ex_chinese(a);
String tt = ex_chinese(table);
connDB pb =new connDB();
String sqlpb="select distinct "+nn+" from "+tt+"";
ResultSet kk=pb.executeQuery(sqlpb);
return kk;
}
public ResultSet look(String table,String where,String id )
{//获取特定的记录信息
String tt = ex_chinese(table);
String ww = ex_chinese(where);
String ii = ex_chinese(id);
connDB pb =new connDB();
String sqllook="select * from "+tt+" where "+ww+"="+ii+"";
ResultSet see=pb.executeQuery(sqllook);
return see;
}
public String up(String table,String set, String value ,String set1, String value1 , String where,String id )
{//更新特定的记录信息
String tt = ex_chinese(table);
String ww = ex_chinese(where);
String ii = ex_chinese(id);
String vv = ex_chinese(value);
String ss = ex_chinese(set);
String vv1 = ex_chinese(value1);
String ss1 = ex_chinese(set1);
connDB pb =new connDB();
String sqllook="update "+tt+" set "+ss+"='"+vv+"',"+ss1+"='"+vv1+"' where "+ww+"='"+ii+"'";
try
{
pb.executeQuery(sqllook);
}
catch(Exception e){e.printStackTrace();}
finally{pb.close();}
return sqllook;
}
public ResultSet like(String table,String where,String id )
{//模糊查询
String tt = ex_chinese(table);
String ww = ex_chinese(where);
String ii = ex_chinese(id);
connDB pb =new connDB();
String sqllike="select * from "+tt+" where "+ww+" like '%"+ii+"%'";
ResultSet l=pb.executeQuery(sqllike);
return l;
}
public ResultSet ck(String table,String where,String id ,String su,String no)
{//双条件获取特定的记录信息
String tt = ex_chinese(table);
String ww = ex_chinese(where);
String ii = ex_chinese(id);
String ss = ex_chinese(su);
String nn = ex_chinese(no);
connDB pb =new connDB();
String sqllook="select * from "+tt+" where "+ww+"="+ii+" and "+su+"="+no+"";
ResultSet see=pb.executeQuery(sqllook);
return see;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -