| @@ -35,3 +35,6 @@ out/ | |||||
| ### VS Code ### | ### VS Code ### | ||||
| .vscode/ | .vscode/ | ||||
| ### JPA Buddy ### | |||||
| .jpb/ | |||||
| @@ -1,11 +1,9 @@ | |||||
| # Backend readme | |||||
| 1. Create a schema named "tsmsdb" in MySQL workbench | |||||
| 2. Put the launch.json file into the .vscode folder | |||||
| 3. Put the settings.json file into the .vscode folder | |||||
| 4. Run and Debug "Launch Local" | |||||
| # TSMS Backend | |||||
| # launch.json | |||||
| ``` | |||||
| ## Getting started | |||||
| 1. Create a schema named `tsmsdb` in MySQL workbench | |||||
| 2. Create a `launch.json` file and put it into the `.vscode` folder | |||||
| ```json | |||||
| { | { | ||||
| "version": "0.2.0", | "version": "0.2.0", | ||||
| "configurations": [ | "configurations": [ | ||||
| @@ -28,12 +26,24 @@ | |||||
| ] | ] | ||||
| } | } | ||||
| ``` | ``` | ||||
| # settings.json | |||||
| You may need to change some settings depending on your development environment | |||||
| ``` | |||||
| 3. Create a `settings.json` file and put it into the `.vscode` folder | |||||
| *(You may need to change some settings depending on your development environment)* | |||||
| ```json | |||||
| { | { | ||||
| "java.configuration.updateBuildConfiguration": "interactive", | "java.configuration.updateBuildConfiguration": "interactive", | ||||
| "java.jdt.ls.java.home": "C:\\java\\jdk-17.0.8", | "java.jdt.ls.java.home": "C:\\java\\jdk-17.0.8", | ||||
| "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable" | "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable" | ||||
| } | } | ||||
| ``` | |||||
| ``` | |||||
| 4. Run and Debug "Launch Local" | |||||
| ## Using gradle | |||||
| This project can also be run using gradle. | |||||
| ### Running the application | |||||
| After creating the table in MySQL, run | |||||
| ```shell | |||||
| SPRING_PROFILES_ACTIVE=db-local,ldap-local ./gradlew bootRun | |||||
| ``` | |||||
| @@ -22,10 +22,10 @@ dependencies { | |||||
| implementation 'org.springframework.boot:spring-boot-starter-security' | implementation 'org.springframework.boot:spring-boot-starter-security' | ||||
| implementation 'org.springframework.boot:spring-boot-starter-web' | implementation 'org.springframework.boot:spring-boot-starter-web' | ||||
| implementation 'org.springframework.boot:spring-boot-starter-validation' | implementation 'org.springframework.boot:spring-boot-starter-validation' | ||||
| implementation 'org.springframework.boot:spring-boot-starter-log4j2' | |||||
| implementation 'org.springframework.boot:spring-boot-starter-log4j2' | |||||
| implementation 'org.springframework.security:spring-security-ldap' | implementation 'org.springframework.security:spring-security-ldap' | ||||
| implementation 'org.liquibase:liquibase-core' | implementation 'org.liquibase:liquibase-core' | ||||
| implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' | 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', version: '5.2.3' | ||||
| implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3' | implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3' | ||||
| @@ -41,7 +41,7 @@ dependencies { | |||||
| implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' | implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' | ||||
| compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | ||||
| runtimeOnly 'com.mysql:mysql-connector-j' | runtimeOnly 'com.mysql:mysql-connector-j' | ||||
| runtimeOnly 'com.unboundid:unboundid-ldapsdk:6.0.9' | runtimeOnly 'com.unboundid:unboundid-ldapsdk:6.0.9' | ||||
| @@ -50,7 +50,7 @@ dependencies { | |||||
| } | } | ||||
| configurations { | configurations { | ||||
| all { | |||||
| exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' | |||||
| } | |||||
| configureEach { | |||||
| exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,158 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalTime; | |||||
| @Entity | |||||
| @Table(name = "company") | |||||
| public class Company extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "companyCode", length = 30) | |||||
| private String companyCode; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @Column(name = "brNo", length = 20) | |||||
| private String brNo; | |||||
| @Column(name = "contactName", length = 30) | |||||
| private String contactName; | |||||
| @Column(name = "phone", length = 20) | |||||
| private String phone; | |||||
| @Column(name = "otHourTo") | |||||
| private LocalTime otHourTo; | |||||
| @Column(name = "otHourFrom") | |||||
| private LocalTime otHourFrom; | |||||
| @Column(name = "normalHourTo") | |||||
| private LocalTime normalHourTo; | |||||
| @Column(name = "normalHourFrom") | |||||
| private LocalTime normalHourFrom; | |||||
| @Column(name = "currency", length = 20) | |||||
| private String currency; | |||||
| @Column(name = "address", length = 500) | |||||
| private String address; | |||||
| @Column(name = "district", length = 30) | |||||
| private String district; | |||||
| @Column(name = "email") | |||||
| private String email; | |||||
| public LocalTime getOtHourTo() { | |||||
| return otHourTo; | |||||
| } | |||||
| public void setOtHourTo(LocalTime otHourTo) { | |||||
| this.otHourTo = otHourTo; | |||||
| } | |||||
| public LocalTime getOtHourFrom() { | |||||
| return otHourFrom; | |||||
| } | |||||
| public void setOtHourFrom(LocalTime otHourFrom) { | |||||
| this.otHourFrom = otHourFrom; | |||||
| } | |||||
| public LocalTime getNormalHourTo() { | |||||
| return normalHourTo; | |||||
| } | |||||
| public void setNormalHourTo(LocalTime normalHourTo) { | |||||
| this.normalHourTo = normalHourTo; | |||||
| } | |||||
| public LocalTime getNormalHourFrom() { | |||||
| return normalHourFrom; | |||||
| } | |||||
| public void setNormalHourFrom(LocalTime normalHourFrom) { | |||||
| this.normalHourFrom = normalHourFrom; | |||||
| } | |||||
| public String getCurrency() { | |||||
| return currency; | |||||
| } | |||||
| public void setCurrency(String currency) { | |||||
| this.currency = currency; | |||||
| } | |||||
| public String getAddress() { | |||||
| return address; | |||||
| } | |||||
| public void setAddress(String address) { | |||||
| this.address = address; | |||||
| } | |||||
| public String getDistrict() { | |||||
| return district; | |||||
| } | |||||
| public void setDistrict(String district) { | |||||
| this.district = district; | |||||
| } | |||||
| public String getEmail() { | |||||
| return email; | |||||
| } | |||||
| public void setEmail(String email) { | |||||
| this.email = email; | |||||
| } | |||||
| public String getPhone() { | |||||
| return phone; | |||||
| } | |||||
| public void setPhone(String phone) { | |||||
| this.phone = phone; | |||||
| } | |||||
| public String getContactName() { | |||||
| return contactName; | |||||
| } | |||||
| public void setContactName(String contactName) { | |||||
| this.contactName = contactName; | |||||
| } | |||||
| public String getBrNo() { | |||||
| return brNo; | |||||
| } | |||||
| public void setBrNo(String brNo) { | |||||
| this.brNo = brNo; | |||||
| } | |||||
| public String getCompanyCode() { | |||||
| return companyCode; | |||||
| } | |||||
| public void setCompanyCode(String companyCode) { | |||||
| this.companyCode = companyCode; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalDate; | |||||
| @Entity | |||||
| @Table(name = "company_holiday") | |||||
| public class CompanyHoliday extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "date") | |||||
| private LocalDate date; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| public LocalDate getDate() { | |||||
| return date; | |||||
| } | |||||
| public void setDate(LocalDate date) { | |||||
| this.date = date; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface CompanyHolidayRepository extends AbstractRepository<CompanyHoliday, Long> { | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface CompanyRepository extends AbstractRepository<Company, Long> { | |||||
| } | |||||
| @@ -0,0 +1,101 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "customer") | |||||
| public class Customer extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| @Column(name = "address", length = 500) | |||||
| private String address; | |||||
| @Column(name = "district", length = 30) | |||||
| private String district; | |||||
| @Column(name = "email") | |||||
| private String email; | |||||
| @Column(name = "phone", length = 20) | |||||
| private String phone; | |||||
| @Column(name = "contactName", length = 30) | |||||
| private String contactName; | |||||
| @Column(name = "brNo", length = 20) | |||||
| private String brNo; | |||||
| public String getAddress() { | |||||
| return address; | |||||
| } | |||||
| public void setAddress(String address) { | |||||
| this.address = address; | |||||
| } | |||||
| public String getDistrict() { | |||||
| return district; | |||||
| } | |||||
| public void setDistrict(String district) { | |||||
| this.district = district; | |||||
| } | |||||
| public String getEmail() { | |||||
| return email; | |||||
| } | |||||
| public void setEmail(String email) { | |||||
| this.email = email; | |||||
| } | |||||
| public String getPhone() { | |||||
| return phone; | |||||
| } | |||||
| public void setPhone(String phone) { | |||||
| this.phone = phone; | |||||
| } | |||||
| public String getContactName() { | |||||
| return contactName; | |||||
| } | |||||
| public void setContactName(String contactName) { | |||||
| this.contactName = contactName; | |||||
| } | |||||
| public String getBrNo() { | |||||
| return brNo; | |||||
| } | |||||
| public void setBrNo(String brNo) { | |||||
| this.brNo = brNo; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface CustomerRepository extends AbstractRepository<Customer, Long> { | |||||
| } | |||||
| @@ -0,0 +1,35 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.IdEntity; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.JoinColumn; | |||||
| import jakarta.persistence.ManyToOne; | |||||
| import jakarta.persistence.Table; | |||||
| @Entity | |||||
| @Table(name = "customer_subsidiary") | |||||
| public class CustomerSubsidiary extends IdEntity<Long> { | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "customerId") | |||||
| private Customer customer; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "subsidiaryId") | |||||
| private Subsidiary subsidiary; | |||||
| public Subsidiary getSubsidiary() { | |||||
| return subsidiary; | |||||
| } | |||||
| public void setSubsidiary(Subsidiary subsidiary) { | |||||
| this.subsidiary = subsidiary; | |||||
| } | |||||
| public Customer getCustomer() { | |||||
| return customer; | |||||
| } | |||||
| public void setCustomerId(Customer customer) { | |||||
| this.customer = customer; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "department") | |||||
| public class Department extends BaseEntity<Long> { | |||||
| @Column(name = "description", length = 1500) | |||||
| private String description; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface DepartmentRepository extends AbstractRepository<Department, Long> { | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "grade") | |||||
| public class Grade extends BaseEntity<Long> { | |||||
| @Column(name = "description", length = 1500) | |||||
| private String description; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface GradeRepository extends AbstractRepository<Grade, Long> { | |||||
| } | |||||
| @@ -0,0 +1,81 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalDate; | |||||
| @Entity | |||||
| @Table(name = "internal_rate") | |||||
| public class InternalRate extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| @Column(name = "effectFrom") | |||||
| private LocalDate effectFrom; | |||||
| @Column(name = "effectTo") | |||||
| private LocalDate effectTo; | |||||
| @Column(name = "normalRate") | |||||
| private Double normalRate; | |||||
| @Column(name = "otRate") | |||||
| private Double otRate; | |||||
| public Double getOtRate() { | |||||
| return otRate; | |||||
| } | |||||
| public void setOtRate(Double otRate) { | |||||
| this.otRate = otRate; | |||||
| } | |||||
| public Double getNormalRate() { | |||||
| return normalRate; | |||||
| } | |||||
| public void setNormalRate(Double normalRate) { | |||||
| this.normalRate = normalRate; | |||||
| } | |||||
| public LocalDate getEffectTo() { | |||||
| return effectTo; | |||||
| } | |||||
| public void setEffectTo(LocalDate effectTo) { | |||||
| this.effectTo = effectTo; | |||||
| } | |||||
| public LocalDate getEffectFrom() { | |||||
| return effectFrom; | |||||
| } | |||||
| public void setEffectFrom(LocalDate effectFrom) { | |||||
| this.effectFrom = effectFrom; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "position") | |||||
| public class Position extends BaseEntity<Long> { | |||||
| @Column(name = "description", length = 1500) | |||||
| private String description; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface PositionRepository extends AbstractRepository<Position, Long> { | |||||
| } | |||||
| @@ -0,0 +1,81 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalDate; | |||||
| @Entity | |||||
| @Table(name = "rate") | |||||
| public class Rate extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| @Column(name = "effectFrom") | |||||
| private LocalDate effectFrom; | |||||
| @Column(name = "effectTo") | |||||
| private LocalDate effectTo; | |||||
| @Column(name = "normalRate") | |||||
| private Double normalRate; | |||||
| @Column(name = "otRate") | |||||
| private Double otRate; | |||||
| public Double getOtRate() { | |||||
| return otRate; | |||||
| } | |||||
| public void setOtRate(Double otRate) { | |||||
| this.otRate = otRate; | |||||
| } | |||||
| public Double getNormalRate() { | |||||
| return normalRate; | |||||
| } | |||||
| public void setNormalRate(Double normalRate) { | |||||
| this.normalRate = normalRate; | |||||
| } | |||||
| public LocalDate getEffectTo() { | |||||
| return effectTo; | |||||
| } | |||||
| public void setEffectTo(LocalDate effectTo) { | |||||
| this.effectTo = effectTo; | |||||
| } | |||||
| public LocalDate getEffectFrom() { | |||||
| return effectFrom; | |||||
| } | |||||
| public void setEffectFrom(LocalDate effectFrom) { | |||||
| this.effectFrom = effectFrom; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface RateRepository extends AbstractRepository<Rate, Long> { | |||||
| } | |||||
| @@ -0,0 +1,59 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.IdEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "salary") | |||||
| public class Salary extends IdEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "salaryPoint") | |||||
| private Integer salaryPoint; | |||||
| @NotNull | |||||
| @Column(name = "lowerLimit") | |||||
| private Integer lowerLimit; | |||||
| @NotNull | |||||
| @Column(name = "upperLimit") | |||||
| private Integer upperLimit; | |||||
| @NotNull | |||||
| @Column(name = "increment") | |||||
| private Integer increment; | |||||
| public Integer getIncrement() { | |||||
| return increment; | |||||
| } | |||||
| public void setIncrement(Integer increment) { | |||||
| this.increment = increment; | |||||
| } | |||||
| public Integer getLowerLimit() { | |||||
| return lowerLimit; | |||||
| } | |||||
| public void setLowerLimit(Integer lowerLimit) { | |||||
| this.lowerLimit = lowerLimit; | |||||
| } | |||||
| public Integer getUpperLimit() { | |||||
| return upperLimit; | |||||
| } | |||||
| public void setUpperLimit(Integer upperLimit) { | |||||
| this.upperLimit = upperLimit; | |||||
| } | |||||
| public void setSalaryPoint(Integer salaryPoint) { | |||||
| this.salaryPoint = salaryPoint; | |||||
| } | |||||
| public Integer getSalaryPoint() { | |||||
| return salaryPoint; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,40 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.IdEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.JoinColumn; | |||||
| import jakarta.persistence.ManyToOne; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalDate; | |||||
| @Entity | |||||
| @Table(name = "salary_effective") | |||||
| public class SalaryEffective extends IdEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "date") | |||||
| private LocalDate date; | |||||
| public LocalDate getDate() { | |||||
| return date; | |||||
| } | |||||
| public void setDate(LocalDate date) { | |||||
| this.date = date; | |||||
| } | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "salaryId") | |||||
| @NotNull | |||||
| private Salary salary; | |||||
| public Salary getSalary() { | |||||
| return salary; | |||||
| } | |||||
| public void setSalary(Salary salary) { | |||||
| this.salary = salary; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface SalaryRepository extends AbstractRepository<Salary, Long> { | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "service") | |||||
| public class Service extends BaseEntity<Long> { | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "type", length = 30) | |||||
| private String type; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(String type) { | |||||
| this.type = type; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,35 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.IdEntity; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.JoinColumn; | |||||
| import jakarta.persistence.ManyToOne; | |||||
| import jakarta.persistence.Table; | |||||
| @Entity | |||||
| @Table(name = "service_rate") | |||||
| public class ServiceRate extends IdEntity<Long> { | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "rateId") | |||||
| private Rate rate; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "serviceId") | |||||
| private Service service; | |||||
| public Rate getRate() { | |||||
| return rate; | |||||
| } | |||||
| public void setRate(Rate rate) { | |||||
| this.rate = rate; | |||||
| } | |||||
| public Service getService() { | |||||
| return service; | |||||
| } | |||||
| public void setService(Service service) { | |||||
| this.service = service; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface ServiceRepository extends AbstractRepository<Service, Long> { | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "skill") | |||||
| public class Skill extends BaseEntity<Long> { | |||||
| @Column(name = "description", length = 1500) | |||||
| private String description; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface SkillRepository extends AbstractRepository<Skill, Long> { | |||||
| } | |||||
| @@ -0,0 +1,257 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import com.ffii.tsms.modules.user.entity.User; | |||||
| import jakarta.persistence.*; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalDate; | |||||
| @Entity | |||||
| @Table(name = "staff") | |||||
| public class Staff extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @OneToOne | |||||
| @JoinColumn(name = "userId", unique = true) | |||||
| private User user; | |||||
| @Column(name = "joinDate") | |||||
| private LocalDate joinDate; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "staffId", length = 30) | |||||
| private String staffId; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "currentPosition") | |||||
| private Position currentPosition; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "joinPosition") | |||||
| private Position joinPosition; | |||||
| @NotNull | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "companyId") | |||||
| private Company company; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "gradeId") | |||||
| private Grade grade; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "teamId") | |||||
| private Team team; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "skillSetId") | |||||
| private Skill skill; | |||||
| @NotNull | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "salaryEffId") | |||||
| private SalaryEffective salaryEffective; | |||||
| @ManyToOne | |||||
| @JoinColumn(name = "departmentId") | |||||
| private Department department; | |||||
| @Column(name = "phone2", length = 20) | |||||
| private String phone2; | |||||
| @Column(name = "phone1", length = 20) | |||||
| private String phone1; | |||||
| @Column(name = "email") | |||||
| private String email; | |||||
| @Column(name = "emergContactName", length = 150) | |||||
| private String emergContactName; | |||||
| @Column(name = "emergContactPhone", length = 20) | |||||
| private String emergContactPhone; | |||||
| @Column(name = "employType", length = 30) | |||||
| private String employType; | |||||
| @Column(name = "departDate") | |||||
| private LocalDate departDate; | |||||
| @Column(name = "departReason", length = 500) | |||||
| private String departReason; | |||||
| @Column(name = "remark", length = 1500) | |||||
| private String remark; | |||||
| public String getRemark() { | |||||
| return remark; | |||||
| } | |||||
| public void setRemark(String remark) { | |||||
| this.remark = remark; | |||||
| } | |||||
| public String getDepartReason() { | |||||
| return departReason; | |||||
| } | |||||
| public void setDepartReason(String departReason) { | |||||
| this.departReason = departReason; | |||||
| } | |||||
| public LocalDate getDepartDate() { | |||||
| return departDate; | |||||
| } | |||||
| public void setDepartDate(LocalDate departDate) { | |||||
| this.departDate = departDate; | |||||
| } | |||||
| public String getEmployType() { | |||||
| return employType; | |||||
| } | |||||
| public void setEmployType(String employType) { | |||||
| this.employType = employType; | |||||
| } | |||||
| public String getEmergContactPhone() { | |||||
| return emergContactPhone; | |||||
| } | |||||
| public void setEmergContactPhone(String emergContactPhone) { | |||||
| this.emergContactPhone = emergContactPhone; | |||||
| } | |||||
| public String getEmergContactName() { | |||||
| return emergContactName; | |||||
| } | |||||
| public void setEmergContactName(String emergContactName) { | |||||
| this.emergContactName = emergContactName; | |||||
| } | |||||
| public String getPhone2() { | |||||
| return phone2; | |||||
| } | |||||
| public void setPhone2(String phone2) { | |||||
| this.phone2 = phone2; | |||||
| } | |||||
| public String getPhone1() { | |||||
| return phone1; | |||||
| } | |||||
| public void setPhone1(String phone1) { | |||||
| this.phone1 = phone1; | |||||
| } | |||||
| public String getEmail() { | |||||
| return email; | |||||
| } | |||||
| public void setEmail(String email) { | |||||
| this.email = email; | |||||
| } | |||||
| public SalaryEffective getSalaryEffective() { | |||||
| return salaryEffective; | |||||
| } | |||||
| public void setSalaryEffective(SalaryEffective salaryEffective) { | |||||
| this.salaryEffective = salaryEffective; | |||||
| } | |||||
| public Skill getSkill() { | |||||
| return skill; | |||||
| } | |||||
| public void setSkill(Skill skill) { | |||||
| this.skill = skill; | |||||
| } | |||||
| public Company getCompany() { | |||||
| return company; | |||||
| } | |||||
| public void setCompany(Company company) { | |||||
| this.company = company; | |||||
| } | |||||
| public Grade getGrade() { | |||||
| return grade; | |||||
| } | |||||
| public void setGrade(Grade grade) { | |||||
| this.grade = grade; | |||||
| } | |||||
| public Team getTeam() { | |||||
| return team; | |||||
| } | |||||
| public void setTeam(Team team) { | |||||
| this.team = team; | |||||
| } | |||||
| public Department getDepartment() { | |||||
| return department; | |||||
| } | |||||
| public void setDepartment(Department department) { | |||||
| this.department = department; | |||||
| } | |||||
| public Position getCurrentPosition() { | |||||
| return currentPosition; | |||||
| } | |||||
| public void setCurrentPosition(Position currentPosition) { | |||||
| this.currentPosition = currentPosition; | |||||
| } | |||||
| public Position getJoinPosition() { | |||||
| return joinPosition; | |||||
| } | |||||
| public void setJoinPosition(Position joinPosition) { | |||||
| this.joinPosition = joinPosition; | |||||
| } | |||||
| public LocalDate getJoinDate() { | |||||
| return joinDate; | |||||
| } | |||||
| public void setJoinDate(LocalDate joinDate) { | |||||
| this.joinDate = joinDate; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getStaffId() { | |||||
| return staffId; | |||||
| } | |||||
| public void setStaffId(String staffId) { | |||||
| this.staffId = staffId; | |||||
| } | |||||
| public User getUser() { | |||||
| return user; | |||||
| } | |||||
| public void setUser(User user) { | |||||
| this.user = user; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface StaffRepository extends AbstractRepository<Staff, Long> { | |||||
| } | |||||
| @@ -0,0 +1,103 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| import java.time.LocalTime; | |||||
| @Entity | |||||
| @Table(name = "subsidiary") | |||||
| public class Subsidiary extends BaseEntity<Long> { | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @Column(name = "brNo", length = 20) | |||||
| private String brNo; | |||||
| @Column(name = "contactName", length = 30) | |||||
| private String contactName; | |||||
| @Column(name = "phone", length = 20) | |||||
| private String phone; | |||||
| @Column(name = "address", length = 500) | |||||
| private String address; | |||||
| @Column(name = "district", length = 30) | |||||
| private String district; | |||||
| @Column(name = "email") | |||||
| private String email; | |||||
| public String getAddress() { | |||||
| return address; | |||||
| } | |||||
| public void setAddress(String address) { | |||||
| this.address = address; | |||||
| } | |||||
| public String getDistrict() { | |||||
| return district; | |||||
| } | |||||
| public void setDistrict(String district) { | |||||
| this.district = district; | |||||
| } | |||||
| public String getEmail() { | |||||
| return email; | |||||
| } | |||||
| public void setEmail(String email) { | |||||
| this.email = email; | |||||
| } | |||||
| public String getPhone() { | |||||
| return phone; | |||||
| } | |||||
| public void setPhone(String phone) { | |||||
| this.phone = phone; | |||||
| } | |||||
| public String getContactName() { | |||||
| return contactName; | |||||
| } | |||||
| public void setContactName(String contactName) { | |||||
| this.contactName = contactName; | |||||
| } | |||||
| public String getBrNo() { | |||||
| return brNo; | |||||
| } | |||||
| public void setBrNo(String brNo) { | |||||
| this.brNo = brNo; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface SubsidiaryRepository extends AbstractRepository<Subsidiary, Long> { | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.entity.BaseEntity; | |||||
| import jakarta.persistence.Column; | |||||
| import jakarta.persistence.Entity; | |||||
| import jakarta.persistence.Table; | |||||
| import jakarta.validation.constraints.NotNull; | |||||
| @Entity | |||||
| @Table(name = "team") | |||||
| public class Team extends BaseEntity<Long> { | |||||
| @Column(name = "description", length = 1500) | |||||
| private String description; | |||||
| @NotNull | |||||
| @Column(name = "name", length = 150) | |||||
| private String name; | |||||
| @NotNull | |||||
| @Column(name = "code", length = 30) | |||||
| private String code; | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | |||||
| import com.ffii.core.support.AbstractRepository; | |||||
| public interface TeamRepository extends AbstractRepository<Team, Long> { | |||||
| } | |||||
| @@ -0,0 +1,26 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:company | |||||
| CREATE TABLE company ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| companyCode VARCHAR(30) NOT NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| brNo VARCHAR(20) NULL, | |||||
| contactName VARCHAR(30) NULL, | |||||
| phone VARCHAR(20) NULL, | |||||
| otHourTo time NULL, | |||||
| otHourFrom time NULL, | |||||
| normalHourTo time NULL, | |||||
| normalHourFrom time NULL, | |||||
| currency VARCHAR(20) NULL, | |||||
| address VARCHAR(500) NULL, | |||||
| district VARCHAR(30) NULL, | |||||
| email VARCHAR(255) NULL, | |||||
| CONSTRAINT pk_company PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,15 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:company_holiday | |||||
| CREATE TABLE company_holiday ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| date date NOT NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| CONSTRAINT pk_company_holiday PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,21 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:customer | |||||
| CREATE TABLE customer ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| address VARCHAR(500) NULL, | |||||
| district VARCHAR(30) NULL, | |||||
| email VARCHAR(255) NULL, | |||||
| phone VARCHAR(20) NULL, | |||||
| contactName VARCHAR(30) NULL, | |||||
| brNo VARCHAR(20) NULL, | |||||
| CONSTRAINT pk_customer PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,21 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:subsidiary | |||||
| CREATE TABLE subsidiary ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| code VARCHAR(30) NOT NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| brNo VARCHAR(20) NULL, | |||||
| contactName VARCHAR(30) NULL, | |||||
| phone VARCHAR(20) NULL, | |||||
| address VARCHAR(500) NULL, | |||||
| district VARCHAR(30) NULL, | |||||
| email VARCHAR(255) NULL, | |||||
| CONSTRAINT pk_subsidiary PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,13 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:customer_subsidiary | |||||
| CREATE TABLE customer_subsidiary ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| customerId INT NULL, | |||||
| subsidiaryId INT NULL, | |||||
| CONSTRAINT pk_customer_subsidiary PRIMARY KEY (id) | |||||
| ); | |||||
| ALTER TABLE customer_subsidiary ADD CONSTRAINT FK_CUSTOMER_SUBSIDIARY_ON_CUSTOMERID FOREIGN KEY (customerId) REFERENCES customer (id); | |||||
| ALTER TABLE customer_subsidiary ADD CONSTRAINT FK_CUSTOMER_SUBSIDIARY_ON_SUBSIDIARYID FOREIGN KEY (subsidiaryId) REFERENCES subsidiary (id); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:department | |||||
| CREATE TABLE department ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| `description` VARCHAR(1500) NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_department PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:grade | |||||
| CREATE TABLE grade ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| `description` VARCHAR(1500) NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_grade PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,19 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:internal_rate | |||||
| CREATE TABLE internal_rate ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| effectFrom date NULL, | |||||
| effectTo date NULL, | |||||
| normalRate DOUBLE NULL, | |||||
| otRate DOUBLE NULL, | |||||
| CONSTRAINT pk_internal_rate PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:position | |||||
| CREATE TABLE position ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| `description` VARCHAR(1500) NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_position PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,19 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:rate | |||||
| CREATE TABLE rate ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| effectFrom date NULL, | |||||
| effectTo date NULL, | |||||
| normalRate DOUBLE NULL, | |||||
| otRate DOUBLE NULL, | |||||
| CONSTRAINT pk_rate PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,11 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:salary | |||||
| CREATE TABLE salary ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| salaryPoint INT NOT NULL, | |||||
| lowerLimit INT NOT NULL, | |||||
| upperLimit INT NOT NULL, | |||||
| increment INT NOT NULL, | |||||
| CONSTRAINT pk_salary PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,11 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:salary_effective | |||||
| CREATE TABLE salary_effective ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| date date NOT NULL, | |||||
| salaryId INT NOT NULL, | |||||
| CONSTRAINT pk_salary_effective PRIMARY KEY (id) | |||||
| ); | |||||
| ALTER TABLE salary_effective ADD CONSTRAINT FK_SALARY_EFFECTIVE_ON_SALARYID FOREIGN KEY (salaryId) REFERENCES salary (id); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:service | |||||
| CREATE TABLE service ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| name VARCHAR(150) NULL, | |||||
| type VARCHAR(30) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_service PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,13 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:service_rate | |||||
| CREATE TABLE service_rate ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| rateId INT NULL, | |||||
| serviceId INT NULL, | |||||
| CONSTRAINT pk_service_rate PRIMARY KEY (id) | |||||
| ); | |||||
| ALTER TABLE service_rate ADD CONSTRAINT FK_SERVICE_RATE_ON_RATEID FOREIGN KEY (rateId) REFERENCES rate (id); | |||||
| ALTER TABLE service_rate ADD CONSTRAINT FK_SERVICE_RATE_ON_SERVICEID FOREIGN KEY (serviceId) REFERENCES service (id); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:skill | |||||
| CREATE TABLE skill ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| `description` VARCHAR(1500) NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_skill PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,16 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:team | |||||
| CREATE TABLE team ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| `description` VARCHAR(1500) NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| code VARCHAR(30) NOT NULL, | |||||
| CONSTRAINT pk_team PRIMARY KEY (id) | |||||
| ); | |||||
| @@ -0,0 +1,54 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset wayne:staff | |||||
| CREATE TABLE staff ( | |||||
| id INT NOT NULL AUTO_INCREMENT, | |||||
| version INT NOT NULL DEFAULT '0', | |||||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| createdBy VARCHAR(30) NULL, | |||||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||||
| modifiedBy VARCHAR(30) NULL, | |||||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||||
| userId INT NOT NULL, | |||||
| joinDate date NULL, | |||||
| name VARCHAR(150) NOT NULL, | |||||
| staffId VARCHAR(30) NOT NULL, | |||||
| currentPosition INT NULL, | |||||
| joinPosition INT NULL, | |||||
| companyId INT NOT NULL, | |||||
| gradeId INT NULL, | |||||
| teamId INT NULL, | |||||
| skillSetId INT NULL, | |||||
| salaryEffId INT NOT NULL, | |||||
| departmentId INT NULL, | |||||
| phone2 VARCHAR(20) NULL, | |||||
| phone1 VARCHAR(20) NULL, | |||||
| email VARCHAR(255) NULL, | |||||
| emergContactName VARCHAR(150) NULL, | |||||
| emergContactPhone VARCHAR(20) NULL, | |||||
| employType VARCHAR(30) NULL, | |||||
| departDate date NULL, | |||||
| departReason VARCHAR(500) NULL, | |||||
| remark VARCHAR(1500) NULL, | |||||
| CONSTRAINT pk_staff PRIMARY KEY (id) | |||||
| ); | |||||
| ALTER TABLE staff ADD CONSTRAINT uc_staff_userid UNIQUE (userId); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_COMPANYID FOREIGN KEY (companyId) REFERENCES company (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_CURRENTPOSITION FOREIGN KEY (currentPosition) REFERENCES position (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_DEPARTMENTID FOREIGN KEY (departmentId) REFERENCES department (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_GRADEID FOREIGN KEY (gradeId) REFERENCES grade (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_JOINPOSITION FOREIGN KEY (joinPosition) REFERENCES position (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_SALARYEFFID FOREIGN KEY (salaryEffId) REFERENCES salary_effective (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_SKILLSETID FOREIGN KEY (skillSetId) REFERENCES skill (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_TEAMID FOREIGN KEY (teamId) REFERENCES team (id); | |||||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_USERID FOREIGN KEY (userId) REFERENCES user (id); | |||||