package com.lzw.dao;
import internalFrame.guanli.Item;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import model.TbGysinfo;
import model.TbKhinfo;
import model.TbKucun;
import model.TbRkthDetail;
import model.TbRkthMain;
import model.TbRukuDetail;
import model.TbRukuMain;
import model.TbSellDetail;
import model.TbSellMain;
import model.TbSpinfo;
import model.TbUserlist;
import model.TbXsthDetail;
import model.TbXsthMain;
public class Dao {
protected static String dbClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
protected static String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433;"
+ "DatabaseName=db_JXC;SelectMethod=Cursor";
protected static String dbUser = "sa";
protected static String dbPwd = "";
protected static String second = null;
public static Connection conn = null;
static {
try {
if (conn == null) {
Class.forName(dbClassName).newInstance();
conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
}
} catch (Exception ee) {
ee.printStackTrace();
}
}
private Dao() {
}
// 读取所有客户信息
public static List getKhInfos() {
List list = findForList("select id,khname from tb_khinfo");
return list;
}
// 读取所有供应商信息
public static List getGysInfos() {
List list = findForList("select id,name from tb_gysinfo");
return list;
}
// 读取客户信息
public static TbKhinfo getKhInfo(Item item) {
String where = "khname='" + item.getName() + "'";
if (item.getId() != null)
where = "id='" + item.getId() + "'";
TbKhinfo info = new TbKhinfo();
ResultSet set = findForResultSet("select * from tb_khinfo where "
+ where);
try {
if (set.next()) {
info.setId(set.getString("id").trim());
info.setKhname(set.getString("khname").trim());
info.setJian(set.getString("jian").trim());
info.setAddress(set.getString("address").trim());
info.setBianma(set.getString("bianma").trim());
info.setFax(set.getString("fax").trim());
info.setHao(set.getString("hao").trim());
info.setLian(set.getString("lian").trim());
info.setLtel(set.getString("ltel").trim());
info.setMail(set.getString("mail").trim());
info.setTel(set.getString("tel").trim());
info.setXinhang(set.getString("xinhang").trim());
}
} catch (SQLException e) {
e.printStackTrace();
}
return info;
}
// 读取指定供应商信息
public static TbGysinfo getGysInfo(Item item) {
String where = "name='" + item.getName() + "'";
if (item.getId() != null)
where = "id='" + item.getId() + "'";
TbGysinfo info = new TbGysinfo();
ResultSet set = findForResultSet("select * from tb_gysinfo where "
+ where);
try {
if (set.next()) {
info.setId(set.getString("id").trim());
info.setAddress(set.getString("address").trim());
info.setBianma(set.getString("bianma").trim());
info.setFax(set.getString("fax").trim());
info.setJc(set.getString("jc").trim());
info.setLian(set.getString("lian").trim());
info.setLtel(set.getString("ltel").trim());
info.setMail(set.getString("mail").trim());
info.setName(set.getString("name").trim());
info.setTel(set.getString("tel").trim());
info.setYh(set.getString("yh").trim());
}
} catch (SQLException e) {
e.printStackTrace();
}
return info;
}
// 读取用户
public static TbUserlist getUser(String name, String password) {
TbUserlist user = new TbUserlist();
ResultSet rs = findForResultSet("select * from tb_userlist where username='"
+ name + "'");
try {
if (rs.next()) {
user.setUsername(name);
user.setPass(rs.getString("pass"));
if (user.getPass().equals(password)) {
user.setName(rs.getString("name"));
user.setQuan(rs.getString("quan"));
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return user;
}
// 执行指定查询
public static ResultSet query(String QueryStr) {
ResultSet set = findForResultSet(QueryStr);
return set;
}
// 执行删除
public static int delete(String sql) {
return update(sql);
}
// 添加客户信息的方法
public static boolean addKeHu(TbKhinfo khinfo) {
if (khinfo == null)
return false;
return insert("insert tb_khinfo values('" + khinfo.getId() + "','"
+ khinfo.getKhname() + "','" + khinfo.getJian() + "','"
+ khinfo.getAddress() + "','" + khinfo.getBianma() + "','"
+ khinfo.getTel() + "','" + khinfo.getFax() + "','"
+ khinfo.getLian() + "','" + khinfo.getLtel() + "','"
+ khinfo.getMail() + "','" + khinfo.getXinhang() + "','"
+ khinfo.getHao() + "')");
}
// 修改客户信息的方法
public static int updateKeHu(TbKhinfo khinfo) {
return update("update tb_khinfo set jian='" + khinfo.getJian()
+ "',address='" + khinfo.getAddress() + "',bianma='"
+ khinfo.getBianma() + "',tel='" + khinfo.getTel() + "',fax='"
+ khinfo.getFax() + "',lian='" + khinfo.getLian() + "',ltel='"
+ khinfo.getLtel() + "',mail='" + khinfo.getMail()
+ "',xinhang='" + khinfo.getXinhang() + "',hao='"
+ khinfo.getHao() + "' where id='" + khinfo.getId() + "'");
}
// 修改库存的方法
public static int updateKucunDj(TbKucun kcInfo) {
return update("update tb_kucun set dj=" + kcInfo.getDj()
+ " where id='" + kcInfo.getId() + "'");
}
// 修改供应商信息的方法
public static int updateGys(TbGysinfo gysInfo) {
return update("update tb_gysinfo set jc='" + gysInfo.getJc()
+ "',address='" + gysInfo.getAddress() + "',bianma='"
+ gysInfo.getBianma() + "',tel='" + gysInfo.getTel()
+ "',fax='" + gysInfo.getFax() + "',lian='" + gysInfo.getLian()
+ "',ltel='" + gysInfo.getLtel() + "',mail='"
+ gysInfo.getMail() + "',yh='" + gysInfo.getYh()
+ "' where id='" + gysInfo.getId() + "'");
}
// 添加供应商信息的方法
public static boolean addGys(TbGysinfo gysInfo) {
if (gysInfo == null)
return false;
return insert("insert tb_gysinfo values('" + gysInfo.getId() + "','"
+ gysInfo.getName() + "','" + gysInfo.getJc() + "','"
+ gysInfo.getAddress() + "','" + gysInfo.getBianma() + "','"
+ gysInfo.getTel() + "','" + gysInfo.getFax() + "','"
+ gysInfo.getLian() + "','" + gysInfo.getLtel() + "','"
+ gysInfo.getMail() + "','" + gysInfo.getYh() + "')");
}
// 添加商品
public static boolean addSp(TbSpinfo spInfo) {
if (spInfo == null)
return false;
return insert("insert tb_spinfo values('" + spInfo.getId() + "','"
+ spInfo.getSpname() + "','" + spInfo.getJc() + "','"
+ spInfo.getCd() + "','" + spInfo.getDw() + "','"
+ spInfo.getGg() + "','" + spInfo.getBz() + "','"
+ spInfo.getPh() + "','" + spInfo.getPzwh() + "','"
+ spInfo.getMemo() + "','" + spInfo.getGysname() + "')");
}
// 更新商品
public static int updateSp(TbSpinfo spInfo) {
return update("update tb_spinfo set jc='" + spInfo.getJc() + "',cd='"
+ spInfo.getCd() + "',dw='" + spInfo.getDw() + "',gg='"
+ spInfo.getGg() + "',bz='" + spInfo.getBz() + "',ph='"
+ spInfo.getPh() + "',pzwh='" + spInfo.getPzwh() + "',memo='"
+ spInfo.getMemo() + "',gysname='" + spInfo.getGysname()
+ "' where id='" + spInfo.getId() + "'");
}
// 读取商品信息
public static TbSpinfo getSpInfo(Item item) {
String where = "spname='" + item.getName() + "'";
if (item.getId() != null)
where = "id='" + item.getId() + "'";
ResultSet rs = findForResultSet("select * from tb_spinfo where "
+ where);
TbSpinfo spInfo = new TbSpinfo();
try {
if (rs.next()) {
spInfo.setId(rs.getString("id").trim());
spInfo.setBz(rs.getString("bz").trim());
spInfo.setCd(rs.getString("cd").trim());
spInfo.setDw(rs.getString("
没有合适的资源?快使用搜索试试~ 我知道了~
Java企业进销存管理系统源码-jxc-j.zip
共269个文件
class:144个
png:61个
java:49个
0 下载量 122 浏览量
2023-07-28
15:55:05
上传
评论
收藏 2.29MB ZIP 举报
温馨提示
Java企业进销存管理系统源码_jxc_j.zip
资源推荐
资源详情
资源评论
收起资源包目录
Java企业进销存管理系统源码-jxc-j.zip (269个子文件)
Dao.class 20KB
XiaoShouTuiHuo.class 11KB
XiaoShouDan.class 11KB
JinHuoTuiHuo.class 11KB
JinHuoDan.class 11KB
JXCFrame.class 9KB
ShangPinXiuGaiPanel.class 7KB
RuKuChaXun.class 7KB
RuKuTuiHuoChaXun.class 7KB
XiaoShouTuiHuoChaXun.class 7KB
KeHuXiuGaiPanel.class 6KB
XiaoShouChaXun.class 6KB
GysXiuGaiPanel.class 6KB
XiaoShouPaiHang.class 6KB
KuCunPanDian.class 6KB
KeHuChaXun.class 6KB
GongYingShangChaXun.class 6KB
ShangPinChaXun.class 6KB
JiaGeTiaoZheng.class 5KB
ShangPinTianJiaPanel.class 5KB
QuanManager.class 5KB
GengGaiMiMa.class 5KB
ShanChuCaoZuoYuan.class 5KB
KeHuTianJiaPanel.class 4KB
XiaoShouTuiHuo$4.class 4KB
JinHuoTuiHuo$4.class 4KB
XiaoShouDan$4.class 4KB
JinHuoDan$RkActionListener.class 4KB
KeHuTianJiaPanel$SaveButtonActionListener.class 4KB
ShangPinTianJiaPanel$1.class 4KB
GysTianJiaPanel.class 4KB
TJCzy.class 4KB
GysTianJiaPanel$TjActionListener.class 4KB
customCellEditor.class 4KB
TbKhinfo.class 3KB
XiaoShouTuiHuoChaXun$QueryAction.class 3KB
ShangPinChaXun$QueryAction.class 3KB
TbRukuMain.class 3KB
TbGysinfo.class 3KB
XiaoShouChaXun$QueryActionListener.class 3KB
TbSellMain.class 3KB
TbRkthMain.class 3KB
TbXsthMain.class 3KB
KeHuChaXun$queryAction.class 3KB
TbKucun.class 3KB
RuKuTuiHuoChaXun$3.class 3KB
Login.class 3KB
RuKuChaXun$3.class 3KB
GongYingShangChaXun$queryAction.class 3KB
JiaGeTiaoZheng$ItemActionListener.class 2KB
TbSpinfo.class 2KB
XiaoShouDan$computeInfo.class 2KB
XiaoShouTuiHuo$computeInfo.class 2KB
JinHuoTuiHuo$computeInfo.class 2KB
TJCzy$1.class 2KB
XiaoShouTuiHuo$initTasks.class 2KB
JinHuoTuiHuo$initTasks.class 2KB
XiaoShouDan$initTasks.class 2KB
XiaoShouPaiHang$OkAction.class 2KB
ShangPinXiuGaiPanel$3.class 2KB
JinHuoDan$initTasks.class 2KB
JinHuoDan$computeInfo.class 2KB
KeHuXiuGaiPanel$3.class 2KB
GysXiuGaiPanel$ModifyActionListener.class 2KB
JXCFrame$openFrameAction.class 2KB
KuCunPanDian$1.class 2KB
GysXiuGaiPanel$DelActionListener.class 2KB
JiaGeTiaoZheng$OkActionListener.class 2KB
ShangPinXiuGaiPanel$2.class 2KB
KeHuXiuGaiPanel$2.class 2KB
ShangPinGuanLi.class 2KB
JiaGeTiaoZheng$1.class 2KB
GengGaiMiMa$2.class 2KB
TbRukuDetail.class 2KB
TbXsthDetail.class 2KB
TbRkthDetail.class 2KB
TbSellDetail.class 2KB
ShanChuCaoZuoYuan$2.class 2KB
KeHuTianJiaPanel$ChongZheButtonActionListener.class 2KB
QuanManager$3.class 1KB
XiaoShouTuiHuo$3.class 1KB
JinHuoTuiHuo$3.class 1KB
KeHuGuanLi.class 1KB
XiaoShouTuiHuo$initTasks$1.class 1KB
GysGuanLi.class 1KB
JinHuoTuiHuo$initTasks$1.class 1KB
ShanChuCaoZuoYuan$1.class 1KB
XiaoShouDan$initTasks$1.class 1KB
Login$2.class 1KB
JinHuoDan$initTasks$1.class 1KB
CzyGL.class 1KB
JinHuoDan$TjActionListener.class 1KB
XiaoShouDan$3.class 1KB
ShangPinTianJiaPanel$2.class 1KB
GysTianJiaPanel$ResetActionListener.class 1KB
XiaoShouTuiHuoChaXun$3.class 1KB
GengGaiMiMa$1.class 1KB
XiaoShouChaXun$ShowAllActoinListener.class 1KB
GongYingShangChaXun$1.class 1KB
RuKuTuiHuoChaXun$4.class 1KB
共 269 条
- 1
- 2
- 3
资源评论
小嗷犬
- 粉丝: 3w+
- 资源: 1347
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功