Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
优比特软件工作室
学生信息管理系统
提交
b6c8bf3e
学
学生信息管理系统
项目概览
优比特软件工作室
/
学生信息管理系统
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
学
学生信息管理系统
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b6c8bf3e
编写于
6月 07, 2023
作者:
小刘28
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:完成账号数据存储类的基本功能,系统初始化功能及添加超级管理员账号信息;
上级
c621cc9f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
86 addition
and
3 deletion
+86
-3
src/Main.java
src/Main.java
+26
-0
src/com/ubitgroup/data/AccountT.java
src/com/ubitgroup/data/AccountT.java
+60
-3
未找到文件。
src/Main.java
浏览文件 @
b6c8bf3e
import
com.ubitgroup.data.AccountT
;
import
com.ubitgroup.model.bean.Account
;
import
com.ubitgroup.view.LoginM.LoginV
;
import
com.ubitgroup.view.LoginM.LoginV
;
import
java.time.LocalDateTime
;
/*
/*
* 系统入口
* 系统入口
* */
* */
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
initSys
();
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
LoginV
loginV
=
new
LoginV
();
LoginV
loginV
=
new
LoginV
();
loginV
.
init
();
loginV
.
init
();
}
}
private
static
void
initSys
(){
System
.
out
.
println
(
"系统初始化中..."
);
Account
admin
=
new
Account
(
"1"
,
"admin"
,
"123456"
,
"1032584581@qq.com"
,
"0"
,
"0"
,
LocalDateTime
.
now
(),
LocalDateTime
.
now
());
AccountT
accountT
=
AccountT
.
getInstance
();
accountT
.
add
(
admin
);
//System.out.println(AccountT.getArrayList().get(0));
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
System
.
out
.
println
(
"系统初始化成功!"
);
}
}
}
src/com/ubitgroup/data/AccountT.java
浏览文件 @
b6c8bf3e
package
com.ubitgroup.data
;
package
com.ubitgroup.data
;
import
com.ubitgroup.model.bean.Account
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
/*
/*
...
@@ -7,7 +9,7 @@ import java.util.ArrayList;
...
@@ -7,7 +9,7 @@ import java.util.ArrayList;
* */
* */
public
class
AccountT
{
public
class
AccountT
{
private
static
final
AccountT
instance
=
new
AccountT
();
private
static
final
AccountT
instance
=
new
AccountT
();
private
static
ArrayList
arrayList
;
private
static
ArrayList
<
Account
>
arrayList
;
private
AccountT
(){
private
AccountT
(){
init
();
init
();
}
}
...
@@ -16,11 +18,66 @@ public class AccountT {
...
@@ -16,11 +18,66 @@ public class AccountT {
}
}
private
static
void
init
(){
private
static
void
init
(){
arrayList
=
new
ArrayList
();
arrayList
=
new
ArrayList
<>
();
}
}
public
static
ArrayList
getArrayList
(){
/*
* 获取全部数据
* */
public
static
ArrayList
<
Account
>
getArrayList
()
{
return
arrayList
;
return
arrayList
;
}
}
/*
* 查找元素在list中的索引
* */
public
Integer
getIndex
(
String
id
){
int
index
=
-
1
;
for
(
int
i
=
0
;
i
<
arrayList
.
size
();
i
++)
{
Account
account
=
arrayList
.
get
(
i
);
if
(
account
.
getId
().
equals
(
id
)){
index
=
i
;
break
;
}
}
return
index
;
}
/*
* 增加元素
* */
public
Boolean
add
(
Account
account
){
return
arrayList
.
add
(
account
);
}
/*
* 修改元素
* */
public
Boolean
set
(
Account
account
){
Integer
index
=
getIndex
(
account
.
getId
());
if
(
index
==
-
1
)
{
return
false
;
}
else
{
Account
oldAccount
=
arrayList
.
set
(
index
,
account
);
return
!
oldAccount
.
equals
(
account
);
}
}
/*
* 删除元素
* */
public
Integer
remove
(
Account
[]
accounts
){
Integer
count
=
0
;
for
(
Account
account
:
accounts
)
{
Integer
index
=
getIndex
(
account
.
getId
());
if
(
index
!=
-
1
)
{
boolean
flag
=
arrayList
.
remove
(
index
);
if
(
flag
)
{
count
++;
}
}
}
return
count
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录