一、系統(tǒng)介紹
1.開發(fā)環(huán)境
操作系統(tǒng):Win10
開發(fā)工具 :IDEA2018
JDK版本:jdk1.8
數(shù)據(jù)庫:Mysql8.0
2.技術(shù)選型
Java+Swing+Mysql
3.功能模塊

4.系統(tǒng)功能
1.系統(tǒng)登錄登出
管理員可以登錄、退出系統(tǒng)
2.商品信息管理
管理員可以對(duì)商品信息進(jìn)行查詢、添加、修改、刪除等操作。
3.出庫信息管理
管理員可以對(duì)出庫信息進(jìn)行查詢、添加、修改、刪除等操作。
4.入庫信息管理
管理員可以對(duì)入庫信息進(jìn)行查詢、添加、修改、刪除等操作。
5.客戶信息管理
管理員可以對(duì)客戶信息進(jìn)行查詢、添加、修改、刪除等操作。
6.供應(yīng)商信息管理
管理員可以對(duì)供應(yīng)商信息進(jìn)行查詢、添加、修改、刪除等操作。
5.工程結(jié)構(gòu)

二、系統(tǒng)展示
1.登錄頁面

2.主頁面

3.商品展示

4.商品新增

5.出庫展示

6.出庫新增

7.入庫展示

8.入庫新增

9.客戶展示

10.客戶新增

11.供應(yīng)商展示

12.供應(yīng)商新增

13.關(guān)于我們

