This commit is contained in:
truettwo 2025-02-20 15:35:08 +03:00
parent 3787feee68
commit d209afb032
5 changed files with 35 additions and 93 deletions

27
pom.xml
View File

@ -57,20 +57,21 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.0.RELEASE</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.example.nto.App

View File

@ -1,28 +1,13 @@
spring:
datasource:
url: jdbc:h2:mem:testdb
url: jdbc:h2:mem:testdb # Укажи нужную базу (например, PostgreSQL)
username: sa
password:
driver-class-name: org.h2.Driver
h2:
console:
#enabled: false
enabled: true
liquibase:
change-log: classpath:/db/changelog/db.changelog-1.0.xml
jpa:
#generate-ddl: false
generate-ddl: true
hibernate:
#ddl-auto: none
ddl-auto: create-drop
# Показываем запросы
show-sql: true
# Своевременный запуск data.sql
defer-datasource-initialization: true
spring-doc:
swagger-ui:
path: /swagger-ui.html
operationsSorter: method
sql:
init:
mode:never

View File

@ -1,56 +0,0 @@
-- Создание таблицы employee
CREATE TABLE IF NOT EXISTS employee (
id INT PRIMARY KEY AUTO_INCREMENT,
login VARCHAR(255) UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
photo VARCHAR(255),
position VARCHAR(255),
last_visit TIMESTAMP,
password VARCHAR(255) NOT NULL, -- Зашифрованный пароль
role VARCHAR(50) NOT NULL,
status VARCHAR(20) DEFAULT 'works', -- Новый статус
last_entry_code BIGINT, -- Код последнего входа
entry_method VARCHAR(50) -- Метод входа (например, QR)
);
-- Вставка данных в таблицу employee
INSERT INTO employee (id, login, name, photo, position, last_visit, password, role, status, last_entry_code, entry_method)
VALUES
(1, 'pivanov', 'Иванов Петр Федорович',
'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg',
'Разработчик', '2024-02-12T08:30',
'$2a$10$LRykcZHYR0tb72biv9aqp./icK7ReK57gRFDd74kiF02ZoZqQtnEm',
'ADMIN', 'works', 1234567890123456789, 'QR'),
(2, 'ipetrov', 'Петров Иван Константинович',
'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg',
'Аналитик', '2024-02-13T08:35',
'$2a$10$rscyLIftEqucmDbSzBHZbO5DUOyICzkYXzQ4stJfbSN.Ao9R4kfQe',
'USER', 'works', NULL, NULL),
(3, 'asemenov', 'Семенов Анатолий Анатольевич',
'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg',
'Разработчик', '2024-02-13T08:31',
'$2a$10$o/g9lV7iDi.WhwztohTcfuIEhHHWUo5xlR0Vvdy2xaaI3RNwfbqzO',
'USER', 'works', NULL, NULL),
(4, 'afedorov', 'Федоров Александр Сергеевич',
'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg',
'Тестировщик', '2024-02-12T08:36',
'$2a$10$s33LR8PuMLQJQY85.zusceJVJLUn8mwEEwAsAUzQIaiwnjeKjt.km',
'USER', 'works', NULL, NULL);
-- Создание таблицы code
CREATE TABLE IF NOT EXISTS code (
value BIGINT PRIMARY KEY,
employee_id INT,
FOREIGN KEY (employee_id) REFERENCES employee(id) ON DELETE CASCADE
);
-- Вставка данных в таблицу code
INSERT INTO code (value, employee_id) VALUES
(1234567890123456789, 1),
(9223372036854775807, 2),
(1122334455667788990, 3),
(998877665544332211, 4),
(5566778899001122334, 1);

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<include file="db.changelog-1.0.xml"/>
</databaseChangeLog>