基于个人记账簿管理详细系统Word格式文档下载.docx

上传人:b****7 文档编号:22184126 上传时间:2023-02-02 格式:DOCX 页数:32 大小:168.80KB
下载 相关 举报
基于个人记账簿管理详细系统Word格式文档下载.docx_第1页
第1页 / 共32页
基于个人记账簿管理详细系统Word格式文档下载.docx_第2页
第2页 / 共32页
基于个人记账簿管理详细系统Word格式文档下载.docx_第3页
第3页 / 共32页
基于个人记账簿管理详细系统Word格式文档下载.docx_第4页
第4页 / 共32页
基于个人记账簿管理详细系统Word格式文档下载.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

基于个人记账簿管理详细系统Word格式文档下载.docx

《基于个人记账簿管理详细系统Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《基于个人记账簿管理详细系统Word格式文档下载.docx(32页珍藏版)》请在冰豆网上搜索。

基于个人记账簿管理详细系统Word格式文档下载.docx

图2系统层次方框图

4.2算法设计(活动图或时序图)

1.登录功能

图3登录功能时序图

2.注册功能

图4注册功能时序图

3.显示所有用户信息功能

图5显示所有用户信息功能时序图

4.添加用户信息功能

图6添加用户信息功能时序图

5.查询用户信息功能

图7查询用户信息功能时序图

5.数据设计

5.1类图设计

1.系统类图

5.1系统类图

2.数据库访问层

图8数据库访问层类图

3.数据封装类

图9数据封装类图

4.业务层

图10业务层类图

5.控制层

图11控制层类图

6.视图层

图12视图层类图

图13视图层类图

7.其它

图14其他类图

5.2数据表设计

login表

序号

字段名

类型

长度

备注

1

id

int

4

主键

2

account

char

20

唯一性、不为空

3

password

不为空

user表

name

50

money

double

默认

time

date

6.运行结果

1.注册

图15登录成功后的显示

2.密码和确认密码不一致

图16添加用户信息界面

3.登录

图17删除用户信息界面

4.添加

图18修改用户信息界面

5.删除

图19查询到用户信息的界面

6.修改

图20修改用户信息界面

7.查询

图21查询到用户信息的界面

8.没有查询到用户信息

图22没有查询到用户信息的界面

9.退出

图23退出系统界面

7.关键代码

(1)数据库访问类(DB.java)

packagecn.edu.ccut.util;

importjava.sql.*;

