@@ -0,0 +1,34 @@ | |||
JAVA version : Openjdk 17 (jdk-17.0.2) | |||
For launch.json: | |||
{ | |||
// Use IntelliSense to learn about possible attributes. | |||
// Hover to view descriptions of existing attributes. | |||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |||
"version": "0.2.0", | |||
"configurations": [ | |||
{ | |||
"type": "java", | |||
"name": "FhsmsCApplication", | |||
"request": "launch", | |||
"mainClass": "com.ffii.fhsmsc.FhsmsCApplication", | |||
"projectName": "FhsmsC" | |||
}, | |||
{ | |||
"type": "java", | |||
"name": "Launch Local", | |||
"request": "launch", | |||
"mainClass": "com.ffii.fhsmsc.FhsmsCApplication", | |||
"console": "internalConsole", | |||
"projectName": "", | |||
"args": "--spring.profiles.active=db-local,local" | |||
} | |||
] | |||
} | |||
######################### | |||
For build war | |||
1. run .\gradlew clean build | |||
2. go to path: .\build\libs | |||
3. copy war to Tomcat server | |||
@@ -0,0 +1,11 @@ | |||
spring: | |||
datasource: | |||
jdbc-url: jdbc:mysql://192.168.1.228:3306/fhsmscdb?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8 | |||
username: root | |||
password: secret | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
springdoc: | |||
api-docs: | |||
path: /v3/api-docs | |||
enabled: true |
@@ -0,0 +1,10 @@ | |||
spring: | |||
datasource: | |||
jdbc-url: jdbc:mysql://127.0.0.1:3308/fhsmscdb?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8 | |||
username: root | |||
password: secret | |||
springdoc: | |||
api-docs: | |||
path: /v3/api-docs | |||
enabled: true |
@@ -0,0 +1,11 @@ | |||
spring: | |||
datasource: | |||
jdbc-url: jdbc:mysql://127.0.0.1:3306/fhsmscdb?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8 | |||
username: root | |||
password: secret | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
springdoc: | |||
api-docs: | |||
path: /v3/api-docs | |||
enabled: true |
@@ -0,0 +1,9 @@ | |||
spring: | |||
ldap: | |||
embedded: | |||
port: 8389 | |||
base-dn: dc=springframework,dc=org | |||
ldif: classpath:ldap-test-users.ldif | |||
validation: | |||
enabled: false | |||
urls: ldap://localhost:8389 |
@@ -0,0 +1,2 @@ | |||
host: | |||
url: http://localhost:3000 |
@@ -0,0 +1,2 @@ | |||
logging: | |||
config: 'classpath:log4j2-prod-linux.yml' |
@@ -0,0 +1,4 @@ | |||
server: | |||
port: 8087 | |||
logging: | |||
config: 'classpath:log4j2-prod-win.yml' |
@@ -0,0 +1,28 @@ | |||
server: | |||
servlet: | |||
contextPath: /api | |||
encoding: | |||
charset: UTF-8 | |||
enabled: true | |||
force: true | |||
port: 8090 | |||
error: | |||
include-message: always | |||
tomcat: | |||
connection-timeout: 300000 | |||
spring: | |||
servlet: | |||
multipart: | |||
max-file-size: 500MB | |||
max-request-size: 600MB | |||
jpa: | |||
hibernate: | |||
naming: | |||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl | |||
database-platform: org.hibernate.dialect.MySQL8Dialect | |||
properties: | |||
hibernate: | |||
dialect: | |||
storage_engine: innodb | |||
logging: | |||
config: 'classpath:log4j2.yml' |
@@ -0,0 +1 @@ | |||
C:\workspace\FHSMS-C-backend\src\main\java\com\ffii\fhsmsc\modules\Menu\req\fb_menuResponsity.java |
@@ -0,0 +1 @@ | |||
C:\workspace\FHSMS-C-backend\src\main\java\com\ffii\fhsmsc\modules\User_group\enity\UserGroupMembersRepository.java |
@@ -0,0 +1,385 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create table | |||
--comment: create table | |||
-- | |||
-- Table structure for table `audit_log` | |||
-- | |||
DROP TABLE IF EXISTS `audit_log`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `audit_log` ( | |||
`tableName` varchar(30) NOT NULL, | |||
`recordId` int NOT NULL, | |||
`recordName` varchar(500) DEFAULT NULL, | |||
`modifiedBy` int DEFAULT NULL, | |||
`modified` datetime DEFAULT NULL, | |||
`oldData` json DEFAULT NULL, | |||
`newData` json DEFAULT NULL, | |||
KEY `idx_tableName_recordId` (`tableName`,`recordId`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `audit_log` | |||
-- | |||
LOCK TABLES `audit_log` WRITE; | |||
/*!40000 ALTER TABLE `audit_log` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `audit_log` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `authority` | |||
-- | |||
DROP TABLE IF EXISTS `authority`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `authority` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`authority` varchar(255) NOT NULL, | |||
`name` varchar(100) NOT NULL, | |||
`module` varchar(50) DEFAULT NULL, | |||
`description` varchar(255) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `authority` (`authority`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `authority` | |||
-- | |||
LOCK TABLES `authority` WRITE; | |||
/*!40000 ALTER TABLE `authority` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `authority` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `file` | |||
-- | |||
DROP TABLE IF EXISTS `file`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `file` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`filename` varchar(255) NOT NULL, | |||
`skey` varchar(50) NOT NULL, | |||
`extension` varchar(10) DEFAULT NULL, | |||
`mimetype` varchar(100) DEFAULT NULL, | |||
`filesize` int DEFAULT NULL, | |||
`remarks` varchar(255) DEFAULT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `file` | |||
-- | |||
LOCK TABLES `file` WRITE; | |||
/*!40000 ALTER TABLE `file` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `file` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `file_blob` | |||
-- | |||
DROP TABLE IF EXISTS `file_blob`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `file_blob` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`fileId` int NOT NULL, | |||
`bytes` longblob NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `file_blob` | |||
-- | |||
LOCK TABLES `file_blob` WRITE; | |||
/*!40000 ALTER TABLE `file_blob` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `file_blob` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `file_ref` | |||
-- | |||
DROP TABLE IF EXISTS `file_ref`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `file_ref` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`fileId` int DEFAULT NULL, | |||
`refCode` varchar(50) DEFAULT NULL, | |||
`refId` int NOT NULL, | |||
`refType` varchar(50) NOT NULL, | |||
`remarks` varchar(255) DEFAULT NULL, | |||
`thumbnailFileId` int DEFAULT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `file_ref` | |||
-- | |||
LOCK TABLES `file_ref` WRITE; | |||
/*!40000 ALTER TABLE `file_ref` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `file_ref` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `group` | |||
-- | |||
DROP TABLE IF EXISTS `group`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `group` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`name` varchar(50) NOT NULL, | |||
`description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `name` (`name`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `group` | |||
-- | |||
LOCK TABLES `group` WRITE; | |||
/*!40000 ALTER TABLE `group` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `group` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `group_authority` | |||
-- | |||
DROP TABLE IF EXISTS `group_authority`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `group_authority` ( | |||
`groupId` int NOT NULL, | |||
`authId` int NOT NULL, | |||
PRIMARY KEY (`groupId`,`authId`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `group_authority` | |||
-- | |||
LOCK TABLES `group_authority` WRITE; | |||
/*!40000 ALTER TABLE `group_authority` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `group_authority` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `settings` | |||
-- | |||
DROP TABLE IF EXISTS `settings`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `settings` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`name` varchar(255) NOT NULL, | |||
`value` text NOT NULL, | |||
`category` varchar(50) DEFAULT NULL, | |||
`type` varchar(10) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
KEY `name_idx` (`name`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `settings` | |||
-- | |||
LOCK TABLES `settings` WRITE; | |||
/*!40000 ALTER TABLE `settings` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `settings` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `user` | |||
-- | |||
DROP TABLE IF EXISTS `user`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `user` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`username` varchar(30) NOT NULL, | |||
`password` varchar(60) DEFAULT NULL, | |||
`locked` tinyint(1) NOT NULL DEFAULT '0', | |||
`expiryDate` date DEFAULT NULL, | |||
`name` varchar(50) NOT NULL, | |||
`locale` varchar(5) DEFAULT NULL, | |||
`fullname` varchar(90) DEFAULT NULL, | |||
`firstname` varchar(45) DEFAULT NULL, | |||
`lastname` varchar(30) DEFAULT NULL, | |||
`title` varchar(60) DEFAULT NULL, | |||
`department` varchar(60) DEFAULT NULL, | |||
`email` varchar(120) DEFAULT NULL, | |||
`phone1` varchar(30) DEFAULT NULL, | |||
`phone2` varchar(30) DEFAULT NULL, | |||
`remarks` varchar(600) DEFAULT NULL, | |||
`post` varchar(50) DEFAULT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `user` | |||
-- | |||
LOCK TABLES `user` WRITE; | |||
/*!40000 ALTER TABLE `user` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `user` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `user_authority` | |||
-- | |||
DROP TABLE IF EXISTS `user_authority`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `user_authority` ( | |||
`userId` int NOT NULL, | |||
`authId` int NOT NULL, | |||
PRIMARY KEY (`userId`,`authId`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `user_authority` | |||
-- | |||
LOCK TABLES `user_authority` WRITE; | |||
/*!40000 ALTER TABLE `user_authority` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `user_authority` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `user_group` | |||
-- | |||
DROP TABLE IF EXISTS `user_group`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `user_group` ( | |||
`groupId` int NOT NULL, | |||
`userId` int NOT NULL, | |||
PRIMARY KEY (`groupId`,`userId`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `user_group` | |||
-- | |||
LOCK TABLES `user_group` WRITE; | |||
/*!40000 ALTER TABLE `user_group` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `user_group` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `user_login_log` | |||
-- | |||
DROP TABLE IF EXISTS `user_login_log`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `user_login_log` ( | |||
`username` varchar(32) NOT NULL, | |||
`loginTime` datetime NOT NULL, | |||
`ipAddr` varchar(45) NOT NULL, | |||
`success` tinyint(1) NOT NULL, | |||
PRIMARY KEY (`username`,`loginTime`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `user_login_log` | |||
-- | |||
LOCK TABLES `user_login_log` WRITE; | |||
/*!40000 ALTER TABLE `user_login_log` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `user_login_log` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `user_password_history` | |||
-- | |||
DROP TABLE IF EXISTS `user_password_history`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!50503 SET character_set_client = utf8mb4 */; | |||
CREATE TABLE `user_password_history` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`version` int NOT NULL DEFAULT '0', | |||
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modifiedBy` int DEFAULT NULL, | |||
`deleted` tinyint(1) NOT NULL DEFAULT '0', | |||
`userId` int NOT NULL, | |||
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`password` varchar(255) DEFAULT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
-- | |||
-- Dumping data for table `user_password_history` | |||
-- | |||
LOCK TABLES `user_password_history` WRITE; | |||
/*!40000 ALTER TABLE `user_password_history` DISABLE KEYS */; | |||
/*!40000 ALTER TABLE `user_password_history` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
@@ -0,0 +1,32 @@ | |||
--liquibase formatted sql | |||
--changeset terence:insert group authority | |||
--comment: insert group authority | |||
LOCK TABLES `authority` WRITE; | |||
/*!40000 ALTER TABLE `authority` DISABLE KEYS */; | |||
INSERT INTO `authority` VALUES (1,'MAINTAIN_USER_GROUP','Maintain User Group','System Administration','Allow to maintain user group'),(2,'MAINTAIN_USER','Maintain User','System Administration','Allow to maintain user'),(3,'VIEW_AUDIT_LOG','View Audit Log','System Administration','Allow to view audit log'),(4,'VIEW_LOGIN_LOG','View Login Log','System Administration','Allow to view login log'),(5,'MANAGE_PASSWORD_POLICY','Manage Password Policy','System Administration','Allow to manage password policy'),(6,'MANAGE_SYSTEM_CONFIGURATION','Manage System Configuration','System Administration','Allow to manage system configuration'); | |||
/*!40000 ALTER TABLE `authority` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `group` | |||
-- | |||
LOCK TABLES `group` WRITE; | |||
/*!40000 ALTER TABLE `group` DISABLE KEYS */; | |||
INSERT INTO `group` VALUES | |||
(1,NOW(),1,0,NOW(),1,0,'System Administrator','System Administrator Group') | |||
; | |||
/*!40000 ALTER TABLE `group` ENABLE KEYS */; | |||
UNLOCK TABLES; | |||
-- | |||
-- Table structure for table `group_authority` | |||
-- | |||
LOCK TABLES `group_authority` WRITE; | |||
/*!40000 ALTER TABLE `group_authority` DISABLE KEYS */; | |||
INSERT INTO `group_authority` VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6); | |||
/*!40000 ALTER TABLE `group_authority` ENABLE KEYS */; | |||
UNLOCK TABLES; |
@@ -0,0 +1,10 @@ | |||
--liquibase formatted sql | |||
--changeset terence:insert setting | |||
--comment: insert setting | |||
LOCK TABLES `settings` WRITE; | |||
/*!40000 ALTER TABLE `settings` DISABLE KEYS */; | |||
INSERT INTO `settings` VALUES (1,'SYS.idleLogoutTime','60','settings','integer'),(2,'MAIL.smtp.host','','settings','string'),(3,'MAIL.smtp.port','25','settings','integer'),(4,'MAIL.smtp.username','','settings','string'),(5,'MAIL.smtp.password','','settings','string'),(6,'MAIL.smtp.auth','','settings','boolean'),(7,'SYS.password.rule.length.min','10','passwordPolicy','integer'),(8,'SYS.password.rule.duration','180','passwordPolicy','integer'),(9,'SYS.password.rule.history','8','passwordPolicy','integer'),(10,'SYS.loginAttempt.limit','5','passwordPolicy','integer'),(11,'SYS.loginAttempt.penalityTime','5','passwordPolicy','integer'),(12,'SYS.password.rule.numberAndAlphabetic','true','passwordPolicy','boolean'),(13,'SYS.password.rule.specialCharacter','true','passwordPolicy','boolean'),(14,'SYS.password.rule.notContainUsername','true','passwordPolicy','boolean'),(15,'SYS.password.rule.notContainThreeConsecutiveCharacters','true','passwordPolicy','boolean'); | |||
/*!40000 ALTER TABLE `settings` ENABLE KEYS */; | |||
UNLOCK TABLES; |
@@ -0,0 +1,8 @@ | |||
--liquibase formatted sql | |||
--changeset terence:insert setting | |||
--comment: insert setting | |||
INSERT INTO `user` ( `id`, `created`, `createdBy`, `version`, `modified`, `modifiedBy`, `deleted`, `username`, `password`, `locked`, `expiryDate`, `name`, `locale`, `fullname`, `firstname`, `lastname`, `title`, `department`, `email`, `phone1`, `phone2`, `remarks`, `post` ) VALUES ( '1', NOW(), '1', '0', NOW(), '1', '0', '2fi', '$2a$10$cRJ.TOZPExg49qk.zmJlruW/Rj7X05vVMxD1CgAOOegZMsC1IPCFm', '0', NULL, '2fi', NULL, '2fi', NULL, NULL, NULL, NULL, '', '', NULL, NULL, '' ); | |||
INSERT INTO `user_group` (`groupId`, `userId`) VALUES ('1', '1'); |
@@ -0,0 +1,8 @@ | |||
--liquibase formatted sql | |||
--changeset terence:insert setting | |||
--comment: insert setting | |||
INSERT INTO `user` ( `id`, `created`, `createdBy`, `version`, `modified`, `modifiedBy`, `deleted`, `username`, `password`, `locked`, `expiryDate`, `name`, `locale`, `fullname`, `firstname`, `lastname`, `title`, `department`, `email`, `phone1`, `phone2`, `remarks`, `post` ) VALUES ( '2', NOW(), '2', '0', NOW(), '2', '0', '2fi2', '1234', '0', NULL, '2fi2', NULL, '2fi2', NULL, NULL, NULL, NULL, '', '', NULL, NULL, '' ); | |||
INSERT INTO `user_group` (`groupId`, `userId`) VALUES ('2', '2'); |
@@ -0,0 +1,54 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
-- Create table structure | |||
CREATE TABLE `food1` ( | |||
`id` int(11) NOT NULL, | |||
`name` varchar(100) NOT NULL, | |||
`kcal` decimal(10,2) DEFAULT NULL, | |||
`protein` decimal(10,2) NOT NULL DEFAULT 0.00, | |||
`fat` decimal(10,2) NOT NULL DEFAULT 0.00, | |||
`satFat` decimal(10,2) NOT NULL DEFAULT 0.00, | |||
`carbo` decimal(10,2) NOT NULL DEFAULT 0.00, | |||
`sodium` decimal(10,2) NOT NULL DEFAULT 0.00, | |||
`Ingredients` varchar(255) DEFAULT NULL, | |||
`food_type` varchar(255) DEFAULT NULL | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO `food1` (`id`, `name`, `kcal`, `protein`, `fat`, `satFat`, `carbo`, `sodium`, `Ingredients`, `food_type`) VALUES | |||
(1, 'Apple', 52.00, 0.00, 0.00, 0.00, 14.00, 0.00, NULL, 'fruit'), | |||
(2, 'Banana', 105.00, 1.30, 0.30, 0.10, 27.00, 1.00, NULL, 'fruit'), | |||
(3, 'Chicken breast', 165.00, 31.00, 6.10, 2.00, 1.00, 69.00, NULL, 'food'), | |||
(4, 'Brown rice', 216.00, 5.00, 3.00, 0.40, 45.00, 0.00, NULL, 'food'), | |||
(5, 'Yogurt', 148.00, 5.20, 6.10, 3.40, 10.00, 125.00, NULL, 'food'), | |||
(6, 'Egg', 78.00, 6.30, 5.60, 1.60, 0.40, 62.00, NULL, 'food'), | |||
(7, 'Avocado', 160.00, 2.00, 14.60, 2.00, 8.50, 7.00, NULL, 'fruit'), | |||
(8, 'Salmon', 206.00, 22.00, 13.60, 3.80, 5.00, 0.00, NULL, 'food'), | |||
(9, 'Spinach', 23.00, 2.70, 0.40, 0.10, 3.60, 79.00, NULL, 'vegetable'), | |||
(10, 'Carrot', 41.00, 0.90, 0.20, 0.00, 9.60, 69.00, NULL, 'vegetable'), | |||
(11, 'Broccoli', 34.00, 2.80, 0.60, 0.20, 6.60, 66.00, NULL, 'vegetable'), | |||
(12, 'Potato', 77.00, 2.00, 0.10, 0.00, 17.30, 10.00, NULL, 'vegetable'), | |||
(13, 'Sweet potato', 101.00, 1.60, 0.10, 0.00, 22.00, 3.00, NULL, 'vegetable'), | |||
(14, 'Onion', 40.00, 1.40, 0.10, 0.00, 9.30, 3.00, NULL, 'vegetable'), | |||
(15, 'Garlic', 140.00, 6.70, 15.40, 3.30, 6.20, 167.00, NULL, 'food'), | |||
(16, 'Tomato', 18.00, 0.90, 0.20, 0.00, 3.90, 5.00, NULL, 'vegetable'), | |||
(17, 'Cucumber', 16.00, 0.70, 0.10, 0.00, 3.80, 2.00, NULL, 'fruit'), | |||
(18, 'Lettuce', 8.00, 0.80, 0.20, 0.10, 1.70, 5.00, NULL, 'vegetable'), | |||
(19, 'Bread', 265.00, 9.40, 4.60, 1.30, 52.00, 150.00, NULL, 'food'), | |||
(20, 'Pasta', 131.00, 5.50, 1.00, 0.20, 26.00, 0.00, NULL, 'food'), | |||
(21, 'Cheese', 402.00, 20.60, 33.10, 23.20, 1.30, 0.00, NULL, 'food'), | |||
(22, 'Milk', 50.00, 3.30, 3.30, 1.70, 4.80, 120.00, NULL, 'drink'), | |||
(23, 'Beef', 250.00, 22.00, 21.00, 8.00, 0.00, 50.00, NULL, 'food'), | |||
(24, 'Pork', 241.00, 15.10, 19.70, 7.30, 0.00, 49.00, NULL, 'food'), | |||
(25, 'Lamb', 294.00, 17.50, 23.20, 9.20, 0.00, 0.00, NULL, 'food'), | |||
(26, 'Chicken thigh', 197.00, 27.00, 14.90, 5.20, 0.00, 0.00, NULL, 'food'); | |||
ALTER TABLE `food1` | |||
ADD PRIMARY KEY (`id`); | |||
ALTER TABLE `food1` | |||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; | |||
COMMIT; |
@@ -0,0 +1,19 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
-- Create table structure | |||
CREATE TABLE `food_items` ( | |||
`id` int(11) NOT NULL, | |||
`name` varchar(255) NOT NULL, | |||
`kcal` float DEFAULT NULL, | |||
`protein` float DEFAULT NULL, | |||
`fat` float DEFAULT NULL, | |||
`sat_fat` float DEFAULT NULL, | |||
`carbo` float DEFAULT NULL, | |||
`sodium` float DEFAULT NULL, | |||
`date` datetime DEFAULT NULL, | |||
`size` float DEFAULT NULL, | |||
`meal` varchar(50) DEFAULT NULL, | |||
`user_id` int(11) DEFAULT NULL | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,352 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Alter table and insert data | |||
INSERT INTO `food_items` (`id`, `name`, `kcal`, `protein`, `fat`, `sat_fat`, `carbo`, `sodium`, `date`, `size`, `meal`, `user_id`) VALUES | |||
(4, 'Banana', 105, 1.3, 0.3, 0.1, 27, 1, '2024-11-12 03:36:53', 100, 'breakfast', 1), | |||
(5, 'Banana', 105, 1.3, 0.3, 0.1, 27, 1, '2024-11-10 04:04:28', 100, 'breakfast', 2), | |||
(7, 'Banana', 9450, 117, 27, 9, 2430, 90, '2024-11-11 14:20:39', 9000, 'breakfast', 1), | |||
(16, 'Salmon', 206, 22, 13.6, 3.8, 5, 0, '2024-11-14 02:02:19', 100, 'Dinner', 1), | |||
(21, 'Pork', 180.8, 11.3, 14.8, 5.5, 0, 36.8, '2024-11-04 06:09:00', 75, 'Breakfast', 1), | |||
(22, 'Pork', 337.4, 21.1, 27.6, 10.2, 0, 68.6, '2024-11-04 13:06:00', 140, 'Lunch', 1), | |||
(23, 'Bread', 532.6, 18.9, 9.2, 2.6, 104.5, 301.5, '2024-11-04 17:28:00', 201, 'Dinner', 1), | |||
(24, 'Garlic', 436.8, 20.9, 48, 10.3, 19.3, 521, '2024-11-04 17:28:00', 312, 'Dinner', 1), | |||
(25, 'Bread', 1240.2, 44, 21.5, 6.1, 243.4, 702, '2024-11-05 06:40:00', 468, 'Breakfast', 1), | |||
(26, 'Cucumber', 26.4, 1.2, 0.2, 0, 6.3, 3.3, '2024-11-05 06:40:00', 165, 'Breakfast', 1), | |||
(27, 'Apple', 86.8, 0, 0, 0, 23.4, 0, '2024-11-05 12:35:00', 167, 'Lunch', 1), | |||
(28, 'Bread', 638.7, 22.7, 11.1, 3.1, 125.3, 361.5, '2024-11-05 12:35:00', 241, 'Lunch', 1), | |||
(29, 'Milk', 63.5, 4.2, 4.2, 2.2, 6.1, 152.4, '2024-11-05 17:36:00', 127, 'Dinner', 1), | |||
(30, 'Broccoli', 31.6, 2.6, 0.6, 0.2, 6.1, 61.4, '2024-11-06 08:02:00', 93, 'Breakfast', 1), | |||
(31, 'Potato', 184, 4.8, 0.2, 0, 41.3, 23.9, '2024-11-06 11:54:00', 239, 'Lunch', 1), | |||
(32, 'Brown rice', 395.3, 9.2, 5.5, 0.7, 82.4, 0, '2024-11-06 11:54:00', 183, 'Lunch', 1), | |||
(33, 'Yogurt', 130.2, 4.6, 5.4, 3, 8.8, 110, '2024-11-06 17:23:00', 88, 'Dinner', 1), | |||
(34, 'Milk', 235, 15.5, 15.5, 8, 22.6, 564, '2024-11-07 06:00:00', 470, 'Breakfast', 1), | |||
(35, 'Pasta', 279, 11.7, 2.1, 0.4, 55.4, 0, '2024-11-07 06:00:00', 213, 'Breakfast', 1), | |||
(36, 'Lamb', 385.1, 22.9, 30.4, 12.1, 0, 0, '2024-11-07 13:43:00', 131, 'Lunch', 1), | |||
(37, 'Yogurt', 497.3, 17.5, 20.5, 11.4, 33.6, 420, '2024-11-07 13:43:00', 336, 'Lunch', 1), | |||
(38, 'Egg', 122.5, 9.9, 8.8, 2.5, 0.6, 97.3, '2024-11-07 19:13:00', 157, 'Dinner', 1), | |||
(39, 'Carrot', 89, 2, 0.4, 0, 20.8, 149.7, '2024-11-07 19:13:00', 217, 'Dinner', 1), | |||
(40, 'Garlic', 680.4, 32.6, 74.8, 16, 30.1, 811.6, '2024-11-08 08:52:00', 486, 'Breakfast', 1), | |||
(41, 'Egg', 79.6, 6.4, 5.7, 1.6, 0.4, 63.2, '2024-11-08 08:52:00', 102, 'Breakfast', 1), | |||
(42, 'Potato', 63.9, 1.7, 0.1, 0, 14.4, 8.3, '2024-11-08 13:22:00', 83, 'Lunch', 1), | |||
(43, 'Salmon', 984.7, 105.2, 65, 18.2, 23.9, 0, '2024-11-08 19:18:00', 478, 'Dinner', 1), | |||
(44, 'Tomato', 86, 4.3, 1, 0, 18.6, 23.9, '2024-11-09 06:19:00', 478, 'Breakfast', 1), | |||
(45, 'Garlic', 518, 24.8, 57, 12.2, 22.9, 617.9, '2024-11-09 11:32:00', 370, 'Lunch', 1), | |||
(46, 'Beef', 907.5, 79.9, 76.2, 29, 0, 181.5, '2024-11-09 11:32:00', 363, 'Lunch', 1), | |||
(47, 'Beef', 517.5, 45.5, 43.5, 16.6, 0, 103.5, '2024-11-09 18:54:00', 207, 'Dinner', 1), | |||
(48, 'Brown rice', 658.8, 15.2, 9.1, 1.2, 137.2, 0, '2024-11-09 18:54:00', 305, 'Dinner', 1), | |||
(49, 'Egg', 69.4, 5.6, 5, 1.4, 0.4, 55.2, '2024-11-10 08:40:00', 89, 'Breakfast', 1), | |||
(50, 'Apple', 90, 0, 0, 0, 24.2, 0, '2024-11-10 11:17:00', 173, 'Lunch', 1), | |||
(51, 'Chicken breast', 227.7, 42.8, 8.4, 2.8, 0, 95.2, '2024-11-10 11:17:00', 138, 'Lunch', 1), | |||
(52, 'Brown rice', 561.6, 13, 7.8, 1, 117, 0, '2024-11-10 17:05:00', 260, 'Dinner', 1), | |||
(53, 'Spinach', 85.3, 10, 1.5, 0.4, 13.4, 293.1, '2024-11-04 08:47:00', 371, 'Breakfast', 2), | |||
(54, 'Potato', 224.8, 5.8, 0.3, 0, 50.5, 29.2, '2024-11-04 08:47:00', 292, 'Breakfast', 2), | |||
(55, 'Pork', 282, 17.7, 23, 8.5, 0, 57.3, '2024-11-04 13:48:00', 117, 'Lunch', 2), | |||
(56, 'Cheese', 695.5, 35.6, 57.3, 40.1, 2.2, 0, '2024-11-04 19:05:00', 173, 'Dinner', 2), | |||
(57, 'Cucumber', 16, 0.7, 0.1, 0, 3.8, 2, '2024-11-05 07:37:00', 100, 'Breakfast', 2), | |||
(58, 'Cheese', 1523.6, 78.1, 125.4, 87.9, 4.9, 0, '2024-11-05 07:37:00', 379, 'Breakfast', 2), | |||
(59, 'Chicken thigh', 374.3, 51.3, 28.3, 9.9, 0, 0, '2024-11-05 13:53:00', 190, 'Lunch', 2), | |||
(60, 'Chicken thigh', 439.3, 60.2, 33.2, 11.6, 0, 0, '2024-11-05 13:53:00', 223, 'Lunch', 2), | |||
(61, 'Garlic', 520.8, 24.9, 57.3, 12.3, 23.1, 621.2, '2024-11-05 18:09:00', 372, 'Dinner', 2), | |||
(62, 'Apple', 210.6, 0, 0, 0, 56.7, 0, '2024-11-05 18:09:00', 405, 'Dinner', 2), | |||
(63, 'Pasta', 191.3, 8, 1.5, 0.3, 38, 0, '2024-11-06 08:19:00', 146, 'Breakfast', 2), | |||
(64, 'Yogurt', 338.9, 11.9, 14, 7.8, 22.9, 286.2, '2024-11-06 13:41:00', 229, 'Lunch', 2), | |||
(65, 'Cucumber', 41.9, 1.8, 0.3, 0, 10, 5.2, '2024-11-06 13:41:00', 262, 'Lunch', 2), | |||
(66, 'Potato', 170.2, 4.4, 0.2, 0, 38.2, 22.1, '2024-11-06 17:15:00', 221, 'Dinner', 2), | |||
(67, 'Carrot', 125.5, 2.8, 0.6, 0, 29.4, 211.1, '2024-11-06 17:15:00', 306, 'Dinner', 2), | |||
(68, 'Chicken thigh', 496.4, 68, 37.5, 13.1, 0, 0, '2024-11-07 08:03:00', 252, 'Breakfast', 2), | |||
(69, 'Egg', 59.3, 4.8, 4.3, 1.2, 0.3, 47.1, '2024-11-07 08:03:00', 76, 'Breakfast', 2), | |||
(70, 'Onion', 117.2, 4.1, 0.3, 0, 27.2, 8.8, '2024-11-07 12:33:00', 293, 'Lunch', 2), | |||
(71, 'Pasta', 119.2, 5, 0.9, 0.2, 23.7, 0, '2024-11-07 12:33:00', 91, 'Lunch', 2), | |||
(72, 'Carrot', 81.2, 1.8, 0.4, 0, 19, 136.6, '2024-11-07 17:09:00', 198, 'Dinner', 2), | |||
(73, 'Spinach', 70.4, 8.3, 1.2, 0.3, 11, 241.7, '2024-11-08 07:29:00', 306, 'Breakfast', 2), | |||
(74, 'Bread', 1240.2, 44, 21.5, 6.1, 243.4, 702, '2024-11-08 07:29:00', 468, 'Breakfast', 2), | |||
(75, 'Apple', 225.7, 0, 0, 0, 60.8, 0, '2024-11-08 13:24:00', 434, 'Lunch', 2), | |||
(76, 'Garlic', 491.4, 23.5, 54.1, 11.6, 21.8, 586.2, '2024-11-08 13:24:00', 351, 'Lunch', 2), | |||
(77, 'Chicken breast', 183.2, 34.4, 6.8, 2.2, 0, 76.6, '2024-11-08 18:06:00', 111, 'Dinner', 2), | |||
(78, 'Banana', 487.2, 6, 1.4, 0.5, 125.3, 4.6, '2024-11-08 18:06:00', 464, 'Dinner', 2), | |||
(79, 'Tomato', 21.2, 1.1, 0.2, 0, 4.6, 5.9, '2024-11-09 06:11:00', 118, 'Breakfast', 2), | |||
(80, 'Spinach', 110.9, 13, 1.9, 0.5, 17.4, 380.8, '2024-11-09 06:11:00', 482, 'Breakfast', 2), | |||
(81, 'Cucumber', 68, 3, 0.4, 0, 16.1, 8.5, '2024-11-09 12:33:00', 425, 'Lunch', 2), | |||
(82, 'Chicken breast', 189.7, 35.6, 7, 2.3, 0, 79.3, '2024-11-09 17:53:00', 115, 'Dinner', 2), | |||
(83, 'Lamb', 1396.5, 83.1, 110.2, 43.7, 0, 0, '2024-11-10 08:16:00', 475, 'Breakfast', 2), | |||
(84, 'Lamb', 1437.7, 85.6, 113.4, 45, 0, 0, '2024-11-10 12:08:00', 489, 'Lunch', 2), | |||
(85, 'Bread', 561.8, 19.9, 9.8, 2.8, 110.2, 318, '2024-11-10 12:08:00', 212, 'Lunch', 2), | |||
(86, 'Chicken thigh', 478.7, 65.6, 36.2, 12.6, 0, 0, '2024-11-10 18:47:00', 243, 'Dinner', 2), | |||
(87, 'Apple', 43.2, 0, 0, 0, 11.6, 0, '2024-11-04 08:13:00', 83, 'Breakfast', 3), | |||
(88, 'Garlic', 109.2, 5.2, 12, 2.6, 4.8, 130.3, '2024-11-04 11:22:00', 78, 'Lunch', 3), | |||
(89, 'Broccoli', 158.8, 13.1, 2.8, 0.9, 30.8, 308.2, '2024-11-04 11:22:00', 467, 'Lunch', 3), | |||
(90, 'Milk', 200, 13.2, 13.2, 6.8, 19.2, 480, '2024-11-04 18:25:00', 400, 'Dinner', 3), | |||
(91, 'Cheese', 1290.4, 66.1, 106.3, 74.5, 4.2, 0, '2024-11-05 07:51:00', 321, 'Breakfast', 3), | |||
(92, 'Tomato', 71.6, 3.6, 0.8, 0, 15.5, 19.9, '2024-11-05 07:51:00', 398, 'Breakfast', 3), | |||
(93, 'Lamb', 308.7, 18.4, 24.4, 9.7, 0, 0, '2024-11-05 13:43:00', 105, 'Lunch', 3), | |||
(94, 'Yogurt', 464.7, 16.3, 19.2, 10.7, 31.4, 392.5, '2024-11-05 17:15:00', 314, 'Dinner', 3), | |||
(95, 'Lamb', 726.2, 43.2, 57.3, 22.7, 0, 0, '2024-11-06 08:12:00', 247, 'Breakfast', 3), | |||
(96, 'Beef', 607.5, 53.5, 51, 19.4, 0, 121.5, '2024-11-06 08:12:00', 243, 'Breakfast', 3), | |||
(97, 'Garlic', 427, 20.4, 47, 10.1, 18.9, 509.3, '2024-11-06 11:43:00', 305, 'Lunch', 3), | |||
(98, 'Salmon', 271.9, 29, 18, 5, 6.6, 0, '2024-11-06 19:18:00', 132, 'Dinner', 3), | |||
(99, 'Salmon', 366.7, 39.2, 24.2, 6.8, 8.9, 0, '2024-11-07 07:44:00', 178, 'Breakfast', 3), | |||
(100, 'Sweet potato', 404, 6.4, 0.4, 0, 88, 12, '2024-11-07 12:21:00', 400, 'Lunch', 3), | |||
(101, 'Sweet potato', 101, 1.6, 0.1, 0, 22, 3, '2024-11-07 18:45:00', 100, 'Dinner', 3), | |||
(102, 'Lettuce', 8.6, 0.9, 0.2, 0.1, 1.8, 5.4, '2024-11-08 08:42:00', 107, 'Breakfast', 3), | |||
(103, 'Garlic', 233.8, 11.2, 25.7, 5.5, 10.4, 278.9, '2024-11-08 08:42:00', 167, 'Breakfast', 3), | |||
(104, 'Milk', 207.5, 13.7, 13.7, 7.1, 19.9, 498, '2024-11-08 11:06:00', 415, 'Lunch', 3), | |||
(105, 'Cheese', 747.7, 38.3, 61.6, 43.2, 2.4, 0, '2024-11-08 11:06:00', 186, 'Lunch', 3), | |||
(106, 'Salmon', 828.1, 88.4, 54.7, 15.3, 20.1, 0, '2024-11-08 19:08:00', 402, 'Dinner', 3), | |||
(107, 'Yogurt', 216.1, 7.6, 8.9, 5, 14.6, 182.5, '2024-11-08 19:08:00', 146, 'Dinner', 3), | |||
(108, 'Bread', 816.2, 29, 14.2, 4, 160.2, 462, '2024-11-09 06:17:00', 308, 'Breakfast', 3), | |||
(109, 'Onion', 190.4, 6.7, 0.5, 0, 44.3, 14.3, '2024-11-09 13:04:00', 476, 'Lunch', 3), | |||
(110, 'Banana', 280.3, 3.5, 0.8, 0.3, 72.1, 2.7, '2024-11-09 13:04:00', 267, 'Lunch', 3), | |||
(111, 'Avocado', 574.4, 7.2, 52.4, 7.2, 30.5, 25.1, '2024-11-09 17:53:00', 359, 'Dinner', 3), | |||
(112, 'Carrot', 41.4, 0.9, 0.2, 0, 9.7, 69.7, '2024-11-10 06:57:00', 101, 'Breakfast', 3), | |||
(113, 'Cheese', 1093.4, 56, 90, 63.1, 3.5, 0, '2024-11-10 11:51:00', 272, 'Lunch', 3), | |||
(114, 'Pork', 253.1, 15.9, 20.7, 7.7, 0, 51.5, '2024-11-10 11:51:00', 105, 'Lunch', 3), | |||
(115, 'Lettuce', 8.6, 0.9, 0.2, 0.1, 1.8, 5.4, '2024-11-10 17:02:00', 108, 'Dinner', 3), | |||
(116, 'Milk', 98, 6.5, 6.5, 3.3, 9.4, 235.2, '2024-11-10 17:02:00', 196, 'Dinner', 3), | |||
(117, 'Cucumber', 69.3, 3, 0.4, 0, 16.5, 8.7, '2024-11-04 07:44:00', 433, 'Breakfast', 4), | |||
(118, 'Pasta', 482.1, 20.2, 3.7, 0.7, 95.7, 0, '2024-11-04 07:44:00', 368, 'Breakfast', 4), | |||
(119, 'Lamb', 358.7, 21.3, 28.3, 11.2, 0, 0, '2024-11-04 11:37:00', 122, 'Lunch', 4), | |||
(120, 'Pork', 257.9, 16.2, 21.1, 7.8, 0, 52.4, '2024-11-04 11:37:00', 107, 'Lunch', 4), | |||
(121, 'Banana', 269.8, 3.3, 0.8, 0.3, 69.4, 2.6, '2024-11-04 18:32:00', 257, 'Dinner', 4), | |||
(122, 'Tomato', 24.7, 1.2, 0.3, 0, 5.3, 6.9, '2024-11-04 18:32:00', 137, 'Dinner', 4), | |||
(123, 'Yogurt', 384.8, 13.5, 15.9, 8.8, 26, 325, '2024-11-05 06:05:00', 260, 'Breakfast', 4), | |||
(124, 'Yogurt', 380.4, 13.4, 15.7, 8.7, 25.7, 321.2, '2024-11-05 06:05:00', 257, 'Breakfast', 4), | |||
(125, 'Lettuce', 17, 1.7, 0.4, 0.2, 3.6, 10.6, '2024-11-05 12:17:00', 212, 'Lunch', 4), | |||
(126, 'Milk', 214, 14.1, 14.1, 7.3, 20.5, 513.6, '2024-11-05 12:17:00', 428, 'Lunch', 4), | |||
(127, 'Egg', 244.9, 19.8, 17.6, 5, 1.3, 194.7, '2024-11-05 17:57:00', 314, 'Dinner', 4), | |||
(128, 'Pork', 1185.7, 74.3, 96.9, 35.9, 0, 241.1, '2024-11-05 17:57:00', 492, 'Dinner', 4), | |||
(129, 'Yogurt', 519.5, 18.3, 21.4, 11.9, 35.1, 438.8, '2024-11-06 06:03:00', 351, 'Breakfast', 4), | |||
(130, 'Sweet potato', 502, 8, 0.5, 0, 109.3, 14.9, '2024-11-06 06:03:00', 497, 'Breakfast', 4), | |||
(131, 'Bread', 1017.6, 36.1, 17.7, 5, 199.7, 576, '2024-11-06 12:56:00', 384, 'Lunch', 4), | |||
(132, 'Lamb', 1237.7, 73.7, 97.7, 38.7, 0, 0, '2024-11-06 18:02:00', 421, 'Dinner', 4), | |||
(133, 'Avocado', 384, 4.8, 35, 4.8, 20.4, 16.8, '2024-11-07 07:48:00', 240, 'Breakfast', 4), | |||
(134, 'Milk', 103.5, 6.8, 6.8, 3.5, 9.9, 248.4, '2024-11-07 07:48:00', 207, 'Breakfast', 4), | |||
(135, 'Broccoli', 124.8, 10.3, 2.2, 0.7, 24.2, 242.2, '2024-11-07 13:38:00', 367, 'Lunch', 4), | |||
(136, 'Cheese', 932.6, 47.8, 76.8, 53.8, 3, 0, '2024-11-07 13:38:00', 232, 'Lunch', 4), | |||
(137, 'Lettuce', 19.2, 1.9, 0.5, 0.2, 4.1, 12, '2024-11-07 17:46:00', 240, 'Dinner', 4), | |||
(138, 'Lamb', 655.6, 39, 51.7, 20.5, 0, 0, '2024-11-07 17:46:00', 223, 'Dinner', 4), | |||
(139, 'Chicken thigh', 922, 126.4, 69.7, 24.3, 0, 0, '2024-11-08 06:52:00', 468, 'Breakfast', 4), | |||
(140, 'Chicken thigh', 165.5, 22.7, 12.5, 4.4, 0, 0, '2024-11-08 06:52:00', 84, 'Breakfast', 4), | |||
(141, 'Brown rice', 607, 14.1, 8.4, 1.1, 126.5, 0, '2024-11-08 11:38:00', 281, 'Lunch', 4), | |||
(142, 'Yogurt', 627.5, 22, 25.9, 14.4, 42.4, 530, '2024-11-08 18:25:00', 424, 'Dinner', 4), | |||
(143, 'Chicken breast', 94, 17.7, 3.5, 1.1, 0, 39.3, '2024-11-09 08:14:00', 57, 'Breakfast', 4), | |||
(144, 'Cucumber', 64.2, 2.8, 0.4, 0, 15.2, 8, '2024-11-09 11:24:00', 401, 'Lunch', 4), | |||
(145, 'Cucumber', 20.5, 0.9, 0.1, 0, 4.9, 2.6, '2024-11-09 19:34:00', 128, 'Dinner', 4), | |||
(146, 'Yogurt', 569.8, 20, 23.5, 13.1, 38.5, 481.2, '2024-11-09 19:34:00', 385, 'Dinner', 4), | |||
(147, 'Egg', 172.4, 13.9, 12.4, 3.5, 0.9, 137, '2024-11-10 06:41:00', 221, 'Breakfast', 4), | |||
(148, 'Milk', 218.5, 14.4, 14.4, 7.4, 21, 524.4, '2024-11-10 12:55:00', 437, 'Lunch', 4), | |||
(149, 'Brown rice', 712.8, 16.5, 9.9, 1.3, 148.5, 0, '2024-11-10 12:55:00', 330, 'Lunch', 4), | |||
(150, 'Garlic', 324.8, 15.5, 35.7, 7.7, 14.4, 387.4, '2024-11-10 18:24:00', 232, 'Dinner', 4), | |||
(151, 'Potato', 57.8, 1.5, 0.1, 0, 13, 7.5, '2024-11-10 18:24:00', 75, 'Dinner', 4), | |||
(152, 'Potato', 60.8, 1.6, 0.1, 0, 13.7, 7.9, '2024-11-04 07:23:00', 79, 'Breakfast', 5), | |||
(153, 'Tomato', 85, 4.2, 0.9, 0, 18.4, 23.6, '2024-11-04 07:23:00', 472, 'Breakfast', 5), | |||
(154, 'Sweet potato', 484.8, 7.7, 0.5, 0, 105.6, 14.4, '2024-11-04 11:51:00', 480, 'Lunch', 5), | |||
(155, 'Lamb', 820.3, 48.8, 64.7, 25.7, 0, 0, '2024-11-04 17:50:00', 279, 'Dinner', 5), | |||
(156, 'Pork', 301.2, 18.9, 24.6, 9.1, 0, 61.2, '2024-11-05 06:15:00', 125, 'Breakfast', 5), | |||
(157, 'Bread', 1057.4, 37.5, 18.4, 5.2, 207.5, 598.5, '2024-11-05 06:15:00', 399, 'Breakfast', 5), | |||
(158, 'Tomato', 85.9, 4.3, 1, 0, 18.6, 23.8, '2024-11-05 11:50:00', 477, 'Lunch', 5), | |||
(159, 'Pork', 819.4, 51.3, 67, 24.8, 0, 166.6, '2024-11-05 11:50:00', 340, 'Lunch', 5), | |||
(160, 'Egg', 48.4, 3.9, 3.5, 1, 0.2, 38.4, '2024-11-05 18:51:00', 62, 'Dinner', 5), | |||
(161, 'Cucumber', 58.1, 2.5, 0.4, 0, 13.8, 7.3, '2024-11-05 18:51:00', 363, 'Dinner', 5), | |||
(162, 'Garlic', 642.6, 30.8, 70.7, 15.1, 28.5, 766.5, '2024-11-06 08:26:00', 459, 'Breakfast', 5), | |||
(163, 'Lettuce', 11, 1.1, 0.3, 0.1, 2.3, 6.9, '2024-11-06 08:26:00', 137, 'Breakfast', 5), | |||
(164, 'Garlic', 253.4, 12.1, 27.9, 6, 11.2, 302.3, '2024-11-06 11:43:00', 181, 'Lunch', 5), | |||
(165, 'Yogurt', 389.2, 13.7, 16, 8.9, 26.3, 328.8, '2024-11-06 11:43:00', 263, 'Lunch', 5), | |||
(166, 'Beef', 1125, 99, 94.5, 36, 0, 225, '2024-11-06 18:56:00', 450, 'Dinner', 5), | |||
(167, 'Brown rice', 382.3, 8.8, 5.3, 0.7, 79.7, 0, '2024-11-07 07:09:00', 177, 'Breakfast', 5), | |||
(168, 'Avocado', 540.8, 6.8, 49.3, 6.8, 28.7, 23.7, '2024-11-07 13:16:00', 338, 'Lunch', 5), | |||
(169, 'Broccoli', 154.7, 12.7, 2.7, 0.9, 30, 300.3, '2024-11-07 13:16:00', 455, 'Lunch', 5), | |||
(170, 'Apple', 215.8, 0, 0, 0, 58.1, 0, '2024-11-07 18:54:00', 415, 'Dinner', 5), | |||
(171, 'Spinach', 50.1, 5.9, 0.9, 0.2, 7.8, 172.2, '2024-11-08 07:10:00', 218, 'Breakfast', 5), | |||
(172, 'Broccoli', 24.1, 2, 0.4, 0.1, 4.7, 46.9, '2024-11-08 11:41:00', 71, 'Lunch', 5), | |||
(173, 'Milk', 189.5, 12.5, 12.5, 6.4, 18.2, 454.8, '2024-11-08 17:13:00', 379, 'Dinner', 5), | |||
(174, 'Cheese', 1893.4, 97, 155.9, 109.3, 6.1, 0, '2024-11-08 17:13:00', 471, 'Dinner', 5), | |||
(175, 'Salmon', 253.4, 27.1, 16.7, 4.7, 6.2, 0, '2024-11-09 07:15:00', 123, 'Breakfast', 5), | |||
(176, 'Lettuce', 34.6, 3.5, 0.9, 0.4, 7.3, 21.6, '2024-11-09 07:15:00', 432, 'Breakfast', 5), | |||
(177, 'Lettuce', 7.4, 0.7, 0.2, 0.1, 1.6, 4.7, '2024-11-09 12:38:00', 93, 'Lunch', 5), | |||
(178, 'Spinach', 57.5, 6.8, 1, 0.2, 9, 197.5, '2024-11-09 12:38:00', 250, 'Lunch', 5), | |||
(179, 'Cucumber', 27, 1.2, 0.2, 0, 6.4, 3.4, '2024-11-09 17:59:00', 169, 'Dinner', 5), | |||
(180, 'Egg', 81.1, 6.6, 5.8, 1.7, 0.4, 64.5, '2024-11-09 17:59:00', 104, 'Dinner', 5), | |||
(181, 'Tomato', 45.9, 2.3, 0.5, 0, 9.9, 12.8, '2024-11-10 07:50:00', 255, 'Breakfast', 5), | |||
(182, 'Tomato', 81.9, 4.1, 0.9, 0, 17.7, 22.8, '2024-11-10 12:02:00', 455, 'Lunch', 5), | |||
(183, 'Salmon', 379, 40.5, 25, 7, 9.2, 0, '2024-11-10 18:02:00', 184, 'Dinner', 5), | |||
(184, 'Lamb', 308.7, 18.4, 24.4, 9.7, 0, 0, '2024-11-04 07:46:00', 105, 'Breakfast', 6), | |||
(185, 'Lamb', 787.9, 46.9, 62.2, 24.7, 0, 0, '2024-11-04 07:46:00', 268, 'Breakfast', 6), | |||
(186, 'Tomato', 76, 3.8, 0.8, 0, 16.5, 21.1, '2024-11-04 12:48:00', 422, 'Lunch', 6), | |||
(187, 'Potato', 370.4, 9.6, 0.5, 0, 83.2, 48.1, '2024-11-04 12:48:00', 481, 'Lunch', 6), | |||
(188, 'Lettuce', 21, 2.1, 0.5, 0.3, 4.5, 13.1, '2024-11-04 18:25:00', 263, 'Dinner', 6), | |||
(189, 'Avocado', 552, 6.9, 50.4, 6.9, 29.3, 24.2, '2024-11-05 06:11:00', 345, 'Breakfast', 6), | |||
(190, 'Carrot', 62.7, 1.4, 0.3, 0, 14.7, 105.6, '2024-11-05 11:02:00', 153, 'Lunch', 6), | |||
(191, 'Yogurt', 134.7, 4.7, 5.6, 3.1, 9.1, 113.8, '2024-11-05 11:02:00', 91, 'Lunch', 6), | |||
(192, 'Tomato', 78.8, 3.9, 0.9, 0, 17.1, 21.9, '2024-11-05 19:27:00', 438, 'Dinner', 6), | |||
(193, 'Beef', 340, 29.9, 28.6, 10.9, 0, 68, '2024-11-05 19:27:00', 136, 'Dinner', 6), | |||
(194, 'Onion', 108.4, 3.8, 0.3, 0, 25.2, 8.1, '2024-11-06 06:42:00', 271, 'Breakfast', 6), | |||
(195, 'Egg', 350.2, 28.3, 25.1, 7.2, 1.8, 278.4, '2024-11-06 13:46:00', 449, 'Lunch', 6), | |||
(196, 'Sweet potato', 494.9, 7.8, 0.5, 0, 107.8, 14.7, '2024-11-06 17:34:00', 490, 'Dinner', 6), | |||
(197, 'Tomato', 83.7, 4.2, 0.9, 0, 18.1, 23.2, '2024-11-06 17:34:00', 465, 'Dinner', 6), | |||
(198, 'Brown rice', 110.2, 2.5, 1.5, 0.2, 22.9, 0, '2024-11-07 06:48:00', 51, 'Breakfast', 6), | |||
(199, 'Pasta', 615.7, 25.9, 4.7, 0.9, 122.2, 0, '2024-11-07 06:48:00', 470, 'Breakfast', 6), | |||
(200, 'Potato', 150.2, 3.9, 0.2, 0, 33.7, 19.5, '2024-11-07 13:42:00', 195, 'Lunch', 6), | |||
(201, 'Brown rice', 708.5, 16.4, 9.8, 1.3, 147.6, 0, '2024-11-07 13:42:00', 328, 'Lunch', 6), | |||
(202, 'Lettuce', 25.9, 2.6, 0.6, 0.3, 5.5, 16.2, '2024-11-07 19:44:00', 324, 'Dinner', 6), | |||
(203, 'Brown rice', 490.3, 11.3, 6.8, 0.9, 102.2, 0, '2024-11-08 08:13:00', 227, 'Breakfast', 6), | |||
(204, 'Banana', 113.4, 1.4, 0.3, 0.1, 29.2, 1.1, '2024-11-08 08:13:00', 108, 'Breakfast', 6), | |||
(205, 'Banana', 300.3, 3.7, 0.9, 0.3, 77.2, 2.9, '2024-11-08 12:25:00', 286, 'Lunch', 6), | |||
(206, 'Pork', 848.3, 53.2, 69.3, 25.7, 0, 172.5, '2024-11-08 18:46:00', 352, 'Dinner', 6), | |||
(207, 'Cucumber', 75.5, 3.3, 0.5, 0, 17.9, 9.4, '2024-11-09 07:57:00', 472, 'Breakfast', 6), | |||
(208, 'Sweet potato', 361.6, 5.7, 0.4, 0, 78.8, 10.7, '2024-11-09 12:22:00', 358, 'Lunch', 6), | |||
(209, 'Lettuce', 8.3, 0.8, 0.2, 0.1, 1.8, 5.2, '2024-11-09 12:22:00', 104, 'Lunch', 6), | |||
(210, 'Pasta', 200.4, 8.4, 1.5, 0.3, 39.8, 0, '2024-11-09 17:26:00', 153, 'Dinner', 6), | |||
(211, 'Pasta', 117.9, 5, 0.9, 0.2, 23.4, 0, '2024-11-10 07:29:00', 90, 'Breakfast', 6), | |||
(212, 'Brown rice', 738.7, 17.1, 10.3, 1.4, 153.9, 0, '2024-11-10 07:29:00', 342, 'Breakfast', 6), | |||
(213, 'Onion', 55.6, 1.9, 0.1, 0, 12.9, 4.2, '2024-11-10 11:18:00', 139, 'Lunch', 6), | |||
(214, 'Potato', 338.8, 8.8, 0.4, 0, 76.1, 44, '2024-11-10 18:58:00', 440, 'Dinner', 6), | |||
(215, 'Bread', 339.2, 12, 5.9, 1.7, 66.6, 192, '2024-11-10 18:58:00', 128, 'Dinner', 6), | |||
(216, 'Carrot', 145.5, 3.2, 0.7, 0, 34.1, 244.9, '2024-11-04 06:16:00', 355, 'Breakfast', 7), | |||
(217, 'Bread', 667.8, 23.7, 11.6, 3.3, 131, 378, '2024-11-04 13:58:00', 252, 'Lunch', 7), | |||
(218, 'Tomato', 39.4, 2, 0.4, 0, 8.5, 10.9, '2024-11-04 13:58:00', 219, 'Lunch', 7), | |||
(219, 'Cheese', 1234.1, 63.2, 101.6, 71.2, 4, 0, '2024-11-04 18:34:00', 307, 'Dinner', 7), | |||
(220, 'Chicken thigh', 933.8, 128, 70.6, 24.6, 0, 0, '2024-11-04 18:34:00', 474, 'Dinner', 7), | |||
(221, 'Banana', 155.4, 1.9, 0.4, 0.1, 40, 1.5, '2024-11-05 07:24:00', 148, 'Breakfast', 7), | |||
(222, 'Yogurt', 464.7, 16.3, 19.2, 10.7, 31.4, 392.5, '2024-11-05 11:29:00', 314, 'Lunch', 7), | |||
(223, 'Beef', 367.5, 32.3, 30.9, 11.8, 0, 73.5, '2024-11-05 11:29:00', 147, 'Lunch', 7), | |||
(224, 'Yogurt', 122.8, 4.3, 5.1, 2.8, 8.3, 103.8, '2024-11-05 17:20:00', 83, 'Dinner', 7), | |||
(225, 'Apple', 144, 0, 0, 0, 38.8, 0, '2024-11-06 07:30:00', 277, 'Breakfast', 7), | |||
(226, 'Beef', 840, 73.9, 70.6, 26.9, 0, 168, '2024-11-06 07:30:00', 336, 'Breakfast', 7), | |||
(227, 'Garlic', 522.2, 25, 57.4, 12.3, 23.1, 622.9, '2024-11-06 12:35:00', 373, 'Lunch', 7), | |||
(228, 'Chicken thigh', 823.5, 112.9, 62.3, 21.7, 0, 0, '2024-11-06 12:35:00', 418, 'Lunch', 7), | |||
(229, 'Salmon', 115.4, 12.3, 7.6, 2.1, 2.8, 0, '2024-11-06 17:54:00', 56, 'Dinner', 7), | |||
(230, 'Tomato', 37.1, 1.9, 0.4, 0, 8, 10.3, '2024-11-07 06:25:00', 206, 'Breakfast', 7), | |||
(231, 'Avocado', 537.6, 6.7, 49.1, 6.7, 28.6, 23.5, '2024-11-07 12:48:00', 336, 'Lunch', 7), | |||
(232, 'Broccoli', 32, 2.6, 0.6, 0.2, 6.2, 62, '2024-11-07 12:48:00', 94, 'Lunch', 7), | |||
(233, 'Brown rice', 477.4, 11.1, 6.6, 0.9, 99.5, 0, '2024-11-07 17:31:00', 221, 'Dinner', 7), | |||
(234, 'Cucumber', 72.3, 3.2, 0.5, 0, 17.2, 9, '2024-11-08 07:09:00', 452, 'Breakfast', 7), | |||
(235, 'Garlic', 512.4, 24.5, 56.4, 12.1, 22.7, 611.2, '2024-11-08 11:58:00', 366, 'Lunch', 7), | |||
(236, 'Chicken thigh', 240.3, 32.9, 18.2, 6.3, 0, 0, '2024-11-08 11:58:00', 122, 'Lunch', 7), | |||
(237, 'Onion', 137.2, 4.8, 0.3, 0, 31.9, 10.3, '2024-11-08 19:26:00', 343, 'Dinner', 7), | |||
(238, 'Pork', 607.3, 38.1, 49.6, 18.4, 0, 123.5, '2024-11-08 19:26:00', 252, 'Dinner', 7), | |||
(239, 'Banana', 297.2, 3.7, 0.8, 0.3, 76.4, 2.8, '2024-11-09 07:33:00', 283, 'Breakfast', 7), | |||
(240, 'Chicken breast', 790.4, 148.5, 29.2, 9.6, 0, 330.5, '2024-11-09 07:33:00', 479, 'Breakfast', 7), | |||
(241, 'Lamb', 311.6, 18.6, 24.6, 9.8, 0, 0, '2024-11-09 13:15:00', 106, 'Lunch', 7), | |||
(242, 'Chicken thigh', 784.1, 107.5, 59.3, 20.7, 0, 0, '2024-11-09 13:15:00', 398, 'Lunch', 7), | |||
(243, 'Apple', 116, 0, 0, 0, 31.2, 0, '2024-11-09 18:17:00', 223, 'Dinner', 7), | |||
(244, 'Salmon', 945.5, 101, 62.4, 17.4, 22.9, 0, '2024-11-09 18:17:00', 459, 'Dinner', 7), | |||
(245, 'Banana', 498.8, 6.2, 1.4, 0.5, 128.2, 4.8, '2024-11-10 06:40:00', 475, 'Breakfast', 7), | |||
(246, 'Lamb', 1111.3, 66.1, 87.7, 34.8, 0, 0, '2024-11-10 11:17:00', 378, 'Lunch', 7), | |||
(247, 'Avocado', 475.2, 5.9, 43.4, 5.9, 25.2, 20.8, '2024-11-10 11:17:00', 297, 'Lunch', 7), | |||
(248, 'Banana', 183.8, 2.3, 0.5, 0.2, 47.2, 1.8, '2024-11-10 17:29:00', 175, 'Dinner', 7), | |||
(249, 'Onion', 119.6, 4.2, 0.3, 0, 27.8, 9, '2024-11-04 07:58:00', 299, 'Breakfast', 8), | |||
(250, 'Beef', 465, 40.9, 39.1, 14.9, 0, 93, '2024-11-04 13:10:00', 186, 'Lunch', 8), | |||
(251, 'Bread', 871.9, 30.9, 15.1, 4.3, 171.1, 493.5, '2024-11-04 19:57:00', 329, 'Dinner', 8), | |||
(252, 'Lamb', 884.9, 52.7, 69.8, 27.7, 0, 0, '2024-11-05 06:10:00', 301, 'Breakfast', 8), | |||
(253, 'Milk', 230, 15.2, 15.2, 7.8, 22.1, 552, '2024-11-05 06:10:00', 460, 'Breakfast', 8), | |||
(254, 'Lettuce', 35.8, 3.6, 0.9, 0.4, 7.6, 22.4, '2024-11-05 11:42:00', 448, 'Lunch', 8), | |||
(255, 'Salmon', 786.9, 84, 52, 14.5, 19.1, 0, '2024-11-05 11:42:00', 382, 'Lunch', 8), | |||
(256, 'Beef', 535, 47.1, 44.9, 17.1, 0, 107, '2024-11-05 19:16:00', 214, 'Dinner', 8), | |||
(257, 'Cucumber', 71.2, 3.1, 0.4, 0, 16.9, 8.9, '2024-11-06 08:21:00', 445, 'Breakfast', 8), | |||
(258, 'Chicken thigh', 396, 54.3, 29.9, 10.5, 0, 0, '2024-11-06 08:21:00', 201, 'Breakfast', 8), | |||
(259, 'Chicken breast', 513.1, 96.4, 19, 6.2, 0, 214.6, '2024-11-06 12:27:00', 311, 'Lunch', 8), | |||
(260, 'Sweet potato', 212.1, 3.4, 0.2, 0, 46.2, 6.3, '2024-11-06 18:02:00', 210, 'Dinner', 8), | |||
(261, 'Chicken thigh', 439.3, 60.2, 33.2, 11.6, 0, 0, '2024-11-06 18:02:00', 223, 'Dinner', 8), | |||
(262, 'Sweet potato', 211.1, 3.3, 0.2, 0, 46, 6.3, '2024-11-07 07:56:00', 209, 'Breakfast', 8), | |||
(263, 'Pasta', 94.3, 4, 0.7, 0.1, 18.7, 0, '2024-11-07 07:56:00', 72, 'Breakfast', 8), | |||
(264, 'Spinach', 74.5, 8.7, 1.3, 0.3, 11.7, 256, '2024-11-07 11:35:00', 324, 'Lunch', 8), | |||
(265, 'Chicken breast', 669.9, 125.9, 24.8, 8.1, 0, 280.1, '2024-11-07 18:49:00', 406, 'Dinner', 8), | |||
(266, 'Cheese', 888.4, 45.5, 73.2, 51.3, 2.9, 0, '2024-11-08 07:19:00', 221, 'Breakfast', 8), | |||
(267, 'Potato', 168.6, 4.4, 0.2, 0, 37.9, 21.9, '2024-11-08 07:19:00', 219, 'Breakfast', 8), | |||
(268, 'Banana', 203.7, 2.5, 0.6, 0.2, 52.4, 1.9, '2024-11-08 12:42:00', 194, 'Lunch', 8), | |||
(269, 'Yogurt', 284.2, 10, 11.7, 6.5, 19.2, 240, '2024-11-08 12:42:00', 192, 'Lunch', 8), | |||
(270, 'Sweet potato', 403, 6.4, 0.4, 0, 87.8, 12, '2024-11-08 18:37:00', 399, 'Dinner', 8), | |||
(271, 'Chicken breast', 785.4, 147.6, 29, 9.5, 0, 328.4, '2024-11-09 07:08:00', 476, 'Breakfast', 8), | |||
(272, 'Avocado', 612.8, 7.7, 55.9, 7.7, 32.6, 26.8, '2024-11-09 07:08:00', 383, 'Breakfast', 8), | |||
(273, 'Egg', 131, 10.6, 9.4, 2.7, 0.7, 104.2, '2024-11-09 12:47:00', 168, 'Lunch', 8), | |||
(274, 'Lettuce', 20.7, 2.1, 0.5, 0.3, 4.4, 12.9, '2024-11-09 12:47:00', 259, 'Lunch', 8), | |||
(275, 'Salmon', 222.5, 23.8, 14.7, 4.1, 5.4, 0, '2024-11-09 18:20:00', 108, 'Dinner', 8), | |||
(276, 'Spinach', 111.3, 13.1, 1.9, 0.5, 17.4, 382.4, '2024-11-10 06:56:00', 484, 'Breakfast', 8), | |||
(277, 'Garlic', 460.6, 22, 50.7, 10.9, 20.4, 549.4, '2024-11-10 11:47:00', 329, 'Lunch', 8), | |||
(278, 'Lamb', 643.9, 38.3, 50.8, 20.1, 0, 0, '2024-11-10 19:54:00', 219, 'Dinner', 8), | |||
(279, 'Beef', 1125, 99, 94.5, 36, 0, 225, '2024-11-10 19:54:00', 450, 'Dinner', 8), | |||
(280, 'Lamb', 929, 55.3, 73.3, 29.1, 0, 0, '2024-11-04 07:54:00', 316, 'Breakfast', 9), | |||
(281, 'Pork', 443.4, 27.8, 36.2, 13.4, 0, 90.2, '2024-11-04 12:05:00', 184, 'Lunch', 9), | |||
(282, 'Beef', 885, 77.9, 74.3, 28.3, 0, 177, '2024-11-04 12:05:00', 354, 'Lunch', 9), | |||
(283, 'Brown rice', 276.5, 6.4, 3.8, 0.5, 57.6, 0, '2024-11-04 18:57:00', 128, 'Dinner', 9), | |||
(284, 'Banana', 265.6, 3.3, 0.8, 0.3, 68.3, 2.5, '2024-11-04 18:57:00', 253, 'Dinner', 9), | |||
(285, 'Bread', 1298.5, 46.1, 22.5, 6.4, 254.8, 735, '2024-11-05 07:40:00', 490, 'Breakfast', 9), | |||
(286, 'Milk', 105, 6.9, 6.9, 3.6, 10.1, 252, '2024-11-05 07:40:00', 210, 'Breakfast', 9), | |||
(287, 'Pasta', 531.9, 22.3, 4.1, 0.8, 105.6, 0, '2024-11-05 12:21:00', 406, 'Lunch', 9), | |||
(288, 'Sweet potato', 169.7, 2.7, 0.2, 0, 37, 5, '2024-11-05 12:21:00', 168, 'Lunch', 9), | |||
(289, 'Onion', 198.8, 7, 0.5, 0, 46.2, 14.9, '2024-11-05 19:11:00', 497, 'Dinner', 9), | |||
(290, 'Avocado', 140.8, 1.8, 12.8, 1.8, 7.5, 6.2, '2024-11-05 19:11:00', 88, 'Dinner', 9), | |||
(291, 'Lamb', 423.4, 25.2, 33.4, 13.2, 0, 0, '2024-11-06 07:39:00', 144, 'Breakfast', 9), | |||
(292, 'Bread', 800.3, 28.4, 13.9, 3.9, 157, 453, '2024-11-06 13:54:00', 302, 'Lunch', 9), | |||
(293, 'Carrot', 37.3, 0.8, 0.2, 0, 8.7, 62.8, '2024-11-06 13:54:00', 91, 'Lunch', 9), | |||
(294, 'Broccoli', 49.3, 4.1, 0.9, 0.3, 9.6, 95.7, '2024-11-06 17:03:00', 145, 'Dinner', 9), | |||
(295, 'Carrot', 123.4, 2.7, 0.6, 0, 28.9, 207.7, '2024-11-06 17:03:00', 301, 'Dinner', 9), | |||
(296, 'Chicken thigh', 855, 117.2, 64.7, 22.6, 0, 0, '2024-11-07 08:12:00', 434, 'Breakfast', 9), | |||
(297, 'Chicken breast', 585.8, 110, 21.7, 7.1, 0, 244.9, '2024-11-07 08:12:00', 355, 'Breakfast', 9), | |||
(298, 'Salmon', 931.1, 99.4, 61.5, 17.2, 22.6, 0, '2024-11-07 12:45:00', 452, 'Lunch', 9), | |||
(299, 'Bread', 556.5, 19.7, 9.7, 2.7, 109.2, 315, '2024-11-07 12:45:00', 210, 'Lunch', 9), | |||
(300, 'Carrot', 96.8, 2.1, 0.5, 0, 22.7, 162.8, '2024-11-07 17:14:00', 236, 'Dinner', 9), | |||
(301, 'Chicken thigh', 382.2, 52.4, 28.9, 10.1, 0, 0, '2024-11-08 06:20:00', 194, 'Breakfast', 9), | |||
(302, 'Yogurt', 679.3, 23.9, 28, 15.6, 45.9, 573.8, '2024-11-08 06:20:00', 459, 'Breakfast', 9), | |||
(303, 'Lettuce', 23.2, 2.3, 0.6, 0.3, 4.9, 14.5, '2024-11-08 13:27:00', 290, 'Lunch', 9), | |||
(304, 'Lettuce', 28.4, 2.8, 0.7, 0.4, 6, 17.8, '2024-11-08 13:27:00', 355, 'Lunch', 9), | |||
(305, 'Spinach', 77.7, 9.1, 1.4, 0.3, 12.2, 267, '2024-11-08 19:43:00', 338, 'Dinner', 9), | |||
(306, 'Banana', 420, 5.2, 1.2, 0.4, 108, 4, '2024-11-09 06:39:00', 400, 'Breakfast', 9), | |||
(307, 'Banana', 475.7, 5.9, 1.4, 0.5, 122.3, 4.5, '2024-11-09 12:24:00', 453, 'Lunch', 9), | |||
(308, 'Beef', 1110, 97.7, 93.2, 35.5, 0, 222, '2024-11-09 17:23:00', 444, 'Dinner', 9), | |||
(309, 'Lettuce', 36.2, 3.6, 0.9, 0.5, 7.7, 22.6, '2024-11-09 17:23:00', 452, 'Dinner', 9), | |||
(310, 'Chicken thigh', 979.1, 134.2, 74.1, 25.8, 0, 0, '2024-11-10 07:24:00', 497, 'Breakfast', 9), | |||
(311, 'Broccoli', 154.7, 12.7, 2.7, 0.9, 30, 300.3, '2024-11-10 07:24:00', 455, 'Breakfast', 9), | |||
(312, 'Egg', 84.2, 6.8, 6, 1.7, 0.4, 67, '2024-11-10 12:42:00', 108, 'Lunch', 9), | |||
(313, 'Pork', 903.8, 56.6, 73.9, 27.4, 0, 183.8, '2024-11-10 17:50:00', 375, 'Dinner', 9), | |||
(314, 'Avocado', 348.8, 4.4, 31.8, 4.4, 18.5, 15.3, '2024-11-04 07:54:00', 218, 'Breakfast', 10), | |||
(315, 'Spinach', 87.9, 10.3, 1.5, 0.4, 13.8, 301.8, '2024-11-04 07:54:00', 382, 'Breakfast', 10), | |||
(316, 'Carrot', 203.4, 4.5, 1, 0, 47.6, 342.2, '2024-11-04 12:17:00', 496, 'Lunch', 10), | |||
(317, 'Cucumber', 47.8, 2.1, 0.3, 0, 11.4, 6, '2024-11-04 12:17:00', 299, 'Lunch', 10), | |||
(318, 'Yogurt', 217.6, 7.6, 9, 5, 14.7, 183.8, '2024-11-04 19:25:00', 147, 'Dinner', 10), | |||
(319, 'Avocado', 281.6, 3.5, 25.7, 3.5, 15, 12.3, '2024-11-04 19:25:00', 176, 'Dinner', 10), | |||
(320, 'Sweet potato', 168.7, 2.7, 0.2, 0, 36.7, 5, '2024-11-05 08:55:00', 167, 'Breakfast', 10), | |||
(321, 'Milk', 187, 12.3, 12.3, 6.4, 18, 448.8, '2024-11-05 13:51:00', 374, 'Lunch', 10), | |||
(322, 'Sweet potato', 95.9, 1.5, 0.1, 0, 20.9, 2.8, '2024-11-05 18:32:00', 95, 'Dinner', 10), | |||
(323, 'Salmon', 883.7, 94.4, 58.3, 16.3, 21.4, 0, '2024-11-06 06:57:00', 429, 'Breakfast', 10), | |||
(324, 'Yogurt', 125.8, 4.4, 5.2, 2.9, 8.5, 106.2, '2024-11-06 06:57:00', 85, 'Breakfast', 10), | |||
(325, 'Cheese', 1949.7, 99.9, 160.5, 112.5, 6.3, 0, '2024-11-06 11:31:00', 485, 'Lunch', 10), | |||
(326, 'Broccoli', 32, 2.6, 0.6, 0.2, 6.2, 62, '2024-11-06 11:31:00', 94, 'Lunch', 10), | |||
(327, 'Sweet potato', 99, 1.6, 0.1, 0, 21.6, 2.9, '2024-11-06 18:01:00', 98, 'Dinner', 10), | |||
(328, 'Broccoli', 133.3, 11, 2.4, 0.8, 25.9, 258.7, '2024-11-06 18:01:00', 392, 'Dinner', 10), | |||
(329, 'Pasta', 615.7, 25.9, 4.7, 0.9, 122.2, 0, '2024-11-07 06:30:00', 470, 'Breakfast', 10), | |||
(330, 'Banana', 113.4, 1.4, 0.3, 0.1, 29.2, 1.1, '2024-11-07 06:30:00', 108, 'Breakfast', 10), | |||
(331, 'Bread', 429.3, 15.2, 7.5, 2.1, 84.2, 243, '2024-11-07 11:27:00', 162, 'Lunch', 10), | |||
(332, 'Bread', 927.5, 32.9, 16.1, 4.5, 182, 525, '2024-11-07 11:27:00', 350, 'Lunch', 10), | |||
(333, 'Brown rice', 995.8, 23.1, 13.8, 1.8, 207.5, 0, '2024-11-07 19:52:00', 461, 'Dinner', 10), | |||
(334, 'Potato', 325.7, 8.5, 0.4, 0, 73.2, 42.3, '2024-11-08 06:05:00', 423, 'Breakfast', 10), | |||
(335, 'Egg', 43.7, 3.5, 3.1, 0.9, 0.2, 34.7, '2024-11-08 12:47:00', 56, 'Lunch', 10), | |||
(336, 'Potato', 139.4, 3.6, 0.2, 0, 31.3, 18.1, '2024-11-08 12:47:00', 181, 'Lunch', 10), | |||
(337, 'Yogurt', 722.2, 25.4, 29.8, 16.6, 48.8, 610, '2024-11-08 19:02:00', 488, 'Dinner', 10), | |||
(338, 'Egg', 373.6, 30.2, 26.8, 7.7, 1.9, 297, '2024-11-08 19:02:00', 479, 'Dinner', 10), | |||
(339, 'Pasta', 313.1, 13.1, 2.4, 0.5, 62.1, 0, '2024-11-09 06:07:00', 239, 'Breakfast', 10), | |||
(340, 'Egg', 213.7, 17.3, 15.3, 4.4, 1.1, 169.9, '2024-11-09 06:07:00', 274, 'Breakfast', 10), | |||
(341, 'Garlic', 254.8, 12.2, 28, 6, 11.3, 303.9, '2024-11-09 11:31:00', 182, 'Lunch', 10), | |||
(342, 'Sweet potato', 388.9, 6.2, 0.4, 0, 84.7, 11.6, '2024-11-09 11:31:00', 385, 'Lunch', 10), | |||
(343, 'Banana', 158.6, 2, 0.5, 0.2, 40.8, 1.5, '2024-11-09 19:46:00', 151, 'Dinner', 10), | |||
(344, 'Tomato', 15.7, 0.8, 0.2, 0, 3.4, 4.3, '2024-11-10 08:40:00', 87, 'Breakfast', 10), | |||
(345, 'Carrot', 44.7, 1, 0.2, 0, 10.5, 75.2, '2024-11-10 12:45:00', 109, 'Lunch', 10), | |||
(346, 'Sweet potato', 170.7, 2.7, 0.2, 0, 37.2, 5.1, '2024-11-10 19:16:00', 169, 'Dinner', 10), | |||
(347, 'Egg', 624, 50.4, 44.8, 12.8, 3.2, 496, '2024-11-14 08:57:54', 800, 'Breakfast', 11), | |||
(348, 'Spinach', 690, 81, 12, 3, 108, 2370, '2024-11-14 08:58:17', 3000, 'Dinner', 11), | |||
(349, 'Chicken breast', 1650, 310, 61, 20, 10, 690, '2024-11-28 11:05:49', 1000, 'Breakfast', 1), | |||
(350, 'Chicken breast', 1725.9, 324.26, 63.806, 20.92, 10.46, 721.74, '2024-11-28 15:04:46', 1046, 'Breakfast', 1); | |||
ALTER TABLE `food_items` | |||
ADD PRIMARY KEY (`id`), | |||
ADD KEY `user_id` (`user_id`); | |||
ALTER TABLE `food_items` | |||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=351; | |||
/* | |||
ALTER TABLE `food_items` | |||
ADD CONSTRAINT `food_items_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); | |||
*/ |
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food_items-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`food_items` | |||
add `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
add `createdBy` int DEFAULT NULL, | |||
add `version` int NOT NULL DEFAULT '0', | |||
add `modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
add `modifiedBy` int DEFAULT NULL, | |||
add `deleted` tinyint(1) NOT NULL DEFAULT '0'; |
@@ -0,0 +1,12 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food_items-table | |||
--comment: Alter table | |||
ALTER TABLE `food_items` | |||
CHANGE COLUMN `kcal` `kcal` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `protein` `protein` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `fat` `fat` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `sat_fat` `sat_fat` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `carbo` `carbo` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `sodium` `sodium` DECIMAL(14,2) NULL DEFAULT NULL , | |||
CHANGE COLUMN `size` `size` DECIMAL(14,2) NULL DEFAULT NULL ; |
@@ -0,0 +1,12 @@ | |||
--liquibase formatted sql | |||
--changeset cyril:alter food items | |||
--comment: alter food items | |||
ALTER TABLE `food_items` | |||
CHANGE COLUMN `created` `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `id`, | |||
CHANGE COLUMN `createdBy` `createdBy` INT NULL DEFAULT NULL AFTER `created`, | |||
CHANGE COLUMN `version` `version` INT NOT NULL DEFAULT '0' AFTER `createdBy`, | |||
CHANGE COLUMN `modified` `modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `version`, | |||
CHANGE COLUMN `modifiedBy` `modifiedBy` INT NULL DEFAULT NULL AFTER `modified`, | |||
CHANGE COLUMN `deleted` `deleted` TINYINT(1) NOT NULL DEFAULT '0' AFTER `modifiedBy`; |
@@ -0,0 +1,18 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
-- Create table structure | |||
CREATE TABLE `user_information` ( | |||
`id` int(11) NOT NULL, | |||
`user_id` int(11) NOT NULL, | |||
`gender` varchar(10) DEFAULT NULL, | |||
`name` varchar(50) DEFAULT NULL, | |||
`date_of_birth` date DEFAULT NULL, | |||
`height` varchar(20) DEFAULT NULL, | |||
`weight` varchar(20) DEFAULT NULL, | |||
`allergy` varchar(50) DEFAULT NULL, | |||
`goal` varchar(20) DEFAULT NULL, | |||
`experience` varchar(20) DEFAULT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT current_timestamp() | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,20 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Alter table and insert data | |||
INSERT INTO `user_information` (`id`, `user_id`, `gender`, `name`, `date_of_birth`, `height`, `weight`, `allergy`, `goal`, `experience`, `created_at`) VALUES | |||
(2, 1, 'Male', 'test', '2000-01-01', '175 cm', '61 kg', 'Peanuts', 'Muscle Gain', 'Expert', '2024-11-13 09:23:46'), | |||
(3, 3, 'Male', 'm2', '2003-01-01', '162 cm', '80 kg', 'Egg', 'Muscle Gain', 'Intermediate', '2024-11-13 17:18:38'), | |||
(4, 2, 'Male', 'm1', '2000-01-01', '162 cm', '53 kg', 'Fish', 'Muscle Gain', 'Expert', '2024-11-13 17:25:06'), | |||
(5, 4, 'Male', 'm3', '2018-01-01', '164 cm', '125 lbs', 'Fish, Peanuts, Wheat', 'Muscle Gain', 'Intermediate', '2024-11-13 17:28:51'), | |||
(6, 5, 'Male', 'm4', '2008-12-15', '169 cm', '108 kg', 'Peanuts, Fish', 'Nutrition', 'Beginner', '2024-11-13 17:32:53'), | |||
(7, 6, 'Female', 'g1', '2015-01-01', '158 cm', '46 kg', 'Egg, Fish, Peanuts, Wheat, Soy, Milk', 'Muscle Gain', 'Expert', '2024-11-13 17:35:00'), | |||
(8, 10, 'Female', 'g5', '1992-05-01', '213 cm', '140 kg', 'None', 'Muscle Gain', 'Beginner', '2024-11-13 17:37:00'), | |||
(9, 9, 'Female', 'g4', '1989-01-01', '4 ft 11 in', '54 kg', 'Wheat', 'Nutrition', 'Beginner', '2024-11-13 17:37:25'), | |||
(10, 8, 'Female', 'g3', '2006-06-03', '6 ft 4 in', '89 lbs', 'Egg', 'Diet', 'Intermediate', '2024-11-13 17:38:21'), | |||
(11, 7, 'Female', 'g2', '2000-01-01', '170 cm', '60 kg', 'None', 'Diet', 'Beginner', '2024-11-13 17:38:46'), | |||
(12, 11, 'Male', 'example', '2022-07-01', '171 cm', '54 kg', 'Peanuts, Wheat', 'Diet', 'Intermediate', '2024-11-14 08:58:59'); | |||
ALTER TABLE `user_information` | |||
ADD PRIMARY KEY (`id`), | |||
ADD KEY `user_id` (`user_id`); |
@@ -0,0 +1,6 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user-table | |||
--comment: Alter table | |||
ALTER TABLE `fhsmscdb`.`user` | |||
ADD `has_information` TINYINT NOT NULL DEFAULT 0; |
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
add `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
add `createdBy` int DEFAULT NULL, | |||
add `version` int NOT NULL DEFAULT '0', | |||
add `modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
add `modifiedBy` int DEFAULT NULL, | |||
add `deleted` tinyint(1) NOT NULL DEFAULT '0'; |
@@ -0,0 +1,6 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
DROP COLUMN `created_at`; |
@@ -0,0 +1,6 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; |
@@ -0,0 +1,7 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
MODIFY `age` int DEFAULT NULL, | |||
add `activityLevel` varchar(20) DEFAULT NULL; |
@@ -0,0 +1,6 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
MODIFY `activityLevel` varchar(20) DEFAULT NULL; |
@@ -0,0 +1,7 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-user_information-table | |||
--comment: Alter table | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
MODIFY COLUMN `age` int DEFAULT NULL AFTER `gender`, | |||
MODIFY COLUMN `activityLevel` varchar(20) DEFAULT NULL AFTER `experience`; |
@@ -0,0 +1,25 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food1-table | |||
--comment: Alter table | |||
-- 添加新列 | |||
Alter TABLE `fhsmscdb`.`food1` | |||
ADD COLUMN `Weight (g)` decimal(10,2) DEFAULT NULL, | |||
ADD COLUMN `contains_egg` tinyint DEFAULT 3, -- 0:●(使用) 1:○(油) 2:▲(接触) 3:×(未使用) | |||
ADD COLUMN `contains_milk` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_wheat` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_shrimp` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_crab` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_buckwheat` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_peanut` tinyint DEFAULT 3, | |||
ADD COLUMN `contains_walnut` tinyint DEFAULT 3; | |||
-- 重命名现有列以添加单位 | |||
ALTER TABLE `fhsmscdb`.`food1` | |||
CHANGE COLUMN `kcal` `Calories (kcal)` decimal(10,2), | |||
CHANGE COLUMN `protein` `Protein (g)` decimal(10,2), | |||
CHANGE COLUMN `fat` `Fat (g)` decimal(10,2), | |||
DROP COLUMN `satFat`, | |||
CHANGE COLUMN `carbo` `Carbohydrate (g)` decimal(10,2), | |||
CHANGE COLUMN `sodium` `Sodium (mg)` decimal(10,2); | |||
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food_items-table | |||
--comment: Alter table | |||
-- 重命名现有列以添加单位 | |||
ALTER TABLE `fhsmscdb`.`food_items` | |||
DROP COLUMN `sat_fat`; | |||
@@ -0,0 +1,16 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food1-table | |||
--comment: Alter table | |||
-- 添加新列 | |||
Alter TABLE `fhsmscdb`.`food1` | |||
ADD COLUMN `Postassium (mg)` decimal(10,2) DEFAULT 0, -- 0:●(使用) 1:○(油) 2:▲(接触) 3:×(未使用) | |||
ADD COLUMN `Calcium (mg)`decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Phosphorus (mg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Iron (mg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Vitamin A (μg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Vitamin B1 (mg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Vitamin B2 (mg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Niacin (mg)` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `Vitamin C (mg)` decimal(10,2) DEFAULT 0; | |||
@@ -0,0 +1,17 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food1-table | |||
--comment: Alter table | |||
-- 添加新列 | |||
Alter TABLE `fhsmscdb`.`food1` | |||
DROP COLUMN `Ingredients`; | |||
ALTER TABLE `fhsmscdb`.`food1` | |||
MODIFY COLUMN `Postassium (mg)` decimal(10,2) DEFAULT 0 AFTER `Sodium (mg)`, | |||
MODIFY COLUMN `Calcium (mg)` decimal(10,2) DEFAULT 0 AFTER `Postassium (mg)`, | |||
MODIFY COLUMN `Phosphorus (mg)` decimal(10,2) DEFAULT 0 AFTER `Calcium (mg)`, | |||
MODIFY COLUMN `Iron (mg)` decimal(10,2) DEFAULT 0 AFTER `Phosphorus (mg)`, | |||
MODIFY COLUMN `Vitamin A (μg)` decimal(10,2) DEFAULT 0 AFTER `Iron (mg)`, | |||
MODIFY COLUMN `Vitamin B1 (mg)` decimal(10,2) DEFAULT 0 AFTER `Vitamin A (μg)`, | |||
MODIFY COLUMN `Vitamin B2 (mg)` decimal(10,2) DEFAULT 0 AFTER `Vitamin B1 (mg)`, | |||
MODIFY COLUMN `Niacin (mg)` decimal(10,2) DEFAULT 0 AFTER `Vitamin B2 (mg)`, | |||
MODIFY COLUMN `Vitamin C (mg)` decimal(10,2)DEFAULT 0 AFTER `Niacin (mg)`; |
@@ -0,0 +1,27 @@ | |||
--liquibase formatted sql | |||
--changeset terence:alter-food_items-table | |||
--comment: Alter table | |||
-- 添加新列 | |||
/* | |||
Alter TABLE `fhsmscdb`.`food_items` | |||
ADD COLUMN `potassium` decimal(10,2) DEFAULT 0, -- 0:●(使用) 1:○(油) 2:▲(接触) 3:×(未使用) | |||
ADD COLUMN `calcium`decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `phosphorus` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `iron` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `vitaminA` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `vitaminB1` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `vitaminB2` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `niacin` decimal(10,2) DEFAULT 0, | |||
ADD COLUMN `vitaminC` decimal(10,2) DEFAULT 0; | |||
*/ | |||
ALTER TABLE `fhsmscdb`.`food_items` | |||
MODIFY COLUMN `potassium` decimal(10,2) DEFAULT 0 AFTER `sodium`, | |||
MODIFY COLUMN `calcium` decimal(10,2) DEFAULT 0 AFTER `potassium`, | |||
MODIFY COLUMN `phosphorus` decimal(10,2) DEFAULT 0 AFTER `calcium`, | |||
MODIFY COLUMN `iron` decimal(10,2) DEFAULT 0 AFTER `phosphorus`, | |||
MODIFY COLUMN `vitaminA` decimal(10,2) DEFAULT 0 AFTER `iron`, | |||
MODIFY COLUMN `vitaminB1` decimal(10,2) DEFAULT 0 AFTER `vitaminA`, | |||
MODIFY COLUMN `vitaminB2` decimal(10,2) DEFAULT 0 AFTER `vitaminB1`, | |||
MODIFY COLUMN `niacin` decimal(10,2) DEFAULT 0 AFTER `vitaminB2`, | |||
MODIFY COLUMN `vitaminC` decimal(10,2)DEFAULT 0 AFTER `niacin`; |
@@ -0,0 +1,40 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
CREATE TABLE `Nutrients` ( | |||
`nutrient_id` int NOT NULL AUTO_INCREMENT, | |||
`nutrient_name` varchar(50) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`nutrient_id`), | |||
UNIQUE KEY `idx_nutrient_name` (`nutrient_name`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
CREATE TABLE `Nutrient_Impacts` ( | |||
`impact_id` int NOT NULL AUTO_INCREMENT, | |||
`nutrient_id` int NOT NULL, | |||
`organ_affected` varchar(100) NOT NULL, | |||
`impact_type` ENUM('Positive', 'Negative') NOT NULL, | |||
`impact_description` text NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`impact_id`), | |||
FOREIGN KEY (`nutrient_id`) REFERENCES `Nutrients`(`nutrient_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 插入基础营养素数据 | |||
INSERT INTO `Nutrients` (nutrient_name) VALUES | |||
('Calories'), | |||
('Protein'), | |||
('Fat'), | |||
('Carbohydrate'), | |||
('Sodium'), | |||
('Potassium'), | |||
('Calcium'), | |||
('Phosphorus'), | |||
('Iron'), | |||
('Vitamin A'), | |||
('Vitamin B1'), | |||
('Vitamin B2'), | |||
('Niacin'), | |||
('Vitamin C'); |
@@ -0,0 +1,26 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
INSERT INTO `Nutrient_Impacts` | |||
(nutrient_id, organ_affected, impact_type, impact_description) | |||
VALUES | |||
(2, 'Muscles', 'Positive', 'Essential for muscle growth and repair'), | |||
(2, 'Bones', 'Positive', 'Helps maintain bone mass'), | |||
(2, 'Immune System', 'Positive', 'Supports immune system function'), | |||
-- Vitamin C impacts (假设 nutrient_id = 14) | |||
(14, 'Immune System', 'Positive', 'Strengthens immune system and fights infections'), | |||
(14, 'Skin', 'Positive', 'Promotes collagen production for healthy skin'), | |||
(14, 'Blood Vessels', 'Positive', 'Supports blood vessel health'), | |||
-- Iron impacts (假设 nutrient_id = 9) | |||
(9, 'Blood', 'Positive', 'Essential for red blood cell production'), | |||
(9, 'Brain', 'Positive', 'Supports cognitive function'), | |||
(9, 'Immune System', 'Positive', 'Helps maintain immune system'), | |||
-- Calcium impacts (假设 nutrient_id = 7) | |||
(7, 'Bones', 'Positive', 'Essential for bone strength and density'), | |||
(7, 'Teeth', 'Positive', 'Maintains dental health'), | |||
(7, 'Muscles', 'Positive', 'Required for proper muscle function'); |
@@ -0,0 +1,49 @@ | |||
/* | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
CREATE TABLE `Allergies` ( | |||
`allergy_id` int NOT NULL AUTO_INCREMENT, | |||
`allergy_name` varchar(50) NOT NULL, | |||
`description` text, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`allergy_id`), | |||
UNIQUE KEY `idx_allergy_name` (`allergy_name`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 用户过敏记录表 | |||
CREATE TABLE `User_Allergies` ( | |||
`user_allergy_id` int NOT NULL AUTO_INCREMENT, | |||
`user_id` int NOT NULL, | |||
`allergy_id` int NOT NULL, | |||
`diagnosed_date` date, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`user_allergy_id`), | |||
UNIQUE KEY `idx_user_allergy` (`user_id`, `allergy_id`), | |||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`), | |||
FOREIGN KEY (`allergy_id`) REFERENCES `Allergies`(`allergy_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 插入常见过敏原数据 | |||
INSERT INTO `Allergies` (allergy_name, description) VALUES | |||
('Peanuts', 'Common legume that can cause severe allergic reactions'), | |||
('Tree Nuts', 'Including almonds, walnuts, cashews, etc.'), | |||
('Milk', 'Dairy products and lactose'), | |||
('Eggs', 'Both egg whites and yolks'), | |||
('Soy', 'Soybeans and soy-based products'), | |||
('Wheat', 'Including gluten sensitivity'), | |||
('Fish', 'Various types of fish'), | |||
('Shellfish', 'Crustaceans and mollusks'), | |||
('Sesame', 'Seeds and sesame oil'), | |||
('Sulfites', 'Common food preservative'); | |||
-- 插入示例用户过敏数据 | |||
INSERT INTO `User_Allergies` | |||
(user_id, allergy_id, severity_level, symptoms, diagnosed_date) | |||
VALUES | |||
(1, 1, 'Severe', 'Anaphylaxis, difficulty breathing, swelling', '2023-01-15'), | |||
(1, 3, 'Moderate', 'Digestive issues, skin rash', '2023-02-20'), | |||
(2, 4, 'Mild', 'Mild skin irritation', '2023-03-10'), | |||
(2, 8, 'Severe', 'Severe rash, breathing difficulties', '2023-04-05'); | |||
*/ |
@@ -0,0 +1,7 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
Alter TABLE `fhsmscdb`.`food1` | |||
ADD COLUMN `Restaurant_ID` int(11) DEFAULT NULL; |
@@ -0,0 +1,7 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
INSERT INTO `food1` (`name`, `Calories (kcal)`, `Protein (g)`, `Fat (g)`, `Carbohydrate (g)`, `Sodium (mg)`, `Postassium (mg)`, `Calcium (mg)`, `Phosphorus (mg)`,`Iron (mg)`,`Vitamin A (μg)`,`Vitamin B1 (mg)`,`Vitamin B2 (mg)`,`Niacin (mg)`,`Vitamin C (mg)`,`food_type`,`Weight (g)`,`contains_egg`, `contains_milk`, `contains_wheat`, `contains_shrimp`,`contains_crab`,`contains_buckwheat`,`contains_peanut`,`contains_walnut`,`Restaurant_ID`) VALUES | |||
('N.Y. Barbecue Sausage & Cheese McMuffin',504,16.6,32.9,35.1,952,263,162,190,1.1,60,0.2,0.21,6,3,'food',152,0,0,0,3,3,3,3,3,1); |
@@ -0,0 +1,15 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
CREATE TABLE `Nutrients_Need` ( | |||
`id` int NOT NULL, | |||
`bmr` DECIMAL(10,2) NOT NULL, | |||
`tdee` DECIMAL(10,2) NOT NULL, | |||
`protein_need` DECIMAL(10,2) NOT NULL, | |||
`fat_need` DECIMAL(10,2) NOT NULL, | |||
`carbo_need` DECIMAL(10,2) NOT NULL, | |||
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
FOREIGN KEY (`id`) REFERENCES `user` (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,64 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-update-trigger splitStatements:false | |||
--comment: Create update trigger | |||
CREATE TRIGGER update_user_Nutrients_Need | |||
AFTER UPDATE ON user_information | |||
FOR EACH ROW | |||
BEGIN | |||
DECLARE calculated_bmr DECIMAL(10,2); | |||
DECLARE calculated_tdee DECIMAL(10,2); | |||
DECLARE user_age INT; | |||
DECLARE weight_kg DECIMAL(5,2); | |||
DECLARE height_cm DECIMAL(5,2); | |||
-- Extract numeric values from weight and height | |||
SET weight_kg = CAST(REPLACE(NEW.weight, ' kg', '') AS DECIMAL(5,2)); | |||
SET height_cm = CAST(REPLACE(NEW.height, ' cm', '') AS DECIMAL(5,2)); | |||
-- Calculate age | |||
SET user_age = FLOOR(DATEDIFF(CURRENT_DATE, FROM_UNIXTIME(NEW.date_of_birth/1000)) / 365); | |||
-- Calculate BMR based on gender | |||
IF NEW.gender = 'Male' THEN | |||
SET calculated_bmr = 88.362 + (13.397 * weight_kg) + (4.799 * height_cm) - (5.677 * user_age); | |||
ELSE | |||
SET calculated_bmr = 447.593 + (9.247 * weight_kg) + (3.098 * height_cm) - (4.330 * user_age); | |||
END IF; | |||
-- Calculate TDEE based on activity level | |||
SET calculated_tdee = calculated_bmr * | |||
CASE NEW.activitylevel | |||
WHEN 'Sedentary' THEN 1.2 | |||
WHEN '1-2 times' THEN 1.375 | |||
WHEN '3-5 times' THEN 1.55 | |||
WHEN '6-7 times' THEN 1.725 | |||
WHEN 'Professional' THEN 1.9 | |||
ELSE 1.2 | |||
END; | |||
-- Insert or update TDEE record | |||
INSERT INTO User_TDEE ( | |||
user_id, | |||
bmr, | |||
tdee, | |||
protein_need, | |||
fat_need, | |||
carbo_need | |||
) | |||
VALUES ( | |||
NEW.user_id, | |||
calculated_bmr, | |||
calculated_tdee, | |||
weight_kg * 2, | |||
(calculated_tdee * 0.25) / 9, | |||
(calculated_tdee - (weight_kg * 2 * 4) - (calculated_tdee * 0.25)) / 4 | |||
) | |||
ON DUPLICATE KEY UPDATE | |||
bmr = calculated_bmr, | |||
tdee = calculated_tdee, | |||
protein_need = weight_kg * 2, | |||
fat_need = (calculated_tdee * 0.25) / 9, | |||
carbo_need = (calculated_tdee - (weight_kg * 2 * 4) - (calculated_tdee * 0.25)) / 4, | |||
last_updated = CURRENT_TIMESTAMP; | |||
END; |
@@ -0,0 +1,64 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-update-trigger splitStatements:false | |||
--comment: Create update trigger | |||
CREATE TRIGGER update_user_Nutrients_Need | |||
AFTER UPDATE ON user_information | |||
FOR EACH ROW | |||
BEGIN | |||
DECLARE calculated_bmr DECIMAL(10,2); | |||
DECLARE calculated_tdee DECIMAL(10,2); | |||
DECLARE user_age INT; | |||
DECLARE weight_kg DECIMAL(5,2); | |||
DECLARE height_cm DECIMAL(5,2); | |||
-- Extract numeric values from weight and height | |||
SET weight_kg = CAST(REPLACE(NEW.weight, ' kg', '') AS DECIMAL(5,2)); | |||
SET height_cm = CAST(REPLACE(NEW.height, ' cm', '') AS DECIMAL(5,2)); | |||
-- Calculate age | |||
SET user_age = FLOOR(DATEDIFF(CURRENT_DATE, FROM_UNIXTIME(NEW.date_of_birth/1000)) / 365); | |||
-- Calculate BMR based on gender | |||
IF NEW.gender = 'Male' THEN | |||
SET calculated_bmr = 88.362 + (13.397 * weight_kg) + (4.799 * height_cm) - (5.677 * user_age); | |||
ELSE | |||
SET calculated_bmr = 447.593 + (9.247 * weight_kg) + (3.098 * height_cm) - (4.330 * user_age); | |||
END IF; | |||
-- Calculate TDEE based on activity level | |||
SET calculated_tdee = calculated_bmr * | |||
CASE NEW.activitylevel | |||
WHEN 'Sedentary' THEN 1.2 | |||
WHEN '1-2 times' THEN 1.375 | |||
WHEN '3-5 times' THEN 1.55 | |||
WHEN '6-7 times' THEN 1.725 | |||
WHEN 'Professional' THEN 1.9 | |||
ELSE 1.2 | |||
END; | |||
-- Insert or update TDEE record | |||
INSERT INTO nutrients_need ( | |||
user_id, | |||
bmr, | |||
tdee, | |||
protein_need, | |||
fat_need, | |||
carbo_need | |||
) | |||
VALUES ( | |||
NEW.user_id, | |||
calculated_bmr, | |||
calculated_tdee, | |||
weight_kg * 2, | |||
(calculated_tdee * 0.25) / 9, | |||
(calculated_tdee - (weight_kg * 2 * 4) - (calculated_tdee * 0.25)) / 4 | |||
) | |||
ON DUPLICATE KEY UPDATE | |||
bmr = calculated_bmr, | |||
tdee = calculated_tdee, | |||
protein_need = weight_kg * 2, | |||
fat_need = (calculated_tdee * 0.25) / 9, | |||
carbo_need = (calculated_tdee - (weight_kg * 2 * 4) - (calculated_tdee * 0.25)) / 4, | |||
last_updated = CURRENT_TIMESTAMP; | |||
END; |
@@ -0,0 +1,44 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
/* | |||
CREATE TABLE `Allergies` ( | |||
`allergy_id` int NOT NULL AUTO_INCREMENT, | |||
`allergy_name` varchar(50) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`allergy_id`), | |||
UNIQUE KEY `idx_allergy_name` (`allergy_name`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
*/ | |||
CREATE TABLE `User_Allergies` ( | |||
`user_allergy_id` int NOT NULL AUTO_INCREMENT, | |||
`user_id` int NOT NULL, | |||
`allergy_id` int NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`user_allergy_id`), | |||
UNIQUE KEY `idx_user_allergy` (`user_id`, `allergy_id`), | |||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`), | |||
FOREIGN KEY (`allergy_id`) REFERENCES `Allergies`(`allergy_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 插入常见过敏原数据 | |||
INSERT INTO `Allergies` (allergy_name) VALUES | |||
('Peanuts'), | |||
('Tree Nuts'), | |||
('Milk'), | |||
('Eggs'), | |||
('Soy' ), | |||
('Wheat'), | |||
('Fish'), | |||
('Shellfish'), | |||
('Sesame'), | |||
('Sulfites'); | |||
-- 插入示例用户过敏数据 | |||
INSERT INTO `User_Allergies` | |||
(user_id, allergy_id ) | |||
VALUES | |||
(1, 1), | |||
(1, 3), | |||
(2, 4), | |||
(2, 8); |
@@ -0,0 +1,19 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
Alter TABLE `fhsmscdb`.`food1` | |||
CHANGE `Calories (kcal)` Calories decimal(10,2), | |||
CHANGE `Protein (g)` Protein decimal(10,2), | |||
CHANGE `Fat (g)` Fat decimal(10,2), | |||
CHANGE `Carbohydrate (g)` Carbohydrate decimal(10,2), | |||
CHANGE `Sodium (mg)` Sodium decimal(10,2), | |||
CHANGE `Postassium (mg)` Potassium decimal(10,2), | |||
CHANGE `Calcium (mg)` Calcium decimal(10,2), | |||
CHANGE `Phosphorus (mg)` Phosphorus decimal(10,2), | |||
CHANGE `Iron (mg)` Iron decimal(10,2), | |||
CHANGE `Vitamin A (μg)` VitaminA decimal(10,2), | |||
CHANGE `Vitamin B1 (mg)` VitaminB1 decimal(10,2), | |||
CHANGE `Vitamin B2 (mg)` VitaminB2 decimal(10,2), | |||
CHANGE `Niacin (mg)` Niacin decimal(10,2), | |||
CHANGE `Vitamin C (mg)` VitaminC decimal(10,2), | |||
CHANGE `Weight (g)` Weight decimal(10,2); |
@@ -0,0 +1,6 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
Alter TABLE `fhsmscdb`.`user_information` | |||
drop column `allergy`; | |||
@@ -0,0 +1,13 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
CREATE TABLE `FB_Operator` ( | |||
`FB_id` int NOT NULL AUTO_INCREMENT, | |||
`FB_name` varchar(50) NOT NULL, | |||
`FB_type` varchar(255) NOT NULL, | |||
`FB_cuisine` varchar(20) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`FB_id`) | |||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,17 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
INSERT INTO `FB_Operator` | |||
(FB_id, FB_name, FB_type, FB_cuisine) | |||
VALUES | |||
(1, 'KFC', 'Fast Food', 'Fast Food'), | |||
(2, 'McDonald', 'Fast Food', 'Fast Food'), | |||
(3, '大家樂', 'Cha Chaan Teng', 'Hong Kong Style'), | |||
(4, '翠華餐廳', 'Cha Chaan Teng', 'Hong Kong Style'), | |||
(5, '美心', 'Chinese Restaurant', 'Cantonese'), | |||
(6, '點點心', 'Dim Sum', 'Cantonese'), | |||
(7, '吉野家', 'Fast Food', 'Japanese'), | |||
(8, '壽司郎', 'Japanese Restaurant', 'Japanese'), | |||
(9, '譚仔雲南米線', 'Noodle Shop', 'Chinese'), | |||
(10, '大快活', 'Fast Food', 'Hong Kong Style') |
@@ -0,0 +1,14 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
CREATE TABLE `FB_Outlets` ( | |||
`FB_id` int NOT NULL AUTO_INCREMENT, | |||
`FB_outlet_id` int NOT NULL, | |||
`FB_outlet_district` varchar(255) NOT NULL, | |||
`FB_outlet_address` varchar(255) NOT NULL, | |||
`FB_outlet_phone` varchar(255) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`FB_id`) | |||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,14 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
ALTER TABLE `FB_Outlets` MODIFY COLUMN `FB_id` int NOT NULL; | |||
ALTER TABLE `FB_Outlets` DROP PRIMARY KEY; | |||
ALTER TABLE `FB_Outlets` ADD PRIMARY KEY (`FB_outlet_id`); | |||
ALTER TABLE `FB_Outlets` ADD CONSTRAINT `fk_fb_outlets_operator` | |||
FOREIGN KEY (`FB_id`) REFERENCES `fb_operator`(`FB_id`); | |||
ALTER TABLE `FB_Outlets` ADD INDEX `idx_fb_id` (`FB_id`); |
@@ -0,0 +1,7 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
ALTER TABLE `FB_Outlets` MODIFY COLUMN `FB_outlet_id` int NOT NULL FIRST; | |||
ALTER TABLE `FB_Outlets` MODIFY COLUMN `FB_id` int NOT NULL AFTER `FB_outlet_id`; |
@@ -0,0 +1,20 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
DROP TABLE `FB_Outlets`; | |||
-- 用新结构创建表 | |||
CREATE TABLE `FB_Outlets` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_outlet_id` int NOT NULL, | |||
`FB_id` int NOT NULL, | |||
`FB_outlet_district` varchar(255), | |||
`FB_outlet_address` varchar(255), | |||
`FB_outlet_phone` varchar(255), | |||
`created_at` timestamp, | |||
PRIMARY KEY (`id`), | |||
INDEX `idx_fb_outlet_id` (`FB_outlet_id`), | |||
INDEX `idx_fb_id` (`FB_id`), | |||
CONSTRAINT `fk_fb_outlets_operator` FOREIGN KEY (`FB_id`) | |||
REFERENCES `fb_operator` (`FB_id`) | |||
); |
@@ -0,0 +1,13 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
INSERT INTO `FB_Outlets` (FB_outlet_id, FB_id, FB_outlet_district, FB_outlet_address, FB_outlet_phone, created_at) | |||
VALUES | |||
(201, 2, '金鐘', '夏愨道18號海富中心地下1-41號舖A部份', '2520 1329', CURRENT_TIMESTAMP), | |||
(202, 2, '灣仔', '軒尼詩道302-308號集成中心Shop G11-17 ,G/F', '2893 9503', CURRENT_TIMESTAMP); | |||
INSERT INTO FB_Outlets (FB_outlet_id, FB_id, FB_outlet_district, FB_outlet_address, FB_outlet_phone, created_at) | |||
VALUES | |||
(301, 3, '銅鑼灣', '波斯富街48號軒尼詩大廈3樓', '2808 0139', CURRENT_TIMESTAMP), | |||
(302, 3, '銅鑼灣', '地下英皇道6-8 號香港天后百利大廈', '2807 3864', CURRENT_TIMESTAMP); |
@@ -0,0 +1,8 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
INSERT INTO `fb_outlets` (FB_outlet_id, FB_id, FB_outlet_district, FB_outlet_address, FB_outlet_phone, created_at) | |||
VALUES | |||
(201, 2, '金鐘', '夏愨道18號海富中心地下1-41號舖A部份', '2520 1329', CURRENT_TIMESTAMP), | |||
(202, 2, '灣仔', '軒尼詩道302-308號集成中心Shop G11-17 ,G/F', '2893 9503', CURRENT_TIMESTAMP); | |||
@@ -0,0 +1,71 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
-- 餐厅菜单表 | |||
CREATE TABLE `FB_Menu` ( | |||
`FB_id` int NOT NULL AUTO_INCREMENT, | |||
`FB_menu_id` int NOT NULL, | |||
`Menu_Item_Description` varchar(255) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`FB_id`), | |||
UNIQUE KEY `UK_FB_menu_id` (`FB_menu_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 菜单项成分表 | |||
CREATE TABLE `FB_Menu_Item_Ingredient` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_menu_id` int NOT NULL, | |||
`Ingredient_id` int NOT NULL, | |||
`Ingredient_Volume` decimal(10,2) NOT NULL, | |||
`Ingredient_Volume_Unit` varchar(50) NOT NULL, | |||
`Allergy_Substance_ID` int, | |||
`Nutrient_ID` int, | |||
`Nutrient_Volume` decimal(10,2), | |||
`Nutrient_Volume_Unit` varchar(50), | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `FK_FB_menu_id` (`FB_menu_id`), | |||
CONSTRAINT `FK_FB_menu_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `FB_Menu` (`FB_menu_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 菜单与门店关系表 | |||
CREATE TABLE `FB_Menu_and_Outlet_Relationship` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_id` int NOT NULL, | |||
`FB_outlet_id` int NOT NULL, | |||
`FB_menu_id` int NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `FK_FB_menu_rel_id` (`FB_menu_id`), | |||
CONSTRAINT `FK_FB_menu_rel_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `FB_Menu` (`FB_menu_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 每日营养摄入汇总表 | |||
CREATE TABLE `daily_nutrition_summary` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`user_id` int NOT NULL, | |||
`date` date NOT NULL, | |||
`total_calories` decimal(10,2) DEFAULT 0, | |||
`total_protein` decimal(10,2) DEFAULT 0, | |||
`total_fat` decimal(10,2) DEFAULT 0, | |||
`total_carbs` decimal(10,2) DEFAULT 0, | |||
`total_sodium` decimal(10,2) DEFAULT 0, | |||
`total_potassium` decimal(10,2) DEFAULT 0, | |||
`total_calcium` decimal(10,2) DEFAULT 0, | |||
`total_phosphorus` decimal(10,2) DEFAULT 0, | |||
`total_iron` decimal(10,2) DEFAULT 0, | |||
`total_vitamin_a` decimal(10,2) DEFAULT 0, | |||
`total_vitamin_b1` decimal(10,2) DEFAULT 0, | |||
`total_vitamin_b2` decimal(10,2) DEFAULT 0, | |||
`total_niacin` decimal(10,2) DEFAULT 0, | |||
`total_vitamin_c` decimal(10,2) DEFAULT 0, | |||
`breakfast_calories` decimal(10,2) DEFAULT 0, | |||
`lunch_calories` decimal(10,2) DEFAULT 0, | |||
`dinner_calories` decimal(10,2) DEFAULT 0, | |||
`snack_calories` decimal(10,2) DEFAULT 0, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `UK_user_date` (`user_id`, `date`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,43 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
/* | |||
CREATE TABLE `FB_Menu_Item_Nutrition` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_menu_id` int NOT NULL, | |||
`Calories` decimal(10,2) DEFAULT 0, | |||
`Protein` decimal(10,2) DEFAULT 0, | |||
`Fat` decimal(10,2) DEFAULT 0, | |||
`Carbohydrate` decimal(10,2) DEFAULT 0, | |||
`Sodium` decimal(10,2) DEFAULT 0, | |||
`Potassium` decimal(10,2) DEFAULT 0, | |||
`Calcium` decimal(10,2) DEFAULT 0, | |||
`Phosphorus` decimal(10,2) DEFAULT 0, | |||
`Iron` decimal(10,2) DEFAULT 0, | |||
`VitaminA` decimal(10,2) DEFAULT 0, | |||
`VitaminB1` decimal(10,2) DEFAULT 0, | |||
`VitaminB2` decimal(10,2) DEFAULT 0, | |||
`Niacin` decimal(10,2) DEFAULT 0, | |||
`VitaminC` decimal(10,2) DEFAULT 0, | |||
`Nutrient_Volume` decimal(10,2) DEFAULT 0, | |||
`Nutrient_Volume_Unit` varchar(50) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `UK_FB_menu_id` (`FB_menu_id`), | |||
CONSTRAINT `FK_FB_menu_nutrition_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `FB_Menu` (`FB_menu_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
*/ | |||
CREATE TABLE `Ingredient` ( | |||
`Ingredient_id` int NOT NULL AUTO_INCREMENT, | |||
`Ingredient_Name` varchar(255) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`Ingredient_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
ALTER TABLE `fhsmscdb`.`fb_menu_item_ingredient` | |||
DROP COLUMN `Nutrient_ID`, | |||
DROP COLUMN `Nutrient_Volume`, | |||
DROP COLUMN `Nutrient_Volume_Unit`; | |||
@@ -0,0 +1,175 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
DROP TABLE IF EXISTS fb_menu_and_outlet_relationship; | |||
DROP TABLE IF EXISTS fb_menu_item_ingredient; | |||
DROP TABLE IF EXISTS fb_menu_item_nutrition; | |||
DROP TABLE IF EXISTS fb_menu; | |||
DROP TABLE IF EXISTS ingredient; | |||
CREATE TABLE `ingredient` ( | |||
`Ingredient_id` int NOT NULL AUTO_INCREMENT, | |||
`Ingredient_Name` varchar(255) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`Ingredient_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
-- 重新创建fb_menu表,使用FB_menu_id作为主键 | |||
CREATE TABLE `fb_menu` ( | |||
`FB_id` int NOT NULL, | |||
`FB_menu_id` int NOT NULL AUTO_INCREMENT, | |||
`Menu_Item_Description` varchar(255) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`FB_menu_id`), | |||
INDEX `idx_FB_id` (`FB_id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
CREATE TABLE `fb_menu_item_nutrition` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_menu_id` int NOT NULL, | |||
`Calories` decimal(10,2) DEFAULT 0, | |||
`Protein` decimal(10,2) DEFAULT 0, | |||
`Fat` decimal(10,2) DEFAULT 0, | |||
`Carbohydrate` decimal(10,2) DEFAULT 0, | |||
`Sodium` decimal(10,2) DEFAULT 0, | |||
`Potassium` decimal(10,2) DEFAULT 0, | |||
`Calcium` decimal(10,2) DEFAULT 0, | |||
`Phosphorus` decimal(10,2) DEFAULT 0, | |||
`Iron` decimal(10,2) DEFAULT 0, | |||
`VitaminA` decimal(10,2) DEFAULT 0, | |||
`VitaminB1` decimal(10,2) DEFAULT 0, | |||
`VitaminB2` decimal(10,2) DEFAULT 0, | |||
`Niacin` decimal(10,2) DEFAULT 0, | |||
`VitaminC` decimal(10,2) DEFAULT 0, | |||
`Nutrient_Volume` decimal(10,2) DEFAULT 0, | |||
`Nutrient_Volume_Unit` varchar(50) NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `FK_FB_menu_nutrition_id` (`FB_menu_id`), | |||
CONSTRAINT `FK_FB_menu_nutrition_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `fb_menu` (`FB_menu_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
CREATE TABLE `fb_menu_item_ingredient` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_menu_id` int NOT NULL, | |||
`Ingredient_id` int NOT NULL, | |||
`Ingredient_Volume` decimal(10,2) NOT NULL, | |||
`Ingredient_Volume_Unit` varchar(50) NOT NULL, | |||
`Allergy_Substance_ID` int, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `FK_FB_menu_id` (`FB_menu_id`), | |||
KEY `FK_Ingredient_id` (`Ingredient_id`), | |||
CONSTRAINT `FK_FB_menu_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `fb_menu` (`FB_menu_id`) ON DELETE CASCADE, | |||
CONSTRAINT `FK_Ingredient_id` FOREIGN KEY (`Ingredient_id`) REFERENCES `ingredient` (`Ingredient_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
CREATE TABLE `fb_menu_and_outlet_relationship` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_id` int NOT NULL, | |||
`FB_outlet_id` int NOT NULL, | |||
`FB_menu_id` int NOT NULL, | |||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`), | |||
KEY `FK_FB_menu_rel_id` (`FB_menu_id`), | |||
CONSTRAINT `FK_FB_menu_rel_id` FOREIGN KEY (`FB_menu_id`) REFERENCES `fb_menu` (`FB_menu_id`) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO fb_menu (FB_id, FB_menu_id, Menu_Item_Description, created_at) VALUES | |||
(1, 101, '香煎三文鱼配时蔬', NOW()), | |||
(1, 102, '黑椒牛排配蘑菇酱', NOW()), | |||
(1, 103, '泰式青咖喱鸡', NOW()), | |||
(1, 104, '意式肉酱面配帕玛森芝士', NOW()), | |||
(1, 105, '地中海风味沙拉', NOW()), | |||
(2, 201, '清蒸鲈鱼配姜葱', NOW()), | |||
(2, 202, '红烧狮子头', NOW()), | |||
(2, 203, '宫保鸡丁配花生米', NOW()); | |||
-- 插入营养信息数据 | |||
INSERT INTO fb_menu_item_nutrition (FB_menu_id, Calories, Protein, Fat, Carbohydrate, Sodium, Potassium, Calcium, Phosphorus, Iron, VitaminA, VitaminB1, VitaminB2, Niacin, VitaminC, Nutrient_Volume, Nutrient_Volume_Unit, created_at) VALUES | |||
(101, 275.00, 25.00, 15.00, 10.00, 150.00, 450.00, 30.00, 250.00, 1.80, 120.00, 0.15, 0.20, 5.00, 15.00, 350.00, 'g', NOW()), | |||
(102, 320.00, 30.00, 20.00, 5.00, 200.00, 500.00, 20.00, 200.00, 3.50, 50.00, 0.10, 0.15, 7.00, 5.00, 300.00, 'g', NOW()), | |||
(103, 310.00, 22.00, 18.00, 15.00, 300.00, 400.00, 50.00, 180.00, 2.00, 80.00, 0.12, 0.18, 6.00, 20.00, 350.00, 'g', NOW()), | |||
(104, 480.00, 20.00, 15.00, 65.00, 800.00, 350.00, 150.00, 200.00, 2.50, 100.00, 0.20, 0.25, 4.00, 10.00, 400.00, 'g', NOW()), | |||
(105, 200.00, 8.00, 12.00, 15.00, 120.00, 300.00, 100.00, 120.00, 1.20, 150.00, 0.08, 0.12, 2.00, 45.00, 250.00, 'g', NOW()); | |||
INSERT INTO ingredient (Ingredient_id, Ingredient_Name, created_at) VALUES | |||
(1, '三文鱼', NOW()), | |||
(2, '橄榄油', NOW()), | |||
(3, '西兰花', NOW()), | |||
(4, '胡萝卜', NOW()), | |||
(5, '牛排', NOW()), | |||
(6, '黑胡椒', NOW()), | |||
(7, '蘑菇', NOW()), | |||
(8, '鸡胸肉', NOW()), | |||
(9, '青咖喱酱', NOW()), | |||
(10, '椰奶', NOW()), | |||
(11, '意大利面', NOW()), | |||
(12, '番茄', NOW()), | |||
(13, '牛肉碎', NOW()), | |||
(14, '帕玛森芝士', NOW()), | |||
(15, '生菜', NOW()), | |||
(16, '黄瓜', NOW()), | |||
(17, '橄榄', NOW()), | |||
(18, '羊奶芝士', NOW()); | |||
INSERT INTO fb_menu_item_ingredient (FB_menu_id, Ingredient_id, Ingredient_Volume, Ingredient_Volume_Unit, Allergy_Substance_ID, created_at) VALUES | |||
(101, 1, 200.00, 'g', 7, NOW()), -- 三文鱼 (鱼类过敏 | |||
(101, 2, 15.00, 'ml', NULL, NOW()), | |||
(101, 3, 100.00, 'g', NULL, NOW()), | |||
(101, 4, 50.00, 'g', NULL, NOW()), | |||
(102, 5, 250.00, 'g', NULL, NOW()), | |||
(102, 6, 5.00, 'g', NULL, NOW()), | |||
(102, 7, 100.00, 'g', NULL, NOW()), | |||
(102, 2, 10.00, 'ml', NULL, NOW()), | |||
(103, 8, 180.00, 'g', NULL, NOW()), | |||
(103, 9, 30.00, 'g', 5, NOW()), -- 咖喱酱 (可能含大豆) | |||
(103, 10, 150.00, 'ml', 3, NOW()), -- 椰奶 (可能含乳制品) | |||
(103, 3, 80.00, 'g', NULL, NOW()), | |||
(104, 11, 120.00, 'g', 6, NOW()), -- 意大利面 (含麦麸) | |||
(104, 12, 150.00, 'g', NULL, NOW()), | |||
(104, 13, 100.00, 'g', NULL, NOW()), | |||
(104, 14, 20.00, 'g', 3, NOW()), -- 帕玛森芝士 (含乳制品) | |||
(105, 15, 100.00, 'g', NULL, NOW()), | |||
(105, 16, 80.00, 'g', NULL, NOW()), | |||
(105, 17, 30.00, 'g', NULL, NOW()), | |||
(105, 18, 40.00, 'g', 3, NOW()), -- 羊奶芝士 (含乳制品) | |||
(105, 2, 15.00, 'ml', NULL, NOW()); | |||
INSERT INTO fb_menu_and_outlet_relationship (FB_id, FB_outlet_id, FB_menu_id, created_at) VALUES | |||
(1, 1001, 101, NOW()), | |||
(1, 1001, 102, NOW()), | |||
(1, 1001, 103, NOW()), | |||
(1, 1002, 101, NOW()), | |||
(1, 1002, 104, NOW()), | |||
(1, 1002, 105, NOW()), | |||
(2, 2001, 201, NOW()), | |||
(2, 2001, 202, NOW()), | |||
(2, 2001, 203, NOW()), | |||
(2, 2002, 201, NOW()), | |||
(2, 2002, 202, NOW()); |
@@ -0,0 +1,17 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-table-and-insert-data | |||
--comment: Create table and insert data | |||
/* | |||
INSERT INTO fb_operator (FB_id, FB_name, FB_type, FB_cuisine, created_at) VALUES | |||
(1, 'Healthy Eater', 'Fast Food', 'Chinese', NOW()), | |||
(2, 'Seafood World', 'Dinner', 'Cantonese', NOW()), | |||
*/ | |||
INSERT INTO fb_outlets (FB_outlet_id, FB_id, FB_outlet_district, FB_outlet_address, FB_outlet_phone, created_at) VALUES | |||
(1001, 1, 'Central', 'Central Financial Street 88, 1st Floor', '2345-6789', NOW()), | |||
(1002, 1, 'Causeway Bay', 'Causeway Bay Times Square 2nd Floor', '2345-6790', NOW()), | |||
(2001, 2, 'Tsim Sha Tsui', 'Tsim Sha Tsui Guangdong Road 30', '3456-7890', NOW()), | |||
(2002, 2, 'Sha Tin', 'Sha Tin New City Plaza 5th Floor', '3456-7891', NOW()); |
@@ -0,0 +1,85 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-organization-tables | |||
--comment: Create organization related tables | |||
DROP TABLE daily_nutrition_summary; | |||
CREATE TABLE User_Group_Organization ( | |||
User_Grp_Org_ID INT AUTO_INCREMENT PRIMARY KEY, | |||
User_Grp_Org_Name VARCHAR(100) NOT NULL, | |||
Creator_User_ID INT NOT NULL, | |||
Creation_Date_Time TIMESTAMP DEFAULT CURRENT_TIMESTAMP | |||
); | |||
CREATE TABLE User_Group_Members ( | |||
User_Grp_Org_ID INT NOT NULL, | |||
User_ID INT NOT NULL, | |||
R_Ship_Creator VARCHAR(50), | |||
Creation_Date_Time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (User_Grp_Org_ID, User_ID), | |||
FOREIGN KEY (User_Grp_Org_ID) REFERENCES User_Group_Organization(User_Grp_Org_ID) | |||
); | |||
CREATE TABLE User_Group_Admin ( | |||
User_Grp_Org_ID INT NOT NULL, | |||
Admin_User_ID INT NOT NULL, | |||
Organization_Role VARCHAR(50) NOT NULL, | |||
Creation_Date_Time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (User_Grp_Org_ID, Admin_User_ID), | |||
FOREIGN KEY (User_Grp_Org_ID) REFERENCES User_Group_Organization(User_Grp_Org_ID) | |||
); | |||
CREATE TABLE User_Delegation ( | |||
User_ID INT NOT NULL, | |||
Delegate_To_User_ID INT NOT NULL, | |||
Data_Group_ID INT NOT NULL, | |||
Delegation_Start_Date DATE NOT NULL, | |||
Delegation_Expiry_Date DATE NOT NULL, | |||
Creation_Date_Time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (User_ID, Delegate_To_User_ID, Data_Group_ID) | |||
); | |||
CREATE TABLE daily_nutrition_summary ( | |||
id INT AUTO_INCREMENT PRIMARY KEY, | |||
user_id INT NOT NULL, | |||
User_Grp_Org_ID INT, | |||
date DATE NOT NULL, | |||
visibility_level INT DEFAULT 1, | |||
data_category VARCHAR(50) DEFAULT 'regular', | |||
reference_group_id INT, | |||
health_metrics_reference_id INT, | |||
total_calories DECIMAL(10,2) DEFAULT 0, | |||
total_protein DECIMAL(10,2) DEFAULT 0, | |||
total_fat DECIMAL(10,2) DEFAULT 0, | |||
total_carbs DECIMAL(10,2) DEFAULT 0, | |||
total_sodium DECIMAL(10,2) DEFAULT 0, | |||
total_potassium DECIMAL(10,2) DEFAULT 0, | |||
total_calcium DECIMAL(10,2) DEFAULT 0, | |||
total_phosphorus DECIMAL(10,2) DEFAULT 0, | |||
total_iron DECIMAL(10,2) DEFAULT 0, | |||
total_vitamin_a DECIMAL(10,2) DEFAULT 0, | |||
total_vitamin_b1 DECIMAL(10,2) DEFAULT 0, | |||
total_vitamin_b2 DECIMAL(10,2) DEFAULT 0, | |||
total_niacin DECIMAL(10,2) DEFAULT 0, | |||
total_vitamin_c DECIMAL(10,2) DEFAULT 0, | |||
breakfast_calories DECIMAL(10,2) DEFAULT 0, | |||
lunch_calories DECIMAL(10,2) DEFAULT 0, | |||
dinner_calories DECIMAL(10,2) DEFAULT 0, | |||
snack_calories DECIMAL(10,2) DEFAULT 0, | |||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |||
FOREIGN KEY (User_Grp_Org_ID) REFERENCES User_Group_Organization(User_Grp_Org_ID) | |||
); | |||
CREATE INDEX idx_daily_nutrition_user_date ON daily_nutrition_summary(user_id, date); | |||
CREATE INDEX idx_daily_nutrition_org_date ON daily_nutrition_summary(User_Grp_Org_ID, date); | |||
@@ -0,0 +1,71 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-organization-tables | |||
--comment: Create organization related tables | |||
INSERT INTO User_Group_Organization (User_Grp_Org_ID, User_Grp_Org_Name, Creator_User_ID, Creation_Date_Time) | |||
VALUES | |||
(1, 'Aschool', 1001, NOW()), | |||
(2, 'Bschool', 1002, NOW()), | |||
(3, 'Cschool', 1003, NOW()), | |||
(4, 'Dschool', 1004, NOW()), | |||
(5, 'Eschool', 1005, NOW()); | |||
INSERT INTO User_Group_Members (User_Grp_Org_ID, User_ID, R_Ship_Creator, Creation_Date_Time) | |||
VALUES | |||
(1, 1001, 'Creator', NOW()), | |||
(1, 1010, 'Student', NOW()), | |||
(1, 1011, 'Student', NOW()), | |||
(1, 1012, 'Teacher', NOW()), | |||
(1, 1013, 'Teacher', NOW()), | |||
(2, 1002, 'Creator', NOW()), | |||
(2, 1020, 'Student', NOW()), | |||
(2, 1021, 'Student', NOW()), | |||
(2, 1022, 'Teacher', NOW()), | |||
(3, 1003, 'Creator', NOW()), | |||
(3, 1030, 'Student', NOW()), | |||
(3, 1031, 'Student', NOW()), | |||
(4, 1004, 'Creator', NOW()), | |||
(4, 1040, 'Student', NOW()), | |||
(5, 1005, 'Creator', NOW()), | |||
(5, 1050, 'Student', NOW()); | |||
INSERT INTO User_Group_Admin (User_Grp_Org_ID, Admin_User_ID, Organization_Role, Creation_Date_Time) | |||
VALUES | |||
(1, 1001, 'President', NOW()), | |||
(1, 1012, 'Dean', NOW()), | |||
(1, 1013, 'Dean', NOW()), | |||
(2, 1002, 'President', NOW()), | |||
(2, 1022, 'Dean', NOW()), | |||
(3, 1003, 'President', NOW()), | |||
(3, 1031, 'President', NOW()), | |||
(4, 1004, 'President', NOW()), | |||
(5, 1005, 'President', NOW()); | |||
INSERT INTO User_Delegation (User_ID, Delegate_To_User_ID, Data_Group_ID, Delegation_Start_Date, Delegation_Expiry_Date, Creation_Date_Time) | |||
VALUES | |||
(1001, 1012, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 1 YEAR), NOW()), | |||
(1001, 1013, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 6 MONTH), NOW()), | |||
(1002, 1022, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 1 YEAR), NOW()), | |||
(1002, 1022, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 1 YEAR), NOW()), | |||
(1003, 1031, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 3 MONTH), NOW()), | |||
(1010, 1011, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 7 DAY), NOW()); |
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:insert-sample-data | |||
--comment: Insert sample data for testing | |||
ALTER TABLE `fhsmscdb`.`daily_nutrition_summary` | |||
CHANGE COLUMN `created_at` `created` datetime, | |||
CHANGE COLUMN `updated_at` `modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
ADD COLUMN `createdBy` bigint DEFAULT NULL, | |||
ADD COLUMN `version` int NOT NULL DEFAULT '0', | |||
ADD COLUMN `modifiedBy` bigint DEFAULT NULL, | |||
ADD COLUMN `deleted` tinyint(1) NOT NULL DEFAULT '0'; |
@@ -0,0 +1,35 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
UPDATE fb_menu SET Menu_Item_Description = CASE FB_menu_id | |||
WHEN 101 THEN 'Pan-fried Salmon with Seasonal Vegetables' | |||
WHEN 102 THEN 'Black Pepper Steak with Mushroom Sauce' | |||
WHEN 103 THEN 'Thai Green Curry Chicken' | |||
WHEN 104 THEN 'Spaghetti Bolognese with Parmesan Cheese' | |||
WHEN 105 THEN 'Mediterranean Salad' | |||
WHEN 201 THEN 'Steamed Sea Bass with Ginger and Spring Onion' | |||
WHEN 202 THEN 'Braised Lion Head Meatballs' | |||
WHEN 203 THEN 'Kung Pao Chicken with Peanuts' | |||
END | |||
WHERE FB_menu_id IN (101,102,103,104,105,201,202,203); | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_menu', 'Menu_Item_Description', 101, 'zh', '香煎鮭魚配時蔬'), | |||
('fb_menu', 'Menu_Item_Description', 102, 'zh', '黑椒牛排佐蘑菇醬'), | |||
('fb_menu', 'Menu_Item_Description', 103, 'zh', '泰國青咖哩雞'), | |||
('fb_menu', 'Menu_Item_Description', 104, 'zh', '義式肉醬麵配帕瑪森起司'), | |||
('fb_menu', 'Menu_Item_Description', 105, 'zh', '地中海風味沙拉'), | |||
('fb_menu', 'Menu_Item_Description', 201, 'zh', '清蒸鱸魚配薑蔥'), | |||
('fb_menu', 'Menu_Item_Description', 202, 'zh', '紅燒獅子頭'), | |||
('fb_menu', 'Menu_Item_Description', 203, 'zh', '宮保雞丁配花生米'); | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_menu', 'Menu_Item_Description', 101, 'en', 'Pan-fried Salmon with Seasonal Vegetables'), | |||
('fb_menu', 'Menu_Item_Description', 102, 'en', 'Black Pepper Steak with Mushroom Sauce'), | |||
('fb_menu', 'Menu_Item_Description', 103, 'en', 'Thai Green Curry Chicken'), | |||
('fb_menu', 'Menu_Item_Description', 104, 'en', 'Spaghetti Bolognese with Parmesan Cheese'), | |||
('fb_menu', 'Menu_Item_Description', 105, 'en', 'Mediterranean Salad'), | |||
('fb_menu', 'Menu_Item_Description', 201, 'en', 'Steamed Sea Bass with Ginger and Spring Onion'), | |||
('fb_menu', 'Menu_Item_Description', 202, 'en', 'Braised Lion Head Meatballs'), | |||
('fb_menu', 'Menu_Item_Description', 203, 'en', 'Kung Pao Chicken with Peanuts'); |
@@ -0,0 +1,20 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
CREATE TABLE `I18n` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`table_name` varchar(50) NOT NULL, | |||
`field_name` varchar(50) NOT NULL , | |||
`record_id` int NOT NULL, | |||
`language` varchar(10) NOT NULL, | |||
`value` text NOT NULL, | |||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`modified` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, | |||
`createdBy` int DEFAULT NULL, | |||
`modifiedBy` int DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `UK_translation` (`table_name`, `field_name`, `record_id`, `language`), | |||
KEY `IDX_table_field` (`table_name`, `field_name`), | |||
KEY `IDX_language` (`language`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,31 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
UPDATE fb_outlets SET FB_outlet_district = CASE id | |||
WHEN 1 THEN 'Admiralty' | |||
WHEN 2 THEN 'Wan Chai' | |||
WHEN 3 THEN 'Kwun Tong' | |||
WHEN 4 THEN 'Kwun Tong' | |||
END | |||
WHERE id IN (1,2,3,4); | |||
UPDATE fb_outlets SET FB_outlet_address = CASE id | |||
WHEN 1 THEN 'Shop A, No.1-41, G/F, Admiralty Centre, 18 Harcourt Road' | |||
WHEN 2 THEN 'Shop G11-17 ,G/F, C.c. Wu Building,11-17, 302-308, Hennessy Road' | |||
WHEN 3 THEN 'Speedy Industrial Building, 2nd Floor, Room B, 114, Kwun Tong Road' | |||
WHEN 4 THEN 'Shop No. L2-1 Level 2, apm, 418 Kwun Tong Rd' | |||
END | |||
WHERE id IN (1,2,3,4); | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_outlets', 'FB_outlet_district', 1, 'zh', '中環'), | |||
('fb_outlets', 'FB_outlet_district', 2, 'zh', '灣仔'), | |||
('fb_outlets', 'FB_outlet_district', 3, 'zh', '觀塘'), | |||
('fb_outlets', 'FB_outlet_district', 4, 'zh', '觀塘'); | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_outlets', 'FB_outlet_address', 1, 'en', 'Shop A, No.1-41, G/F, Admiralty Centre, 18 Harcourt Road'), | |||
('fb_outlets', 'FB_outlet_address', 2, 'en', 'Shop G11-17 ,G/F, C.c. Wu Building,11-17, 302-308, Hennessy Road'), | |||
('fb_outlets', 'FB_outlet_address', 3, 'en', 'Speedy Industrial Building, 2nd Floor, Room B, 114, Kwun Tong Road'), | |||
('fb_outlets', 'FB_outlet_address', 4, 'en', 'Shop No. L2-1 Level 2, apm, 418 Kwun Tong Rd'); |
@@ -0,0 +1,15 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_outlets', 'FB_outlet_district', 1, 'en', 'Admiralty'), | |||
('fb_outlets', 'FB_outlet_district', 2, 'en', 'Wan Chai'), | |||
('fb_outlets', 'FB_outlet_district', 3, 'en', 'Kwun Tong'), | |||
('fb_outlets', 'FB_outlet_district', 4, 'en', 'Kwun Tong'); | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_outlets', 'FB_outlet_address', 1, 'zh', '夏愨道18號海富中心地下1-41號A鋪'), | |||
('fb_outlets', 'FB_outlet_address', 2, 'zh', '灣仔軒尼詩道302-308號皇后大廈地下G11-17號鋪'), | |||
('fb_outlets', 'FB_outlet_address', 3, 'zh', '觀塘鯉魚門道114號迅達工業大廈2樓B室'), | |||
('fb_outlets', 'FB_outlet_address', 4, 'zh', '觀塘鯉魚門道418號apm2樓L2-1號鋪'); |
@@ -0,0 +1,24 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
INSERT INTO i18n (table_name, field_name, record_id, language, value) VALUES | |||
('fb_outlets', 'FB_outlet_district', 7, 'en', 'Central'), | |||
('fb_outlets', 'FB_outlet_district', 8, 'en', 'Causeway Bay'), | |||
('fb_outlets', 'FB_outlet_district', 9, 'en', 'Tsim Sha Tsui'), | |||
('fb_outlets', 'FB_outlet_district', 10, 'en', 'Sha Tin'), | |||
('fb_outlets', 'FB_outlet_district', 7, 'zh', '中環'), | |||
('fb_outlets', 'FB_outlet_district', 8, 'zh', '銅鑼灣'), | |||
('fb_outlets', 'FB_outlet_district', 9, 'zh', '尖沙咀'), | |||
('fb_outlets', 'FB_outlet_district', 10, 'zh', '沙田'), | |||
('fb_outlets', 'FB_outlet_address', 7, 'en', 'Central Financial Street 88, 1st Floor'), | |||
('fb_outlets', 'FB_outlet_address', 8, 'en', 'Causeway Bay Times Square 2nd Floor'), | |||
('fb_outlets', 'FB_outlet_address', 9, 'en', 'Tsim Sha Tsui Guangdong Road 30'), | |||
('fb_outlets', 'FB_outlet_address', 10, 'en', 'Sha Tin New City Plaza 5th Floor'), | |||
('fb_outlets', 'FB_outlet_address', 7, 'zh', '金融街88號1樓'), | |||
('fb_outlets', 'FB_outlet_address', 8, 'zh', '時代廣場2樓'), | |||
('fb_outlets', 'FB_outlet_address', 9, 'zh', '廣東道30號'), | |||
('fb_outlets', 'FB_outlet_address', 10, 'zh', '新城市廣場52樓'); |
@@ -0,0 +1,15 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
CREATE TABLE `UserAccessControl` ( | |||
`UserId` int NOT NULL AUTO_INCREMENT, | |||
`FunctionId` int NOT NULL, | |||
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`Modified` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, | |||
`CreatedBy` int DEFAULT NULL, | |||
`ModifiedBy` int DEFAULT NULL, | |||
PRIMARY KEY (`UserId`, `FunctionId`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,63 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
drop table if exists authority; | |||
CREATE TABLE `authority` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`authority` varchar(100) NOT NULL, | |||
`name` varchar(255) NOT NULL, | |||
`module` varchar(100) DEFAULT NULL, | |||
`description` varchar(500) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `uk_authority` (`authority`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- User Management | |||
(1, 'MAINTAIN_USER', 'Maintain User', 'USER_MANAGEMENT', 'Maintain user master data'), | |||
(2, 'VIEW_USER', 'View User', 'USER_MANAGEMENT', 'View user master data'), | |||
(3, 'MAINTAIN_GROUP', 'Maintain User Group', 'USER_MANAGEMENT', 'Maintain user group master data'), | |||
(4, 'VIEW_USER_GROUP', 'View User Group', 'USER_MANAGEMENT', 'View user group master data'), | |||
-- Food and Menu Management | |||
(5, 'MAINTAIN_FOOD_MENU', 'Maintain Food Menu', 'FOOD_MANAGEMENT', 'Maintain food and menu data'), | |||
(6, 'VIEW_FOOD_MENU', 'View Food Menu', 'FOOD_MANAGEMENT', 'View food and menu data'), | |||
(7, 'MAINTAIN_FOOD_INTAKE', 'Maintain Food Intake', 'FOOD_MANAGEMENT', 'Maintain food intake records'), | |||
(8, 'VIEW_FOOD_INTAKE', 'View Food Intake', 'FOOD_MANAGEMENT', 'View food intake records'), | |||
-- Nutrition Management | |||
(9, 'MAINTAIN_NUTRITION_STANDARD', 'Maintain Nutrition Standard', 'NUTRITION_MANAGEMENT', 'Maintain nutrition standards'), | |||
(10, 'VIEW_NUTRITION_STANDARD', 'View Nutrition Standard', 'NUTRITION_MANAGEMENT', 'View nutrition standards'), | |||
(11, 'MAINTAIN_NUTRITION_ANALYSIS', 'Maintain Nutrition Analysis', 'NUTRITION_MANAGEMENT', 'Maintain nutrition analysis'), | |||
(12, 'VIEW_NUTRITION_ANALYSIS', 'View Nutrition Analysis', 'NUTRITION_MANAGEMENT', 'View nutrition analysis'), | |||
-- Health Data Management | |||
(13, 'MAINTAIN_HEALTH_DATA', 'Maintain Health Data', 'HEALTH_MANAGEMENT', 'Maintain health development data'), | |||
(14, 'VIEW_HEALTH_DATA', 'View Health Data', 'HEALTH_MANAGEMENT', 'View health development data'), | |||
(15, 'MAINTAIN_ALLERGY_DATA', 'Maintain Allergy Data', 'HEALTH_MANAGEMENT', 'Maintain allergy data'), | |||
(16, 'VIEW_ALLERGY_DATA', 'View Allergy Data', 'HEALTH_MANAGEMENT', 'View allergy data'), | |||
-- AI Model Management | |||
(17, 'MAINTAIN_AI_MODEL', 'Maintain AI Model', 'AI_MANAGEMENT', 'Maintain food AI models'), | |||
(18, 'VIEW_AI_MODEL', 'View AI Model', 'AI_MANAGEMENT', 'View food AI models'), | |||
-- Report Generation | |||
(19, 'G_NUTRITION_TREND_REPORT', 'Generate Nutrition Trend Report', 'REPORT_MANAGEMENT', 'Generate nutrition trend analysis reports'), | |||
(20, 'G_HEALTH_STATISTICS_REPORT', 'Generate Health Statistics Report', 'REPORT_MANAGEMENT', 'Generate health statistics reports'), | |||
(21, 'G_FOOD_LEFTOVER_REPORT', 'Generate Food Leftover Report', 'REPORT_MANAGEMENT', 'Generate food leftover analysis reports'), | |||
-- F&B Management | |||
(22, 'MAINTAIN_FB_OPERATOR', 'Maintain Food Operator', 'FB_MANAGEMENT', 'Maintain F&B operator data'), | |||
(23, 'VIEW_FB_OPERATOR', 'View Food Operator', 'FB_MANAGEMENT', 'View F&B operator data'), | |||
(24, 'MAINTAIN_FB_OUTLET', 'Maintain Food Outlet', 'FB_MANAGEMENT', 'Maintain F&B outlet data'), | |||
(25, 'VIEW_FB_OUTLET', 'View Food Outlet', 'FB_MANAGEMENT', 'View F&B outlet data'), | |||
-- Dietary Advice Management | |||
(26, 'MAINTAIN_DIETARY_ADVICE', 'Maintain Dietary Advice', 'ADVICE_MANAGEMENT', 'Maintain dietary advice data'), | |||
(27, 'VIEW_DIETARY_ADVICE', 'View Dietary Advice', 'ADVICE_MANAGEMENT', 'View dietary advice data'), | |||
-- Access Control Management | |||
(28, 'MAINTAIN_ACCESS_CONTROL', 'Maintain Access Control', 'ACCESS_MANAGEMENT', 'Maintain access control settings'), | |||
(29, 'VIEW_ACCESS_CONTROL', 'View Access Control', 'ACCESS_MANAGEMENT', 'View access control settings'), | |||
(30, 'MAINTAIN_ACCESS_DELEGATION', 'Maintain Access Delegation', 'ACCESS_MANAGEMENT', 'Maintain access delegation settings'), | |||
(31, 'VIEW_ACCESS_DELEGATION', 'View Access Delegation', 'ACCESS_MANAGEMENT', 'View access delegation settings'); |
@@ -0,0 +1,63 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
drop table if exists authority; | |||
CREATE TABLE `authority` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`authority` varchar(100) NOT NULL, | |||
`name` varchar(255) NOT NULL, | |||
`module` varchar(100) DEFAULT NULL, | |||
`description` varchar(500) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `uk_authority` (`authority`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- User Management | |||
(1, 'MAINTAIN_USER', 'Maintain User', null, null), | |||
(2, 'VIEW_USER', 'View User', null, null), | |||
(3, 'MAINTAIN_GROUP', 'Maintain User Group', null, null), | |||
(4, 'VIEW_USER_GROUP', 'View User Group', null, null), | |||
-- Food and Menu Management | |||
(5, 'MAINTAIN_FOOD_MENU', 'Maintain Food Menu' , null, null), | |||
(6, 'VIEW_FOOD_MENU', 'View Food Menu', null, null), | |||
(7, 'MAINTAIN_FOOD_INTAKE', 'Maintain Food Intake', null, null), | |||
(8, 'VIEW_FOOD_INTAKE', 'View Food Intake', null, null), | |||
-- Nutrition Management | |||
(9, 'MAINTAIN_NUTRITION_STANDARD', 'Maintain Nutrition Standard', null, null), | |||
(10, 'VIEW_NUTRITION_STANDARD', 'View Nutrition Standard', null, null), | |||
(11, 'MAINTAIN_NUTRITION_ANALYSIS', 'Maintain Nutrition Analysis', null, null), | |||
(12, 'VIEW_NUTRITION_ANALYSIS', 'View Nutrition Analysis', null, null), | |||
-- Health Data Management | |||
(13, 'MAINTAIN_HEALTH_DATA', 'Maintain Health Data', null, null), | |||
(14, 'VIEW_HEALTH_DATA', 'View Health Data', null, null), | |||
(15, 'MAINTAIN_ALLERGY_DATA', 'Maintain Allergy Data', null, null), | |||
(16, 'VIEW_ALLERGY_DATA', 'View Allergy Data', null, null), | |||
-- AI Model Management | |||
(17, 'MAINTAIN_AI_MODEL', 'Maintain AI Model', null, null), | |||
(18, 'VIEW_AI_MODEL', 'View AI Model', null, null), | |||
-- Report Generation | |||
(19, 'G_NUTRITION_TREND_REPORT', 'Generate Nutrition Trend Report', null, null), | |||
(20, 'G_HEALTH_STATISTICS_REPORT', 'Generate Health Statistics Report', null, null), | |||
(21, 'G_FOOD_LEFTOVER_REPORT', 'Generate Food Leftover Report', null, null), | |||
-- F&B Management | |||
(22, 'MAINTAIN_FB_OPERATOR', 'Maintain Food Operator', null, null), | |||
(23, 'VIEW_FB_OPERATOR', 'View Food Operator', null, null), | |||
(24, 'MAINTAIN_FB_OUTLET', 'Maintain Food Outlet', null, null), | |||
(25, 'VIEW_FB_OUTLET', 'View Food Outlet', null, null), | |||
-- Dietary Advice Management | |||
(26, 'MAINTAIN_DIETARY_ADVICE', 'Maintain Dietary Advice', null, null), | |||
(27, 'VIEW_DIETARY_ADVICE', 'View Dietary Advice', null, null), | |||
-- Access Control Management | |||
(28, 'MAINTAIN_ACCESS_CONTROL', 'Maintain Access Control', null, null), | |||
(29, 'VIEW_ACCESS_CONTROL', 'View Access Control', null, null), | |||
(30, 'MAINTAIN_ACCESS_DELEGATION', 'Maintain Access Delegation', null, null), | |||
(31, 'VIEW_ACCESS_DELEGATION', 'View Access Delegation', null, null); |
@@ -0,0 +1,67 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Insert user authority mapping | |||
-- System Admin | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- user and access control management | |||
(2, 1), -- MAINTAIN_USER | |||
(1, 2), -- VIEW_USER | |||
(1, 3), -- MAINTAIN_GROUP | |||
(1, 4), -- VIEW_USER_GROUP | |||
(1, 28), -- MAINTAIN_ACCESS_CONTROL | |||
(1, 29), -- VIEW_ACCESS_CONTROL | |||
(1, 30), -- MAINTAIN_ACCESS_DELEGATION | |||
(1, 31), -- VIEW_ACCESS_DELEGATION | |||
-- AI和餐饮管理 | |||
(1, 17), -- MAINTAIN_AI_MODEL | |||
(1, 18), -- VIEW_AI_MODEL | |||
(1, 22), -- MAINTAIN_FB_OPERATOR | |||
(1, 23), -- VIEW_FB_OPERATOR | |||
(1, 24), -- MAINTAIN_FB_OUTLET | |||
(1, 25); -- VIEW_FB_OUTLET | |||
-- School Admin | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- basic view permission | |||
(2, 2), -- VIEW_USER | |||
(2, 4), -- VIEW_USER_GROUP | |||
(2, 29), -- VIEW_ACCESS_CONTROL | |||
-- report permission | |||
(2, 19), -- G_NUTRITION_TREND_REPORT | |||
(2, 20), -- G_HEALTH_STATISTICS_REPORT | |||
(2, 21), -- G_FOOD_LEFTOVER_REPORT | |||
-- food and menu view permission | |||
(2, 6), -- VIEW_FOOD_MENU | |||
(2, 23), -- VIEW_FB_OPERATOR | |||
(2, 25); -- VIEW_FB_OUTLET | |||
-- Student User | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- personal data management | |||
(9, 7), -- MAINTAIN_FOOD_INTAKE | |||
(9, 8), -- VIEW_FOOD_INTAKE | |||
(9, 13), -- MAINTAIN_HEALTH_DATA | |||
(9, 14), -- VIEW_HEALTH_DATA | |||
(9, 15), -- MAINTAIN_ALLERGY_DATA | |||
(9, 16), -- VIEW_ALLERGY_DATA | |||
-- view permission | |||
(9, 6), -- VIEW_FOOD_MENU | |||
(9, 10), -- VIEW_NUTRITION_STANDARD | |||
(9, 12), -- VIEW_NUTRITION_ANALYSIS | |||
(9, 27); -- VIEW_DIETARY_ADVICE | |||
-- Nutritionist/Health Advisor | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- nutrition and health management | |||
(8, 11), -- MAINTAIN_NUTRITION_ANALYSIS | |||
(8, 12), -- VIEW_NUTRITION_ANALYSIS | |||
(8, 26), -- MAINTAIN_DIETARY_ADVICE | |||
(8, 27), -- VIEW_DIETARY_ADVICE | |||
-- data view permission | |||
(8, 14), -- VIEW_HEALTH_DATA | |||
(8, 16), -- VIEW_ALLERGY_DATA | |||
(8, 8), -- VIEW_FOOD_INTAKE | |||
-- report generation | |||
(8, 19), -- G_NUTRITION_TREND_REPORT | |||
(8, 20); -- G_HEALTH_STATISTICS_REPORT |
@@ -0,0 +1,12 @@ | |||
--liquibase formatted sql | |||
--changeset terence:create-i18n-table | |||
--comment: Create i18n table | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- Access Control Management | |||
(32, 'MAINTAIN_MENU_ITEM', 'Maintain Menu Item', null, null), | |||
(33, 'VIEW_MENU_ITEM', 'View Menu Item', null, null), | |||
(34, 'MAINTAIN_INGREDIENT', 'Maintain Ingredient', null, null), | |||
(35, 'VIEW_INGREDIENT', 'View Ingredient', null, null), | |||
(36, 'MAINTAIN_MENU_OUTLET', 'Maintain Menu Outlet', null, null), | |||
(37, 'VIEW_MENU_OUTLET', 'View Menu Outlet', null, null); |
@@ -0,0 +1,61 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
-- 插入权限数据(添加条件检查) | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 38, 'MAINTAIN_FB_OPERATOR', 'Maintain F&B Operator', 'F&B', 'Permission to maintain F&B operator information' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'MAINTAIN_FB_OPERATOR'); | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 39, 'VIEW_FB_OPERATOR', 'View F&B Operator', 'F&B', 'Permission to view F&B operator information' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'VIEW_FB_OPERATOR'); | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 40, 'MAINTAIN_FB_OUTLET', 'Maintain F&B Outlet', 'F&B', 'Permission to maintain F&B outlet information' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'MAINTAIN_FB_OUTLET'); | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 41, 'VIEW_FB_OUTLET', 'View F&B Outlet', 'F&B', 'Permission to view F&B outlet information' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'VIEW_FB_OUTLET'); | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 42, 'MAINTAIN_MENU_OUTLET', 'Maintain Menu Outlet', 'F&B', 'Permission to maintain menu-outlet relationship' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'MAINTAIN_MENU_OUTLET'); | |||
INSERT INTO authority (id, authority, name, module, description) | |||
SELECT 43, 'VIEW_MENU_OUTLET', 'View Menu Outlet', 'F&B', 'Permission to view menu-outlet relationship' | |||
WHERE NOT EXISTS (SELECT 1 FROM authority WHERE authority = 'VIEW_MENU_OUTLET'); | |||
-- 插入用户权限关联(添加条件检查) | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 38 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 38); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 39 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 39); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 40 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 40); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 41 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 41); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 42 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 42); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 43 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 43); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 32 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 32); | |||
INSERT INTO user_authority (userId, authId) | |||
SELECT 6, 33 | |||
WHERE NOT EXISTS (SELECT 1 FROM user_authority WHERE userId = 6 AND authId = 33); |
@@ -0,0 +1,25 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
-- 插入权限数据(使用INSERT IGNORE避免重复) | |||
INSERT IGNORE INTO authority (id, authority, name, module, description) | |||
VALUES | |||
(38, 'MAINTAIN_FB_OPERATOR', 'Maintain F&B Operator', 'F&B', 'Permission to maintain F&B operator information'), | |||
(39, 'VIEW_FB_OPERATOR', 'View F&B Operator', 'F&B', 'Permission to view F&B operator information'), | |||
(40, 'MAINTAIN_FB_OUTLET', 'Maintain F&B Outlet', 'F&B', 'Permission to maintain F&B outlet information'), | |||
(41, 'VIEW_FB_OUTLET', 'View F&B Outlet', 'F&B', 'Permission to view F&B outlet information'), | |||
(42, 'MAINTAIN_MENU_OUTLET', 'Maintain Menu Outlet', 'F&B', 'Permission to maintain menu-outlet relationship'), | |||
(43, 'VIEW_MENU_OUTLET', 'View Menu Outlet', 'F&B', 'Permission to view menu-outlet relationship'); | |||
-- 插入用户权限关联(使用INSERT IGNORE避免重复) | |||
INSERT IGNORE INTO user_authority (userId, authId) | |||
VALUES | |||
(6, 38), | |||
(6, 39), | |||
(6, 40), | |||
(6, 41), | |||
(6, 42), | |||
(6, 43), | |||
(6, 32), | |||
(6, 33); |
@@ -0,0 +1,66 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
drop table if exists authority; | |||
CREATE TABLE `authority` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`authority` varchar(100) NOT NULL, | |||
`name` varchar(255) NOT NULL, | |||
`module` varchar(100) DEFAULT NULL, | |||
`description` varchar(500) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `uk_authority` (`authority`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- User Management | |||
(1, 'MAINTAIN_USER', 'Maintain User', null, null), | |||
(2, 'VIEW_USER', 'View User', null, null), | |||
(3, 'MAINTAIN_GROUP', 'Maintain User Group', null, null), | |||
(4, 'VIEW_USER_GROUP', 'View User Group', null, null), | |||
-- Food and Menu Management | |||
(5, 'MAINTAIN_FOOD_MENU', 'Maintain Food Menu' , null, null), | |||
(6, 'VIEW_FOOD_MENU', 'View Food Menu', null, null), | |||
(7, 'MAINTAIN_FOOD_INTAKE', 'Maintain Food Intake', null, null), | |||
(8, 'VIEW_FOOD_INTAKE', 'View Food Intake', null, null), | |||
-- Nutrition Management | |||
(9, 'MAINTAIN_NUTRITION_STANDARD', 'Maintain Nutrition Standard', null, null), | |||
(10, 'VIEW_NUTRITION_STANDARD', 'View Nutrition Standard', null, null), | |||
(11, 'MAINTAIN_NUTRITION_ANALYSIS', 'Maintain Nutrition Analysis', null, null), | |||
(12, 'VIEW_NUTRITION_ANALYSIS', 'View Nutrition Analysis', null, null), | |||
-- Health Data Management | |||
(13, 'MAINTAIN_HEALTH_DATA', 'Maintain Health Data', null, null), | |||
(14, 'VIEW_HEALTH_DATA', 'View Health Data', null, null), | |||
(15, 'MAINTAIN_ALLERGY_DATA', 'Maintain Allergy Data', null, null), | |||
(16, 'VIEW_ALLERGY_DATA', 'View Allergy Data', null, null), | |||
-- AI Model Management | |||
(17, 'MAINTAIN_AI_MODEL', 'Maintain AI Model', null, null), | |||
(18, 'VIEW_AI_MODEL', 'View AI Model', null, null), | |||
-- Report Generation | |||
(19, 'G_NUTRITION_TREND_REPORT', 'Generate Nutrition Trend Report', null, null), | |||
(20, 'G_HEALTH_STATISTICS_REPORT', 'Generate Health Statistics Report', null, null), | |||
(21, 'G_FOOD_LEFTOVER_REPORT', 'Generate Food Leftover Report', null, null), | |||
-- F&B Management | |||
(22, 'MAINTAIN_FB_OPERATOR', 'Maintain Food Operator', null, null), | |||
(23, 'VIEW_FB_OPERATOR', 'View Food Operator', null, null), | |||
(24, 'MAINTAIN_FB_OUTLET', 'Maintain Food Outlet', null, null), | |||
(25, 'VIEW_FB_OUTLET', 'View Food Outlet', null, null), | |||
-- Dietary Advice Management | |||
(26, 'MAINTAIN_DIETARY_ADVICE', 'Maintain Dietary Advice', null, null), | |||
(27, 'VIEW_DIETARY_ADVICE', 'View Dietary Advice', null, null), | |||
-- Access Control Management | |||
(28, 'MAINTAIN_ACCESS_CONTROL', 'Maintain Access Control', null, null), | |||
(29, 'VIEW_ACCESS_CONTROL', 'View Access Control', null, null), | |||
(30, 'MAINTAIN_ACCESS_DELEGATION', 'Maintain Access Delegation', null, null), | |||
(31, 'VIEW_ACCESS_DELEGATION', 'View Access Delegation', null, null); | |||
@@ -0,0 +1,66 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
drop table if exists authority; | |||
CREATE TABLE `authority` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`authority` varchar(100) NOT NULL, | |||
`name` varchar(255) NOT NULL, | |||
`module` varchar(100) DEFAULT NULL, | |||
`description` varchar(500) DEFAULT NULL, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `uk_authority` (`authority`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- User Management | |||
(1, 'MAINTAIN_USER', 'Maintain User', null, null), | |||
(2, 'VIEW_USER', 'View User', null, null), | |||
(3, 'MAINTAIN_GROUP', 'Maintain User Group', null, null), | |||
(4, 'VIEW_USER_GROUP', 'View User Group', null, null), | |||
-- Food and Menu Management | |||
(5, 'MAINTAIN_FOOD_MENU', 'Maintain Food Menu' , null, null), | |||
(6, 'VIEW_FOOD_MENU', 'View Food Menu', null, null), | |||
(7, 'MAINTAIN_FOOD_INTAKE', 'Maintain Food Intake', null, null), | |||
(8, 'VIEW_FOOD_INTAKE', 'View Food Intake', null, null), | |||
-- Nutrition Management | |||
(9, 'MAINTAIN_NUTRITION_STANDARD', 'Maintain Nutrition Standard', null, null), | |||
(10, 'VIEW_NUTRITION_STANDARD', 'View Nutrition Standard', null, null), | |||
(11, 'MAINTAIN_NUTRITION_ANALYSIS', 'Maintain Nutrition Analysis', null, null), | |||
(12, 'VIEW_NUTRITION_ANALYSIS', 'View Nutrition Analysis', null, null), | |||
-- Health Data Management | |||
(13, 'MAINTAIN_HEALTH_DATA', 'Maintain Health Data', null, null), | |||
(14, 'VIEW_HEALTH_DATA', 'View Health Data', null, null), | |||
(15, 'MAINTAIN_ALLERGY_DATA', 'Maintain Allergy Data', null, null), | |||
(16, 'VIEW_ALLERGY_DATA', 'View Allergy Data', null, null), | |||
-- AI Model Management | |||
(17, 'MAINTAIN_AI_MODEL', 'Maintain AI Model', null, null), | |||
(18, 'VIEW_AI_MODEL', 'View AI Model', null, null), | |||
-- Report Generation | |||
(19, 'G_NUTRITION_TREND_REPORT', 'Generate Nutrition Trend Report', null, null), | |||
(20, 'G_HEALTH_STATISTICS_REPORT', 'Generate Health Statistics Report', null, null), | |||
(21, 'G_FOOD_LEFTOVER_REPORT', 'Generate Food Leftover Report', null, null), | |||
-- F&B Management | |||
(22, 'MAINTAIN_FB_OPERATOR', 'Maintain Food Operator', null, null), | |||
(23, 'VIEW_FB_OPERATOR', 'View Food Operator', null, null), | |||
(24, 'MAINTAIN_FB_OUTLET', 'Maintain Food Outlet', null, null), | |||
(25, 'VIEW_FB_OUTLET', 'View Food Outlet', null, null), | |||
-- Dietary Advice Management | |||
(26, 'MAINTAIN_DIETARY_ADVICE', 'Maintain Dietary Advice', null, null), | |||
(27, 'VIEW_DIETARY_ADVICE', 'View Dietary Advice', null, null), | |||
-- Access Control Management | |||
(28, 'MAINTAIN_ACCESS_CONTROL', 'Maintain Access Control', null, null), | |||
(29, 'VIEW_ACCESS_CONTROL', 'View Access Control', null, null), | |||
(30, 'MAINTAIN_ACCESS_DELEGATION', 'Maintain Access Delegation', null, null), | |||
(31, 'VIEW_ACCESS_DELEGATION', 'View Access Delegation', null, null); | |||
@@ -0,0 +1,16 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
INSERT INTO authority (id, authority, name, module, description) VALUES | |||
-- Access Control Management | |||
(32, 'MAINTAIN_MENU_ITEM', 'Maintain Menu Item', null, null), | |||
(33, 'VIEW_MENU_ITEM', 'View Menu Item', null, null), | |||
(34, 'MAINTAIN_INGREDIENT', 'Maintain Ingredient', null, null), | |||
(35, 'VIEW_INGREDIENT', 'View Ingredient', null, null), | |||
(36, 'MAINTAIN_MENU_OUTLET', 'Maintain Menu Outlet', null, null), | |||
(37, 'VIEW_MENU_OUTLET', 'View Menu Outlet', null, null); | |||
@@ -0,0 +1,17 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
ALTER TABLE `FB_Operator` DROP COLUMN created_at; | |||
-- 添加 BaseEntity 需要的字段 | |||
ALTER TABLE `FB_Operator` | |||
ADD COLUMN `created` timestamp NULL, | |||
ADD COLUMN `createdBy` varchar(255) NULL, | |||
ADD COLUMN `modified` timestamp NULL, | |||
ADD COLUMN `modifiedBy` varchar(255) NULL, | |||
ADD COLUMN `deleted` bit(1) DEFAULT 0, | |||
ADD COLUMN `version` int DEFAULT 0; | |||
@@ -0,0 +1,17 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
ALTER TABLE `fb_outlets` DROP COLUMN created_at; | |||
-- 添加 BaseEntity 需要的字段 | |||
ALTER TABLE `fb_outlets` | |||
ADD COLUMN `created` timestamp NULL, | |||
ADD COLUMN `createdBy` varchar(255) NULL, | |||
ADD COLUMN `modified` timestamp NULL, | |||
ADD COLUMN `modifiedBy` varchar(255) NULL, | |||
ADD COLUMN `deleted` bit(1) DEFAULT 0, | |||
ADD COLUMN `version` int DEFAULT 0; | |||
@@ -0,0 +1,13 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
-- 添加 BaseEntity 需要的字段 | |||
ALTER TABLE `i18n` | |||
ADD COLUMN `deleted` bit(1) DEFAULT 0, | |||
ADD COLUMN `version` int DEFAULT 0; | |||
@@ -0,0 +1,72 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- ARestaurantManager (userid 6) - 可以查看和编辑 | |||
(6, 5), -- MAINTAIN_FOOD_MENU | |||
(6, 6), -- VIEW_FOOD_MENU | |||
(6, 7), -- MAINTAIN_FOOD_INTAKE | |||
(6, 8), -- VIEW_FOOD_INTAKE | |||
(6, 32), -- MAINTAIN_MENU_ITEM | |||
(6, 33), -- VIEW_MENU_ITEM | |||
(6, 34), -- MAINTAIN_INGREDIENT | |||
(6, 35), -- VIEW_INGREDIENT | |||
(6, 36), -- MAINTAIN_MENU_OUTLET | |||
(6, 37), -- VIEW_MENU_OUTLET | |||
-- ARestaurantclerk (userid 8) - 只能查看 | |||
(8, 6), -- VIEW_FOOD_MENU | |||
(8, 8), -- VIEW_FOOD_INTAKE | |||
(8, 33), -- VIEW_MENU_ITEM | |||
(8, 35), -- VIEW_INGREDIENT | |||
(8, 37), -- VIEW_MENU_OUTLET | |||
-- BRestaurantManager (userid 10) - 可以查看和编辑 | |||
(10, 5), -- MAINTAIN_FOOD_MENU | |||
(10, 6), -- VIEW_FOOD_MENU | |||
(10, 7), -- MAINTAIN_FOOD_INTAKE | |||
(10, 8), -- VIEW_FOOD_INTAKE | |||
(10, 32), -- MAINTAIN_MENU_ITEM | |||
(10, 33), -- VIEW_MENU_ITEM | |||
(10, 34), -- MAINTAIN_INGREDIENT | |||
(10, 35), -- VIEW_INGREDIENT | |||
(10, 36), -- MAINTAIN_MENU_OUTLET | |||
(10, 37), -- VIEW_MENU_OUTLET | |||
-- BRestaurantclerk (userid 11) - 只能查看 | |||
(11, 6), -- VIEW_FOOD_MENU | |||
(11, 8), -- VIEW_FOOD_INTAKE | |||
(11, 33), -- VIEW_MENU_ITEM | |||
(11, 35), -- VIEW_INGREDIENT | |||
(11, 37), -- VIEW_MENU_OUTLET | |||
-- ASchoolheadmaster (userid 12) - 可以查看和编辑 | |||
(12, 13), -- MAINTAIN_HEALTH_DATA | |||
(12, 14), -- VIEW_HEALTH_DATA | |||
(12, 15), -- MAINTAIN_ALLERGY_DATA | |||
(12, 16), -- VIEW_ALLERGY_DATA | |||
(12, 26), -- MAINTAIN_DIETARY_ADVICE | |||
(12, 27), -- VIEW_DIETARY_ADVICE | |||
(12, 20), -- G_HEALTH_STATISTICS_REPORT | |||
-- ASchoolteacher (userid 13) - 只能查看 | |||
(13, 14), -- VIEW_HEALTH_DATA | |||
(13, 16), -- VIEW_ALLERGY_DATA | |||
(13, 27), -- VIEW_DIETARY_ADVICE | |||
-- BSchoolheadmaster (userid 14) - 可以查看和编辑 | |||
(14, 13), -- MAINTAIN_HEALTH_DATA | |||
(14, 14), -- VIEW_HEALTH_DATA | |||
(14, 15), -- MAINTAIN_ALLERGY_DATA | |||
(14, 16), -- VIEW_ALLERGY_DATA | |||
(14, 26), -- MAINTAIN_DIETARY_ADVICE | |||
(14, 27), -- VIEW_DIETARY_ADVICE | |||
(14, 20), -- G_HEALTH_STATISTICS_REPORT | |||
-- BSchoolteacher (userid 15) - 只能查看 | |||
(15, 14), -- VIEW_HEALTH_DATA | |||
(15, 16), -- VIEW_ALLERGY_DATA | |||
(15, 27); -- VIEW_DIETARY_ADVICE |
@@ -0,0 +1,25 @@ | |||
--liquibase formatted sql | |||
--changeset terence:62-insert-fb-permissions | |||
--comment: Insert F&B related permissions and user authorities | |||
INSERT INTO user_authority (userId, authId) VALUES | |||
-- ARestaurantManager (userid 6) - 可以查看和编辑 | |||
(6, 22), -- MAINTAIN_FB_OPERATOR | |||
(6, 23), -- VIEW_FB_OPERATOR | |||
(6, 24), -- MAINTAIN_FB_OUTLET | |||
(6, 25), -- VIEW_FB_OUTLET | |||
-- ARestaurantclerk (userid 8) - 只能查看 | |||
(8, 23), -- VIEW_FOOD_MENU | |||
(8, 25), -- VIEW_FOOD_INTAKE | |||
-- BRestaurantManager (userid 10) - 可以查看和编辑 | |||
(10, 22), -- MAINTAIN_FB_OPERATOR | |||
(10, 23), -- VIEW_FB_OPERATOR | |||
(10, 24), -- MAINTAIN_FB_OUTLET | |||
(10, 25), -- VIEW_FB_OUTLET | |||
-- BRestaurantclerk (userid 11) - 只能查看 | |||
(11, 23), -- VIEW_FOOD_MENU | |||
(11, 25); -- VIEW_FOOD_INTAKE | |||
@@ -0,0 +1,24 @@ | |||
--liquibase formatted sql | |||
--changeset terence:72-create-fb_operator_and_organization_relationship-table | |||
--comment: Insert F&B related permissions and user authorities | |||
CREATE TABLE `fb_operator_and_organization_relationship` ( | |||
`id` int NOT NULL AUTO_INCREMENT, | |||
`FB_id` int NOT NULL, | |||
`User_Grp_Org_ID` int NOT NULL, | |||
`created` timestamp NULL, | |||
`createdBy` varchar(255) NULL, | |||
`modified` timestamp NULL, | |||
`modifiedBy` varchar(255) NULL, | |||
`deleted` bit(1) DEFAULT 0, | |||
`version` int DEFAULT 0, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |||
INSERT INTO `fb_operator_and_organization_relationship` | |||
(id, FB_id, User_Grp_Org_ID) VALUES | |||
-- User Management | |||
(1, 1, 1), | |||
(2, 2, 2), | |||
(3, 3, 2), | |||
(4, 4, 1); |
@@ -0,0 +1,8 @@ | |||
--liquibase formatted sql | |||
--changeset terence:72-create-fb_operator_and_organization_relationship-table | |||
--comment: Insert F&B related permissions and user authorities | |||
ALTER TABLE user_authority | |||
DROP PRIMARY KEY, | |||
ADD COLUMN id BIGINT AUTO_INCREMENT PRIMARY KEY FIRST, | |||
ADD UNIQUE KEY unique_user_auth (userId, authId); |
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:72-create-fb_operator_and_organization_relationship-table | |||
--comment: Insert F&B related permissions and user authorities | |||
ALTER TABLE user_authority | |||
ADD COLUMN `created` timestamp NULL, | |||
ADD COLUMN `createdBy` varchar(255) NULL, | |||
ADD COLUMN `modified` timestamp NULL, | |||
ADD COLUMN `modifiedBy` varchar(255) NULL, | |||
ADD COLUMN `deleted` bit(1) DEFAULT 0, | |||
ADD COLUMN `version` int DEFAULT 0; |
@@ -0,0 +1,11 @@ | |||
--liquibase formatted sql | |||
--changeset terence:72-create-fb_operator_and_organization_relationship-table | |||
--comment: Insert F&B related permissions and user authorities | |||
ALTER TABLE user_group_members | |||
ADD COLUMN `created` timestamp NULL, | |||
ADD COLUMN `createdBy` varchar(255) NULL, | |||
ADD COLUMN `modified` timestamp NULL, | |||
ADD COLUMN `modifiedBy` varchar(255) NULL, | |||
ADD COLUMN `deleted` bit(1) DEFAULT 0, | |||
ADD COLUMN `version` int DEFAULT 0; |
@@ -0,0 +1,25 @@ | |||
--liquibase formatted sql | |||
--changeset terence:72-create-fb_operator_and_organization_relationship-table | |||
--comment: Insert F&B related permissions and user authorities | |||
-- First, drop the foreign key constraint | |||
ALTER TABLE user_group_members | |||
DROP FOREIGN KEY user_group_members_ibfk_1; | |||
-- Then drop the primary key | |||
ALTER TABLE user_group_members | |||
DROP PRIMARY KEY; | |||
-- Add the new id column | |||
ALTER TABLE user_group_members | |||
ADD COLUMN id BIGINT AUTO_INCREMENT PRIMARY KEY; | |||
-- Re-add the foreign key constraint | |||
ALTER TABLE user_group_members | |||
ADD CONSTRAINT user_group_members_ibfk_1 | |||
FOREIGN KEY (User_Grp_Org_ID) | |||
REFERENCES user_group_organization (User_Grp_Org_ID); | |||
-- Add unique constraint for the original composite key | |||
ALTER TABLE user_group_members | |||
ADD CONSTRAINT uk_org_user UNIQUE (User_Grp_Org_ID, User_ID); |
@@ -0,0 +1,26 @@ | |||
--liquibase formatted sql | |||
--changeset terence:77-create-embedding-table | |||
--comment: Insert F&B related permissions and user authorities | |||
--liquibase formatted sql | |||
--changeset yourname:001-create-menu_item-table | |||
ALTER TABLE fb_menu | |||
Add category VARCHAR(50), | |||
Add price DECIMAL(10,2), | |||
Add is_vegetarian BOOLEAN DEFAULT FALSE, | |||
Add is_vegan BOOLEAN DEFAULT FALSE, | |||
Add is_gluten_free BOOLEAN DEFAULT FALSE, | |||
Add is_spicy BOOLEAN DEFAULT FALSE | |||
--changeset yourname:004-create-menu_embedding-table | |||
CREATE TABLE menu_item_base_embedding ( | |||
embedding_id INT NOT NULL AUTO_INCREMENT, | |||
FB_menu_id INT NOT NULL, | |||
embedding_vector JSON NOT NULL, | |||
embedding_text TEXT NOT NULL, | |||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (embedding_id), | |||
FOREIGN KEY (FB_menu_id) REFERENCES fb_menu(FB_menu_id) ON DELETE CASCADE | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
@@ -0,0 +1,18 @@ | |||
--liquibase formatted sql | |||
--changeset terence:77-create-embedding-table | |||
--comment: Insert F&B related permissions and user authorities | |||
--liquibase formatted sql | |||
--changeset yourname:001-create-menu_item-table | |||
CREATE TABLE fboperator ( | |||
id INT AUTO_INCREMENT PRIMARY KEY, | |||
FB_name VARCHAR(255) NOT NULL, | |||
FB_operator_address VARCHAR(255), | |||
FB_operator_phone VARCHAR(255), | |||
created TIMESTAMP, | |||
createdBy VARCHAR(255), | |||
modified TIMESTAMP, | |||
modifiedBy VARCHAR(255), | |||
deleted BIT(1), | |||
version INT | |||
); |
@@ -0,0 +1,18 @@ | |||
--liquibase formatted sql | |||
--changeset terence:77-create-embedding-table | |||
--comment: Insert F&B related permissions and user authorities | |||
--liquibase formatted sql | |||
--changeset yourname:001-create-menu_item-table | |||
CREATE TABLE fb_operator_backup AS SELECT * FROM fb_operator; | |||
ALTER TABLE fb_operator | |||
ADD COLUMN FB_operator_id INT NULL AFTER FB_id; | |||
ALTER TABLE fb_operator | |||
CHANGE COLUMN FB_id id INT AUTO_INCREMENT; | |||
RENAME TABLE fb_operator TO fb_brand; |
@@ -0,0 +1,30 @@ | |||
--liquibase formatted sql | |||
--changeset terence:77-create-embedding-table | |||
--comment: Insert F&B related permissions and user authorities | |||
--liquibase formatted sql | |||
--changeset yourname:001-create-menu_item-table | |||
CREATE TABLE fb_group ( | |||
id INT AUTO_INCREMENT PRIMARY KEY, | |||
FB_brand_id INT NOT NULL, | |||
FB_group_name VARCHAR(255) NOT NULL, | |||
created TIMESTAMP, | |||
createdBy VARCHAR(255), | |||
modified TIMESTAMP, | |||
modifiedBy VARCHAR(255), | |||
deleted BIT(1), | |||
version INT | |||
); | |||
CREATE TABLE fb_group_relationship ( | |||
id INT AUTO_INCREMENT PRIMARY KEY, | |||
Fb_brand_id INT NOT NULL, | |||
FB_group_id INT NOT NULL, | |||
FB_menu_id INT NOT NULL, | |||
created TIMESTAMP, | |||
createdBy VARCHAR(255), | |||
modified TIMESTAMP, | |||
modifiedBy VARCHAR(255), | |||
deleted BIT(1), | |||
version INT | |||
); |
@@ -0,0 +1,3 @@ | |||
databaseChangeLog: | |||
- includeAll: | |||
path: classpath:/db/changelog/changes |
@@ -0,0 +1,30 @@ | |||
Configutation: | |||
name: Prod-Default | |||
Properties: | |||
Property: | |||
name: log_location | |||
value: /usr/springboot/logs/ | |||
Appenders: | |||
RollingFile: | |||
- name: AllRollingFile_Appender | |||
fileName: ${log_location}fhsmsc-all.log | |||
filePattern: ${log_location}fhsmsc-all-%d{yyyy-MM-dd}.log.gz | |||
PatternLayout: | |||
Pattern: "%d %p [%l] - %m%n" | |||
Policies: | |||
TimeBasedTriggeringPolicy: | |||
interval: 1 | |||
modulate: true | |||
DefaultRolloverStrategy: | |||
Delete: | |||
basePath: ${log_location} | |||
maxDepth: 1 | |||
IfFileName: | |||
glob: fhsmsc-all-*.log.gz | |||
IfLastModified: | |||
age: P40D | |||
Loggers: | |||
Root: | |||
level: info | |||
AppenderRef: | |||
- ref: AllRollingFile_Appender |
@@ -0,0 +1,23 @@ | |||
Configutation: | |||
name: Prod-Default | |||
Properties: | |||
Property: | |||
name: log_location | |||
value: C:/workspace/ | |||
Appenders: | |||
RollingFile: | |||
name: RollingFile_Appender | |||
fileName: ${log_location}fhsmsc-all.log | |||
filePattern: ${log_location}fhsmsc-all.log.%i.gz | |||
PatternLayout: | |||
Pattern: "%d %p [%l] - %m%n" | |||
Policies: | |||
SizeBasedTriggeringPolicy: | |||
size: 4096KB | |||
DefaultRollOverStrategy: | |||
max: 99 | |||
Loggers: | |||
Root: | |||
level: info | |||
AppenderRef: | |||
- ref: RollingFile_Appender |
@@ -0,0 +1,17 @@ | |||
Configutation: | |||
name: Default | |||
Properties: | |||
Property: | |||
name: log_pattern | |||
value: "%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} : %m%n%ex" | |||
Appenders: | |||
Console: | |||
name: Console_Appender | |||
target: SYSTEM_OUT | |||
PatternLayout: | |||
pattern: ${log_pattern} | |||
Loggers: | |||
Root: | |||
level: info | |||
AppenderRef: | |||
- ref: Console_Appender |
@@ -0,0 +1,69 @@ | |||
plugins { | |||
id 'war' | |||
id 'java' | |||
id 'org.springframework.boot' version '3.1.9' | |||
id 'io.spring.dependency-management' version '1.1.0' | |||
} | |||
group = 'com.ffii' | |||
version = '0.0.1-SNAPSHOT' | |||
java { | |||
sourceCompatibility = '17' | |||
} | |||
repositories { | |||
mavenCentral() | |||
} | |||
dependencies { | |||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | |||
implementation 'org.springframework.boot:spring-boot-starter-mail' | |||
implementation 'org.springframework.boot:spring-boot-starter-security' | |||
implementation 'org.springframework.boot:spring-boot-starter-web' | |||
implementation 'org.springframework.boot:spring-boot-starter-validation' | |||
implementation 'org.springframework.boot:spring-boot-starter-log4j2' | |||
implementation 'org.liquibase:liquibase-core' | |||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' | |||
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.3' | |||
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3' | |||
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: '3.0.0' | |||
implementation group: 'jakarta.persistence', name: 'jakarta.persistence-api', version: '3.1.0' | |||
implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1' | |||
implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' | |||
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.2' | |||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2' | |||
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5' | |||
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5' | |||
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' | |||
implementation group: 'org.bytedeco', name: 'ffmpeg-platform', version: '5.1.2-1.5.8' | |||
implementation group: 'org.bytedeco', name: 'javacv', version: '1.5.8' | |||
implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.32' | |||
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | |||
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.2' | |||
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.2' | |||
implementation group: 'org.docx4j', name: 'docx4j-core', version: '11.4.11' | |||
implementation group: 'org.docx4j', name: 'docx4j-JAXB-ReferenceImpl', version: '11.4.11' | |||
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' | |||
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0' | |||
implementation 'mysql:mysql-connector-java:8.0.33' | |||
runtimeOnly 'com.mysql:mysql-connector-j' | |||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | |||
testImplementation 'org.springframework.security:spring-security-test' | |||
} | |||
configurations { | |||
all { | |||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
distributionBase=GRADLE_USER_HOME | |||
distributionPath=wrapper/dists | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | |||
networkTimeout=10000 | |||
zipStoreBase=GRADLE_USER_HOME | |||
zipStorePath=wrapper/dists |
@@ -0,0 +1,240 @@ | |||
#!/bin/sh | |||
# | |||
# Copyright © 2015-2021 the original authors. | |||
# | |||
# Licensed under the Apache License, Version 2.0 (the "License"); | |||
# you may not use this file except in compliance with the License. | |||
# You may obtain a copy of the License at | |||
# | |||
# https://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# | |||
############################################################################## | |||
# | |||
# Gradle start up script for POSIX generated by Gradle. | |||
# | |||
# Important for running: | |||
# | |||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is | |||
# noncompliant, but you have some other compliant shell such as ksh or | |||
# bash, then to run this script, type that shell name before the whole | |||
# command line, like: | |||
# | |||
# ksh Gradle | |||
# | |||
# Busybox and similar reduced shells will NOT work, because this script | |||
# requires all of these POSIX shell features: | |||
# * functions; | |||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», | |||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»; | |||
# * compound commands having a testable exit status, especially «case»; | |||
# * various built-in commands including «command», «set», and «ulimit». | |||
# | |||
# Important for patching: | |||
# | |||
# (2) This script targets any POSIX shell, so it avoids extensions provided | |||
# by Bash, Ksh, etc; in particular arrays are avoided. | |||
# | |||
# The "traditional" practice of packing multiple parameters into a | |||
# space-separated string is a well documented source of bugs and security | |||
# problems, so this is (mostly) avoided, by progressively accumulating | |||
# options in "$@", and eventually passing that to Java. | |||
# | |||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, | |||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; | |||
# see the in-line comments for details. | |||
# | |||
# There are tweaks for specific operating systems such as AIX, CygWin, | |||
# Darwin, MinGW, and NonStop. | |||
# | |||
# (3) This script is generated from the Groovy template | |||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | |||
# within the Gradle project. | |||
# | |||
# You can find Gradle at https://github.com/gradle/gradle/. | |||
# | |||
############################################################################## | |||
# Attempt to set APP_HOME | |||
# Resolve links: $0 may be a link | |||
app_path=$0 | |||
# Need this for daisy-chained symlinks. | |||
while | |||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path | |||
[ -h "$app_path" ] | |||
do | |||
ls=$( ls -ld "$app_path" ) | |||
link=${ls#*' -> '} | |||
case $link in #( | |||
/*) app_path=$link ;; #( | |||
*) app_path=$APP_HOME$link ;; | |||
esac | |||
done | |||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit | |||
APP_NAME="Gradle" | |||
APP_BASE_NAME=${0##*/} | |||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | |||
# Use the maximum available, or set MAX_FD != -1 to use that value. | |||
MAX_FD=maximum | |||
warn () { | |||
echo "$*" | |||
} >&2 | |||
die () { | |||
echo | |||
echo "$*" | |||
echo | |||
exit 1 | |||
} >&2 | |||
# OS specific support (must be 'true' or 'false'). | |||
cygwin=false | |||
msys=false | |||
darwin=false | |||
nonstop=false | |||
case "$( uname )" in #( | |||
CYGWIN* ) cygwin=true ;; #( | |||
Darwin* ) darwin=true ;; #( | |||
MSYS* | MINGW* ) msys=true ;; #( | |||
NONSTOP* ) nonstop=true ;; | |||
esac | |||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |||
# Determine the Java command to use to start the JVM. | |||
if [ -n "$JAVA_HOME" ] ; then | |||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |||
# IBM's JDK on AIX uses strange locations for the executables | |||
JAVACMD=$JAVA_HOME/jre/sh/java | |||
else | |||
JAVACMD=$JAVA_HOME/bin/java | |||
fi | |||
if [ ! -x "$JAVACMD" ] ; then | |||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |||
Please set the JAVA_HOME variable in your environment to match the | |||
location of your Java installation." | |||
fi | |||
else | |||
JAVACMD=java | |||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |||
Please set the JAVA_HOME variable in your environment to match the | |||
location of your Java installation." | |||
fi | |||
# Increase the maximum file descriptors if we can. | |||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then | |||
case $MAX_FD in #( | |||
max*) | |||
MAX_FD=$( ulimit -H -n ) || | |||
warn "Could not query maximum file descriptor limit" | |||
esac | |||
case $MAX_FD in #( | |||
'' | soft) :;; #( | |||
*) | |||
ulimit -n "$MAX_FD" || | |||
warn "Could not set maximum file descriptor limit to $MAX_FD" | |||
esac | |||
fi | |||
# Collect all arguments for the java command, stacking in reverse order: | |||
# * args from the command line | |||
# * the main class name | |||
# * -classpath | |||
# * -D...appname settings | |||
# * --module-path (only if needed) | |||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. | |||
# For Cygwin or MSYS, switch paths to Windows format before running java | |||
if "$cygwin" || "$msys" ; then | |||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) | |||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) | |||
JAVACMD=$( cygpath --unix "$JAVACMD" ) | |||
# Now convert the arguments - kludge to limit ourselves to /bin/sh | |||
for arg do | |||
if | |||
case $arg in #( | |||
-*) false ;; # don't mess with options #( | |||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath | |||
[ -e "$t" ] ;; #( | |||
*) false ;; | |||
esac | |||
then | |||
arg=$( cygpath --path --ignore --mixed "$arg" ) | |||
fi | |||
# Roll the args list around exactly as many times as the number of | |||
# args, so each arg winds up back in the position where it started, but | |||
# possibly modified. | |||
# | |||
# NB: a `for` loop captures its iteration list before it begins, so | |||
# changing the positional parameters here affects neither the number of | |||
# iterations, nor the values presented in `arg`. | |||
shift # remove old arg | |||
set -- "$@" "$arg" # push replacement arg | |||
done | |||
fi | |||
# Collect all arguments for the java command; | |||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of | |||
# shell script including quotes and variable substitutions, so put them in | |||
# double quotes to make sure that they get re-expanded; and | |||
# * put everything else in single quotes, so that it's not re-expanded. | |||
set -- \ | |||
"-Dorg.gradle.appname=$APP_BASE_NAME" \ | |||
-classpath "$CLASSPATH" \ | |||
org.gradle.wrapper.GradleWrapperMain \ | |||
"$@" | |||
# Stop when "xargs" is not available. | |||
if ! command -v xargs >/dev/null 2>&1 | |||
then | |||
die "xargs is not available" | |||
fi | |||
# Use "xargs" to parse quoted args. | |||
# | |||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. | |||
# | |||
# In Bash we could simply go: | |||
# | |||
# readarray ARGS < <( xargs -n1 <<<"$var" ) && | |||
# set -- "${ARGS[@]}" "$@" | |||
# | |||
# but POSIX shell has neither arrays nor command substitution, so instead we | |||
# post-process each arg (as a line of input to sed) to backslash-escape any | |||
# character that might be a shell metacharacter, then use eval to reverse | |||
# that process (while maintaining the separation between arguments), and wrap | |||
# the whole thing up as a single "set" statement. | |||
# | |||
# This will of course break if any of these variables contains a newline or | |||
# an unmatched quote. | |||
# | |||
eval "set -- $( | |||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | | |||
xargs -n1 | | |||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | | |||
tr '\n' ' ' | |||
)" '"$@"' | |||
exec "$JAVACMD" "$@" |
@@ -0,0 +1,91 @@ | |||
@rem | |||
@rem Copyright 2015 the original author or authors. | |||
@rem | |||
@rem Licensed under the Apache License, Version 2.0 (the "License"); | |||
@rem you may not use this file except in compliance with the License. | |||
@rem You may obtain a copy of the License at | |||
@rem | |||
@rem https://www.apache.org/licenses/LICENSE-2.0 | |||
@rem | |||
@rem Unless required by applicable law or agreed to in writing, software | |||
@rem distributed under the License is distributed on an "AS IS" BASIS, | |||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
@rem See the License for the specific language governing permissions and | |||
@rem limitations under the License. | |||
@rem | |||
@if "%DEBUG%"=="" @echo off | |||
@rem ########################################################################## | |||
@rem | |||
@rem Gradle startup script for Windows | |||
@rem | |||
@rem ########################################################################## | |||
@rem Set local scope for the variables with windows NT shell | |||
if "%OS%"=="Windows_NT" setlocal | |||
set DIRNAME=%~dp0 | |||
if "%DIRNAME%"=="" set DIRNAME=. | |||
set APP_BASE_NAME=%~n0 | |||
set APP_HOME=%DIRNAME% | |||
@rem Resolve any "." and ".." in APP_HOME to make it shorter. | |||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | |||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | |||
@rem Find java.exe | |||
if defined JAVA_HOME goto findJavaFromJavaHome | |||
set JAVA_EXE=java.exe | |||
%JAVA_EXE% -version >NUL 2>&1 | |||
if %ERRORLEVEL% equ 0 goto execute | |||
echo. | |||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |||
echo. | |||
echo Please set the JAVA_HOME variable in your environment to match the | |||
echo location of your Java installation. | |||
goto fail | |||
:findJavaFromJavaHome | |||
set JAVA_HOME=%JAVA_HOME:"=% | |||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe | |||
if exist "%JAVA_EXE%" goto execute | |||
echo. | |||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | |||
echo. | |||
echo Please set the JAVA_HOME variable in your environment to match the | |||
echo location of your Java installation. | |||
goto fail | |||
:execute | |||
@rem Setup the command line | |||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |||
@rem Execute Gradle | |||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | |||
:end | |||
@rem End local scope for the variables with windows NT shell | |||
if %ERRORLEVEL% equ 0 goto mainEnd | |||
:fail | |||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |||
rem the _cmd.exe /c_ return code! | |||
set EXIT_CODE=%ERRORLEVEL% | |||
if %EXIT_CODE% equ 0 set EXIT_CODE=1 | |||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | |||
exit /b %EXIT_CODE% | |||
:mainEnd | |||
if "%OS%"=="Windows_NT" endlocal | |||
:omega |
@@ -0,0 +1,6 @@ | |||
{ | |||
"name": "FHSMS-C-backend", | |||
"lockfileVersion": 3, | |||
"requires": true, | |||
"packages": {} | |||
} |