Skip to content

Commit 7459b7e

Browse files
committed
feat(13): Updated new files.
1 parent ed67ff8 commit 7459b7e

File tree

5 files changed

+82
-4
lines changed

5 files changed

+82
-4
lines changed

src/META-INF/equip-database.sql

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
create database equipments_management;
2+
3+
create table equipment_categories
4+
(
5+
category_id int identity
6+
primary key,
7+
category_name nvarchar(100) not null
8+
unique
9+
)
10+
go
11+
12+
create table equipments
13+
(
14+
equipment_id int identity
15+
primary key,
16+
equipment_name nvarchar(100) not null
17+
unique,
18+
equipment_color nvarchar(100) not null,
19+
equipment_created_date bigint not null,
20+
equipment_quantity int not null,
21+
equipment_category_id int
22+
references equipment_categories
23+
)
24+
go
25+
26+
create table roles
27+
(
28+
role_id int not null
29+
primary key,
30+
name varchar(100) not null
31+
unique
32+
)
33+
go
34+
35+
create table users
36+
(
37+
user_id varchar(100) not null
38+
primary key,
39+
password varchar(100) not null,
40+
fullname nvarchar(100) not null,
41+
email varchar(100) not null
42+
unique,
43+
phone varchar(100) not null,
44+
address varchar(200) not null,
45+
created_date bigint not null,
46+
is_activated bit not null,
47+
role_id int
48+
references roles,
49+
otp varchar(6) not null
50+
)
51+
go
52+
53+
create table equipments_request
54+
(
55+
equipments_request_id int identity
56+
primary key,
57+
requester varchar(100)
58+
references users,
59+
assignee varchar(100)
60+
references users,
61+
request_status varchar(100) not null,
62+
requested_date bigint not null,
63+
equipment_id int
64+
references equipments
65+
)
66+
go
67+
68+
create table equipments_request_history
69+
(
70+
equipments_request_history_id int identity
71+
primary key,
72+
equipments_request_id int
73+
references equipments_request
74+
)
75+
go

src/bangmaple/Main.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import bangmaple.dao.UsersDAO;
99
import bangmaple.dto.UsersDTO;
1010
import bangmaple.jdbc.dao.base.Store;
11+
import bangmaple.jdbc.paging.PageRequest;
12+
import bangmaple.jdbc.paging.Pageable;
1113
import bangmaple.jdbc.repository.JdbcRepository;
1214
import bangmaple.jdbc.utils.ConnectionManager;
1315

@@ -51,6 +53,10 @@ public static void main(String[] args) throws Exception {
5153
System.out.println(dao.count());
5254
dao.deleteAll();
5355
dao.deleteAllByIds(Arrays.asList("1", "2", "3", "4"));
56+
System.out.println(dao.findAll(PageRequest.of(1, 5)));
57+
System.out.println(dao.findAll(PageRequest.of(0, 4, Pageable.SORT_DESC)));
58+
System.out.println(dao.findAll(PageRequest.of(0, 4, Pageable.SORT_DESC, "username", "fullname")));
59+
System.out.println(dao.findAll(Pageable.SORT_DESC));
5460
}
5561

5662
}

src/bangmaple/dto/EquipmentsDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @author bangmaple
1515
*/
16-
@Table(name = "equipments", catalog = "LAB231_1")
16+
@Table(name = "equipments", catalog = "equipments_management")
1717
public class EquipmentsDTO {
1818

1919
@Id

src/bangmaple/jdbc/paging/PageRequest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package bangmaple.jdbc.paging;
22

33
import java.io.Serializable;
4-
import java.util.Arrays;
54

65
public class PageRequest extends AbstractPageRequest implements Serializable {
76

src/bangmaple/jdbc/paging/Pageable.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package bangmaple.jdbc.paging;
22

3-
import java.util.Optional;
4-
53
public interface Pageable {
64

75
boolean SORT_ASC = true;

0 commit comments

Comments
 (0)