JavaSwing+MySQL College Student Competition Management System

Introduction to the article

Database Course Design Based on JavaSwing+MySQL

Extraction address: https://pan.baidu.com/s/1lRPtFszna7K_4CY2EkRoFg
Extraction code: h2p8
system administrator User: admin ; Password: 0;
Usage suggestion: Because no regular expression is written to check whether the content of each input box is legal, It is best to enter regular data and try not to repeat it;



foreword

As a sophomore, I wanted to use Swing to write a management system a long time ago. I happened to have a database course this semester. I started learning Java-related content from the first class, and finally wrote it when I was doing course design. It came out, although the process was quite laborious and the results were flawed, but it was enough to use it as a course design.


A screenshot of the project

  • login interface

insert image description here

  • Registration interface

insert image description here

  • Administrator main interface

insert image description here

  • Event management interface

insert image description here

  • Registration review interface

insert image description here

  • Member information management interface

insert image description here

  • Captain system interface

insert image description here
insert image description here

  • The captain creates the team and enters the player information to automatically assign the account password

insert image description here

  • Player interface
  • insert image description here

2. Introduction to Layer Composition


  -controller: control layer (where the program starts);
  -dao: database layer (methods for operating the database);
  -Image: image layer (all kinds of icons, background images);
  -util: tool layer (such as panel switching);
  - view: view layer (front-end interface);
insert image description here


2. Must-read for operation (must-see)

  • Development environment: Eclipse
  • Database: MySQL 8.0
  • Usage steps: 1. Import the sql file in the compressed package to the MySQL database;
              (if not, please refer to another article: https://blog.csdn.net/Elliseaon/article/details/118275142)
              2. Modify src/ Database username and password in the com/Demo/util/DBUtil.java file;
              3. Run Start.java in the src/com/Demo/controller path;
    insert image description here

3. Database Design


1. Demand analysis

insert image description here

2. Data sheet


  1. cp_competition table
CpName vachar(16)
RegisWay vachar(16)
Venue vachar(16)
RegisStart date
RegisEnd date
CpStart date
CpEnd date
Info date
  1. cp_team table
TeamNO vachar(10)
TeamName vachar(16)
Director vachar(16)
DirectorTEL vachar(11)
  1. cp_admin table
id int
name vachar(16)
password vachar(16)
createDate datetime
  1. cp_Captain table
TeamNO vachar(10)
CaptainName vachar(8)
Sno vachar(10)
Sex vachar(2)
Sage vachar(4)
Class vachar(16)
CaptainTel vachar(11)
CaptainUser vachar(16)
Password vachar(16)
  1. cp_Member table
TeamNO vachar(10)
MemberName vachar(8)
Sno vachar(10)
Sex vachar(2)
Sage vachar(4)
Class vachar(16)
CaptainTel vachar(11)
MemberUser vachar(16)
Password vachar(16)
  1. team_sign_up table
TeamNO vachar(10)
CpName vachar(16)
RsType vachar(10)
ChType vachar(2)
id int

3.DButil connect to the database


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 * 与数据库连接
 * @author
 *
 */
public class DbUtil {
    
    
	private String dbUrl="jdbc:mysql://localhost:3306/db_competition_system?useUnicode=true&characterEncoding=utf8"; // 数据库连接地址
	private String dbUserName="root"; // 用户名
	private String dbPassword="121805"; // 密码
	private String jdbcName="com.mysql.cj.jdbc.Driver"; // 驱动名称
	/**
	 * 获取数据库连接
	 * @return
	 * @throws Exception
	 */
	public Connection getCon(){
    
    
		try {
    
    
			Class.forName(jdbcName);
		} catch (ClassNotFoundException e) {
    
    
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Connection con = null;
		try {
    
    
			con = DriverManager.getConnection(dbUrl, dbUserName, dbPassword);
		} catch (SQLException e) {
    
    
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return con;
		
	}
	/**
	 * 关闭数据库连接
	 * @param con
	 * @throws Exception
	 */
	public void closeCon(Connection con)throws Exception{
    
    
		if(con!=null){
    
    
			con.close();
		}
	}
	
	public static void main(String[] args) {
    
    
		DbUtil dbUtil=new DbUtil();
		try {
    
    
			dbUtil.getCon();
			System.out.println("数据库连接成功!");
		} catch (Exception e) {
    
    
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("数据库连接失败");
		}
	}

}

Summarize

  • Implemented the basic operation of JDBC: add, delete, modify and check;
  • There is a dependency relationship in the data table, and the cascade operation of multiple tables can be realized through the front end;
  • It meets certain functional requirements, and it is absolutely no problem to use it as a course design, but if you want to be further practical, you need to modify it;
  • The above is purely personal opinion, please correct me if I am wrong;

Guess you like

Origin blog.csdn.net/Elliseaon/article/details/118273161