publicclassDB{

privateConnectioncon;

privatePreparedStatementpre;

privateResultSetrs;

privatestaticDBdb;

static{

try{

Class.forName("

com.mysql.jdbc.Driver"

);

}catch(ClassNotFoundExceptione){

e.printStackTrace();

}

privateDB(){}

publicstaticDBgetInstance(){

if(db==null){

db=newDB();

returndb;

privatevoidbuildConnection(){

con=DriverManager.getConnection("

jdbc:

mysql:

//localhost:

3306/user"

"

root"

123"

}catch(SQLExceptione){

publicResultSetexecuteQueryByParam(Stringsql,Object...o){

this.buildConnection();

pre=con.prepareStatement(sql);

for(inti=0;

i<

o.length;

i++){

pre.setObject(i+1,o[i]);

rs=pre.executeQuery();

returnrs;

publicResultSetexecuteQueryNoParam(Stringsql){

;

publicintexecuteUpdate(Stringsql,Object...o){

intcount=pre.executeUpdate();

returncount;

return0;

publicvoidclose(){

if(rs!

=null){

rs.close();

pre.close();

con.close();

}

(2)数据封装类

1.Login.java

packagecn.edu.ccut.po;

publicclassLogin{

privateStringusername;

privateStringpassword;

publicStringgetUsername(){

returnusername;

publicvoidsetUsername(Stringusername){

this.username=username;

publicStringgetPassword(){

returnpassword;

publicvoidsetPassword(Stringpassword){

this.password=password;

2.User.java

publicvoidsetPassword(Stringpassword){

(3)业务层

1、LoginService.java

packagecn.edu.ccut.service;

importcn.edu.ccut.po.Login;

importcn.edu.ccut.util.DB;

importjava.sql.ResultSet;

importjava.sql.SQLException;

publicclassLoginService{

privateDBdb;

privatestaticLoginServiceservice;

privateLoginService(){

db=DB.getInstance();

publicstaticLoginServicegetInstatnce(){

if(service==null){

service=newLoginService();

returnservice;

publicbooleanlogin(Loginlo){

Stringsql="

select*fromt_loginwhereusername=?

andpassword=?

"

ResultSetrs=db.executeQueryByParam(sql,lo.getUsername(),lo.getPassword());

if(rs.next()){

returntrue;

}finally{

db.close();

returnfalse;

publicbooleanregister(Loginlo){

insertintot_login(username,password)values(?

?

)"

intcount=db.executeUpdate(sql,lo.getUsername(),lo.getPassword());

if(count>

0){

}else{

2、UserService.java

importcn.edu.ccut.po.User;

importjavax.xml.transform.Result;

importjava.sql.Date;

importjava.util.ArrayList;

importjava.util.List;

publicclassUserService{

privatestaticUserServiceservice;

privateUserService(){

publicstaticUserServicegetInstance(){

if(service==null){

service=newUserService();

publicList<

User>

getAllUsers(){

select*fromt_user"

ResultSetrs=db.executeQueryNoParam(sql);

List<

users=null;

users=this.getList(rs);

}finally{

returnusers;

queryUsersByName(Stringname){

select*fromt_userwherenamelike?

ResultSetrs=db.executeQueryByParam(sql,"

%"

+name+"

users=null;

privateList<

getList(ResultSetrs)throwsSQLException{

users=newArrayList<

();

Useruser;

while(rs.next()){

user=newUser();

user.setId(rs.getInt

(1));

user.setName(rs.getString

(2));

user.setSex(rs.getInt(3));

user.setBirthday(rs.getDate(4));

users.add(user);

publicbooleaninsertOneUser(Stringname,intsex,Datebirthday){

insertintot_user(name,sex,birthday)values(?

intcount=db.executeUpdate(sql,name,sex,birthday);

if(count>

0){

}else{

publicbooleandeleteUserById(intid){

deletefromt_userwhereid=?

intcount=db.executeUpdate(sql,id);

if(count>

0){

publicbooleanupdateUser(intid,Stringname,intsex,Datebirthday){

updatet_usersetname=?

sex=?

birthday=?

whereid=?

intcount=db.executeUpdate(sql,name,sex,birthday,id);

}else{

publicUsergetUserById(intid){

select*fromt_userwhereid=?

ResultSetrs=db.executeQueryByParam(sql,id);

if(rs.next()){

Useruser=newUser();

user.setId(id);

returnuser;

returnnull;

(4)视图层

1.operation.java

packagecn.edu.ccut.view;

importcn.edu.ccut.service.UserService;

importjava.util.InputMismatchException;

publicinterfaceOperation{

voidoperation(UserServiceservice)throwsInputMismatchException;

2.AddView.java

importjava.text.ParseException;

importjava.text.SimpleDateFormat;

importjava.util.Date;

importjava.util.Scanner;

publicclassAddViewimplementsOperation{

@Override

publicvoidoperation(UserServiceservice)throwsInputMismatchException{

Scannerscan=newScanner(System.in);

while(true){

System.out.println("

pleaseinputname、sex、birthdaytoADD,ifreturninput0:

Stringname=scan.next();

if("

0"

.equals(name)){

break;

Stringsex0=scan.next();

intsex1=1;

if("

男"

.equals(sex0)){

sex1=0;

Stringbirthday0=scan.next();

SimpleDateFormatformat=newSimpleDateFormat("

yyyy-MM-dd"

Datebirthday=newDate();

birthday=format.parse(birthday0);

}catch(ParseExceptione){

booleanflag=service.insertOneUser(name,sex1,newjava.sql.Date(birthday.getTime()));

if(flag){

addsuccess~~~~~~"

//scan.close();

return;

addfailure,tryagain~~~~~~"

3.DeleteView.java

publicclassDeleteViewimplementsOperation{

pleaseinputuser'

idtoDELETE,ifreturninput0:

intid=scan.nextInt();

if(id==0){

booleanflag=service.deleteUserById(id);

deletesuccess~~~~~~"

deletefailure~~~~~~"

4.ModifyView.java

importcn.edu.cc

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 军事

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1