公文流转系统

    一、首先写三个实体类。

1.用户登陆:

package com.official.bean;

public class Users {
private int id;
private String username;
private String password;
private int permissionId;
private int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String job;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPermissionId() {
return permissionId;
}
public void setPermissionId(int permissionId) {
this.permissionId = permissionId;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}

}

2.权限设置:

package com.official.bean;

public class Permission {
private int id;
private int permission;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPermission() {
return permission;
}
public void setPermission(int permission) {
this.permission = permission;
}
}

 

3.公文类:

package com.official.bean;

public class Doc {
private int id;
private String tipplace;
private String ftipplace;
private int deletestatus;
private int callback;
public int getCallback() {
return callback;
}
public void setCallback(int callback) {
this.callback = callback;
}
public int getDeletestatus() {
return deletestatus;
}
public void setDeletestatus(int deletestatus) {
this.deletestatus = deletestatus;
}
public String getFtipplace() {
return ftipplace;
}
public void setFtipplace(String ftipplace) {
this.ftipplace = ftipplace;
}
public String getTipplace() {
return tipplace;
}
public void setTipplace(String tipplace) {
this.tipplace = tipplace;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String title;
private String owner;
private String time;
private String receiver;
private int status;
private int result;
private String place;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public String getPlace() {
return place;
}
public void setPlace(St

ring place) {

this.place = place;
}
}

二、连接数据库

package com.official.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.official.bean.Doc;
import com.official.bean.Permission;
import com.official.bean.Users;


public class DBUtil {
//数据库URL和账号密码
private static final String connectionURL="jdbc:mysql://127.0.0.1:3306/doc_system?useUnicode=true&characterEncoding=GB18030&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true";
private static final String username="root";
private static final String password="root";

//数据库连接
public static Connection getConnection()
{
try {
Class.forName("com.mysql.cj.jdbc.Driver");
return DriverManager.getConnection(connectionURL,username,password);
} catch (Exception e) {
// TODO: handle exception
System.out.println("数据库连接失败");
e.printStackTrace();
return null;
}
}
public static void closeAll(Connection connection,PreparedStatement statement,ResultSet rSet)
{
try {
if(connection!=null)
connection.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}

try {
if(statement!=null)
statement.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}

try {
if(rSet!=null)
rSet.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
}

三、写主登陆界面

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>








登录



河北金力集团公文流转系统










 

 

你可能感兴趣的:(公文流转系统)