三、部分代碼
AdminDao
package com.sjsq.dao;
import java.util.ArrayList;
import java.util.List;
import com.sjsq.model.Admin;
import com.sjsq.utils.DBUtil;
/**
* 管理員登錄
*/
public class AdminDao {
/**
* 登錄
*
* @param username
* @param password
* @return
* @throws Exception
*/
public boolean login(String username, String password) throws Exception {
List<Object> paramList = new ArrayList<>();
paramList.add(username);
paramList.add(password);
Admin admin = DBUtil.getObject("select * from t_admin where username=? and password=?", paramList, Admin.class);
if (admin != null) {
return true;
}
return false;
}
}
CustomerDao
package com.sjsq.dao;
import java.util.ArrayList;
import java.util.List;
import com.sjsq.model.Customer;
import com.sjsq.utils.DBUtil;
import com.sjsq.utils.StringUtil;
/**
* 客戶信息操作
*/
public class CustomerDao {
/**
* 查詢所有客戶
*
* @return
* @throws Exception
*/
public List<Customer> getAll() throws Exception {
return DBUtil.getQueryList("select * from t_customer order by id asc", Customer.class);
}
/**
* 條件查詢
*
* @param name
* @return
* @throws Exception
*/
public List<Customer> search(String name) throws Exception {
List<Object> paramList = new ArrayList<>();
StringBuffer sb = new StringBuffer("select * from t_customer where 1=1");
if (!StringUtil.isEmpty(name)) {
sb.append(" and name like ?");
paramList.add("%" + name + "%");
}
sb.append(" order by id asc");
return DBUtil.getQueryList(sb.toString(), paramList, Customer.class);
}
/**
* 保存客戶信息
*
* @param customer
* @return
* @throws Exception
*/
public int save(Customer customer) throws Exception {
List<Object> paramList = new ArrayList<>();
paramList.add(customer.getName());
paramList.add(customer.getPhone());
paramList.add(customer.getAddress());
return DBUtil.execute("insert into t_customer(name,phone,address) values(?,?,?)", paramList);
}
/**
* 更新客戶信息
*
* @param customer
* @return
* @throws Exception
*/
public int update(Customer customer) throws Exception {
List<Object> paramList = new ArrayList<>();
paramList.add(customer.getName());
paramList.add(customer.getPhone());
paramList.add(customer.getAddress());
paramList.add(customer.getId());
return DBUtil.execute("update t_customer set name=?,phone=?,address=? where id=?", paramList);
}
/**
* 根據(jù)id查詢客戶信息
*
* @param id
* @return
* @throws Exception
*/
public Customer getById(int id) throws Exception {
List<Object> paramList = new ArrayList<>();
paramList.add(id);
return DBUtil.getObject("select * from t_customer where id=?", paramList, Customer.class);
}
/**
* 刪除
*
* @param id
* @return
* @throws Exception
*/
public int delete(int id) throws Exception {
List<Object> paramList = new ArrayList<>();
paramList.add(id);
return DBUtil.execute("delete from t_customer where id=?", paramList);
}
}
StringUtil
package com.sjsq.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 字符串轉(zhuǎn)化類
*/
public class StringUtil {
//數(shù)據(jù)庫字段駝峰命名轉(zhuǎn)換
private static Pattern linePattern = Pattern.compile("_(\\w)");
private static Pattern humpPattern = Pattern.compile("[A-Z]");
// 判斷字符串為空
public static boolean isEmpty(String str) {
if ("".equals(str) || str == null) {
return true;
} else {
return false;
}
}
// 判斷字符串不為空
public static boolean isNotEmpty(String str) {
if (!"".equals(str) && str != null) {
return true;
} else {
return false;
}
}
/**
* 下劃線轉(zhuǎn)駝峰
*/
public static String lineToHump(String str) {
str = str.toLowerCase();
Matcher matcher = linePattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
}
matcher.appendTail(sb);
return sb.toString();
}
/**
* 駝峰轉(zhuǎn)下劃線(單寫法,效率低于{@link #humpToLine2(String)})
*/
public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase();
}
/**
* 駝峰轉(zhuǎn)下劃線,效率比上面高
*/
public static String humpToLine2(String str) {
Matcher matcher = humpPattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
}
matcher.appendTail(sb);
return sb.toString();
}
}
LoginFrame
package com.sjsq.view;
import com.sjsq.dao.AdminDao;
import com.sjsq.utils.StringUtil;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 登錄系統(tǒng)
*/
public class LoginFrame extends JFrame {
private JPanel contentPane;
private JTextField unameText;
private JPasswordField pwdText;
private AdminDao userDao = new AdminDao();
/**
* 主函數(shù)
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginFrame frame = new LoginFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* 創(chuàng)建窗體
*/
public LoginFrame() {
setTitle("超市商品信息管理系統(tǒng)");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("系統(tǒng)登錄");
lblNewLabel.setFont(new Font("宋體", Font.PLAIN, 25));
lblNewLabel.setBounds(177, 32, 108, 25);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("賬號(hào):");
lblNewLabel_1.setBounds(98, 89, 54, 15);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("密碼:");
lblNewLabel_2.setBounds(98, 152, 54, 15);
contentPane.add(lblNewLabel_2);
unameText = new JTextField();
unameText.setBounds(148, 86, 166, 21);
contentPane.add(unameText);
unameText.setColumns(10);
pwdText = new JPasswordField();
pwdText.setBounds(148, 149, 166, 21);
contentPane.add(pwdText);
JButton btnNewButton = new JButton("登錄");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String username = unameText.getText();
String password = pwdText.getText();
if (StringUtil.isEmpty(username)) {
JOptionPane.showMessageDialog(contentPane, "請(qǐng)輸入賬號(hào)", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
if (StringUtil.isEmpty(password)) {
JOptionPane.showMessageDialog(contentPane, "請(qǐng)輸入密碼", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
try {
// 登錄賬號(hào)驗(yàn)證
boolean flag = userDao.login(username, password);
if (flag) {
//跳轉(zhuǎn)主界面
JOptionPane.showMessageDialog(contentPane, "登錄成功!");
MainFrame main = new MainFrame();
main.setVisible(true);
// 釋放所有本機(jī)屏幕資源
dispose();
} else {
JOptionPane.showMessageDialog(contentPane, "用戶名密碼錯(cuò)誤!", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
} catch (Exception e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog(contentPane, "登錄異常:" + e1.getMessage(), "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
}
});
btnNewButton.setBounds(146, 202, 76, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("退出");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
btnNewButton_1.setBounds(237, 202, 76, 23);
contentPane.add(btnNewButton_1);
}
}
CustomerAddFrame
package com.sjsq.view;
import com.sjsq.dao.CustomerDao;
import com.sjsq.model.Customer;
import com.sjsq.utils.StringUtil;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 新增客戶信息類
*/
public class CustomerAddFrame extends JFrame {
// 定義內(nèi)容面板
private JPanel contentPane;
// 定義姓名文本
private JTextField nameText;
private JTextField phoneText;
private JTextField addressText;
private CustomerDao customerDao = new CustomerDao();
/**
* Create the frame.
*/
public CustomerAddFrame() {
setTitle("新增客戶信息");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 353, 351);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("客戶名稱:");
lblNewLabel.setBounds(29, 34, 92, 15);
contentPane.add(lblNewLabel);
// 創(chuàng)建空白文本
nameText = new JTextField();
// 設(shè)置位置大小
nameText.setBounds(113, 31, 182, 21);
// 添加到面板
contentPane.add(nameText);
// 設(shè)置內(nèi)容寬度
nameText.setColumns(15);
JLabel lblNewLabel_1 = new JLabel("聯(lián)系電話:");
lblNewLabel_1.setBounds(29, 84, 92, 15);
contentPane.add(lblNewLabel_1);
phoneText = new JTextField();
phoneText.setBounds(113, 81, 182, 21);
contentPane.add(phoneText);
phoneText.setColumns(10);
JLabel lblNewLabel_5 = new JLabel("客戶地址:");
lblNewLabel_5.setBounds(29, 148, 91, 15);
contentPane.add(lblNewLabel_5);
addressText = new JTextField();
addressText.setBounds(113, 145, 182, 21);
contentPane.add(addressText);
addressText.setColumns(10);
JButton btnNewButton = new JButton("保存");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// 獲取輸入的信息
String name = nameText.getText();
String phone = phoneText.getText();
String address = addressText.getText();
// 判斷輸入為空,彈出相應(yīng)提示
if (StringUtil.isEmpty(name)) {
JOptionPane.showMessageDialog(contentPane, "請(qǐng)輸入客戶名稱", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
if (StringUtil.isEmpty(phone)) {
JOptionPane.showMessageDialog(contentPane, "請(qǐng)輸入聯(lián)系電話", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
if (StringUtil.isEmpty(address)) {
JOptionPane.showMessageDialog(contentPane, "請(qǐng)輸入客戶地址", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
// 創(chuàng)建對(duì)象
Customer customer = new Customer();
// 保存信息到對(duì)象中
customer.setName(name);
customer.setPhone(phone);
customer.setAddress(address);
try {
// 新增信息
customerDao.save(customer);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(contentPane, "保存異常:" + e1.getMessage(), "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);
return;
}
JOptionPane.showMessageDialog(contentPane, "保存成功!");
dispose();
}
});
btnNewButton.setBounds(113, 215, 74, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("取消");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
btnNewButton_1.setBounds(220, 215, 74, 23);
contentPane.add(btnNewButton_1);
}
}
四、其他
1.更多系統(tǒng)
Java+Swing系統(tǒng)系列實(shí)現(xiàn)
Java+Swing實(shí)現(xiàn)斗地主游戲
Java+Swing實(shí)現(xiàn)圖書管理系統(tǒng)
Java+Swing實(shí)現(xiàn)醫(yī)院管理系統(tǒng)
Java+Swing實(shí)現(xiàn)考試管理系統(tǒng)
Java+Swing實(shí)現(xiàn)酒店管理系統(tǒng)
Java+Swing實(shí)現(xiàn)超市管理系統(tǒng)
Java+Swing實(shí)現(xiàn)電影購票系統(tǒng)
Java+Swing實(shí)現(xiàn)倉庫管理系統(tǒng)-1
Java+Swing實(shí)現(xiàn)倉庫管理系統(tǒng)-2
Java+Swing實(shí)現(xiàn)進(jìn)銷存管理系統(tǒng)
Java+Swing實(shí)現(xiàn)自助取款機(jī)系統(tǒng)
Java+Swing實(shí)現(xiàn)通訊錄管理系統(tǒng)
Java+Swing實(shí)現(xiàn)停車場(chǎng)管理系統(tǒng)
Java+Swing實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)-1
Java+Swing實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)-2
Java+Swing實(shí)現(xiàn)學(xué)生宿舍管理系統(tǒng)
Java+Swing實(shí)現(xiàn)學(xué)生選課管理系統(tǒng)
Java+Swing實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)
Java+Swing實(shí)現(xiàn)學(xué)校教材管理系統(tǒng)
Java+Swing實(shí)現(xiàn)學(xué)校教務(wù)管理系統(tǒng)
Java+Swing實(shí)現(xiàn)企業(yè)人事管理系統(tǒng)
Java+Swing實(shí)現(xiàn)電子相冊(cè)管理系統(tǒng)
Java+Swing實(shí)現(xiàn)超市管理系統(tǒng)-TXT存儲(chǔ)數(shù)據(jù)
Java+Swing實(shí)現(xiàn)自助取款機(jī)系統(tǒng)-TXT存儲(chǔ)數(shù)據(jù)
Java+Swing實(shí)現(xiàn)寵物商店管理系統(tǒng)-TXT存儲(chǔ)數(shù)據(jù)
Java+JSP系統(tǒng)系列實(shí)現(xiàn)
Java+JSP實(shí)現(xiàn)學(xué)生圖書管理系統(tǒng)
Java+JSP實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)
Java+JSP實(shí)現(xiàn)用戶信息管理系統(tǒng)
Java+JSP實(shí)現(xiàn)教師信息管理系統(tǒng)
Java+JSP實(shí)現(xiàn)學(xué)生宿舍管理系統(tǒng)
Java+JSP實(shí)現(xiàn)商品信息管理系統(tǒng)
Java+JSP實(shí)現(xiàn)寵物信息管理系統(tǒng)
Java+JSP實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)
Java+Servlet系統(tǒng)系列實(shí)現(xiàn)
Java+Servlet+JSP實(shí)現(xiàn)航空訂票系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)新聞發(fā)布系統(tǒng)
Java+Servlet+JSP學(xué)生宿舍管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)圖書管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)停車場(chǎng)管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)房屋租賃管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)學(xué)生選課管理系統(tǒng)
Java+Servlet+JSPl實(shí)現(xiàn)學(xué)生選課簽到系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)寵物診所管理系統(tǒng)
Java+Servlet+JSP實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)-1
Java+Servlet+JSP實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)-2
Java+SSM系統(tǒng)系列實(shí)現(xiàn)
Java+SSM+JSP實(shí)現(xiàn)網(wǎng)上考試系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)寵物商城系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)超市管理系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)藥品信息管理系統(tǒng)
Java+SSM+JSP實(shí)現(xiàn)汽車信息管理系統(tǒng)
Java+SSM+Jspl實(shí)現(xiàn)商品信息管理系統(tǒng)
Java+SSM+JSP+Maven實(shí)現(xiàn)網(wǎng)上書城系統(tǒng)
Java+SSM+JSP+Maven實(shí)現(xiàn)學(xué)校教務(wù)管理系統(tǒng)
Java+SSH系統(tǒng)系列實(shí)現(xiàn)
Java+SSH+JSP實(shí)現(xiàn)在線考試系統(tǒng)
Java+SSH+JSP實(shí)現(xiàn)醫(yī)院在線掛號(hào)系統(tǒng)
Java+Springboot系統(tǒng)系列實(shí)現(xiàn)
Java+Springboot+H-ui+Maven實(shí)現(xiàn)營銷管理系統(tǒng)
Java+Springboot+Bootstrap+Maven實(shí)現(xiàn)網(wǎng)上商城系統(tǒng)
Java+Springboot+Bootstrap+Maven實(shí)現(xiàn)景區(qū)旅游管理系統(tǒng)
1.更多JavaWeb系統(tǒng)請(qǐng)關(guān)注專欄。
https://blog.csdn.net/helongqiang/category_10020130.html
2.更多JavaSwing系統(tǒng)請(qǐng)關(guān)注專欄。
https://blog.csdn.net/helongqiang/category_6229101.html
2.源碼下載
sql在sql文件夾下面
系統(tǒng)賬號(hào)信息如下,此處是管理員權(quán)限
賬號(hào):admin 密碼:admin
下載地址:Java+Swing+Mysql實(shí)現(xiàn)超市管理系統(tǒng)
3.運(yùn)行項(xiàng)目
關(guān)注B站:水堅(jiān)石青
后期有更多干貨視頻推出!??!
Eclipse如何導(dǎo)入JavaSwing項(xiàng)目超詳細(xì)教程
4.備注
如有侵權(quán)請(qǐng)聯(lián)系我刪除。文章來源:http://www.zghlxwxcb.cn/news/detail-841198.html
5.支持博主
如果您覺得此文對(duì)您有幫助,請(qǐng)點(diǎn)贊加關(guān)注加收藏。祝您生活愉快!文章來源地址http://www.zghlxwxcb.cn/news/detail-841198.html
到了這里,關(guān)于Java+Swing+Mysql實(shí)現(xiàn)超市管理系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!