diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a88b2b99..db8c72e4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,10 +18,10 @@ jobs: distribution: 'temurin' - name: Grant execute permission for Gradle wrapper run: chmod +x ./gradlew - working-directory: api + working-directory: app/backend/api - name: Build with Gradle in api directory run: ./gradlew build -x test -x jigReports - working-directory: api + working-directory: app/backend/api test: runs-on: ubuntu-latest @@ -34,7 +34,45 @@ jobs: distribution: 'temurin' - name: Grant execute permission for Gradle wrapper run: chmod +x ./gradlew - working-directory: api + working-directory: app/backend/api - name: Test with Gradle in api directory run: ./gradlew test - working-directory: api + working-directory: app/backend/api + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + - name: Grant execute permission for Gradle wrapper + run: chmod +x ./gradlew + working-directory: app/backend/api + + - name: Gradle build + run: ./gradlew clean build jacocoTestReport + working-directory: app/backend/api + + - name: Download and set up Code Climate Test Reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + working-directory: app/backend/api + + - name: Set jacoco.xml path for code climate + env: + JACOCO_SOURCE_PATH: src/main/java + run: ./cc-test-reporter format-coverage ./build/reports/jacoco/test/jacocoTestReport.xml --input-type jacoco + working-directory: app/backend/api + + - name: Upload code climate report + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./cc-test-reporter upload-coverage -r $CC_TEST_REPORTER_ID + working-directory: app/backend/api + if: success() + diff --git a/.github/workflows/heroku_backend_develop.yml b/.github/workflows/heroku_backend_develop.yml new file mode 100644 index 00000000..b27546d9 --- /dev/null +++ b/.github/workflows/heroku_backend_develop.yml @@ -0,0 +1,19 @@ +name: Heroku Backend Develop Deployment + +on: + push: + branches-ignore: + - main + +jobs: + deploy: + runs-on: ubuntu-22.04 + environment: development + steps: + - uses: actions/checkout@v2 + - uses: akhileshns/heroku-deploy@v3.13.15 + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: ${{secrets.HEROKU_APP_DEVELOP_NAME}} + heroku_email: ${{secrets.HEROKU_EMAIL}} + appdir: "app/backend/api" # <- This will point to the api folder in your project diff --git a/.github/workflows/heroku_backend_production.yml b/.github/workflows/heroku_backend_production.yml new file mode 100644 index 00000000..e8fca800 --- /dev/null +++ b/.github/workflows/heroku_backend_production.yml @@ -0,0 +1,19 @@ +name: Heroku Backend Production Deployment + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-22.04 + environment: production + steps: + - uses: actions/checkout@v2 + - uses: akhileshns/heroku-deploy@v3.13.15 + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: ${{secrets.HEROKU_APP_NAME}} + heroku_email: ${{secrets.HEROKU_EMAIL}} + appdir: "app/backend/api" # <- This will point to the api folder in your project diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 259fb27d..adab2d63 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,31 +1,76 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI +name: Node.js CI with Npm in frontend directory on: push: - branches: [ "main" ] + branches: [ '*' ] pull_request: branches: [ "main" ] jobs: build: - runs-on: ubuntu-latest - strategy: matrix: node-version: [18.x, 19.x, 20.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci + working-directory: app/frontend - run: npm run build --if-present - - run: npm test + working-directory: app/frontend + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js latest + uses: actions/setup-node@v3 + with: + node-version: latest + cache: 'npm' + - run: npm ci + working-directory: app/frontend + - run: npm test + working-directory: app/frontend + + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + - name: Grant execute permission for Gradle wrapper + run: chmod +x ./gradlew + working-directory: app/backend/api + - name: Build with Gradle in api directory + run: ./gradlew build -x test + working-directory: app/backend/api + - name: Run with Gradle in api directory + run: ./gradlew bootRun & + working-directory: app/backend/api + + - name: Use Node.js latest + uses: actions/setup-node@v3 + with: + node-version: latest + cache: 'npm' + - run: npm ci + working-directory: app/frontend + - name: Cypress run + uses: cypress-io/github-action@v5 + with: + build: npm run build + start: npm run dev + wait-on: "http://localhost:5173" + working-directory: app/frontend diff --git a/.github/workflows/sonar_qube.yml b/.github/workflows/sonar_qube.yml new file mode 100644 index 00000000..b0442c6b --- /dev/null +++ b/.github/workflows/sonar_qube.yml @@ -0,0 +1,45 @@ +name: SonarQube +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Grant execute permission for Gradle wrapper + run: chmod +x ./gradlew + working-directory: app/backend/api + + - name: Cache SonarQube packages + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew build sonar --info + working-directory: app/backend/api diff --git a/.github/workflows/vercel_frontend_preview.yml b/.github/workflows/vercel_frontend_preview.yml new file mode 100644 index 00000000..9c947dc9 --- /dev/null +++ b/.github/workflows/vercel_frontend_preview.yml @@ -0,0 +1,29 @@ +name: Vercel FrontEnd Preview Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_FRONTEND_PROJECT_ID }} +on: + push: + branches-ignore: + - main +jobs: + deploy: + runs-on: ubuntu-latest + environment: preview + steps: + - uses: actions/checkout@v2 + - name: Setup Environment Variables + run: | + echo VITE_APP_API_URL=${{ vars.DEV_APP_API_URL }} > .env + working-directory: app/frontend + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend diff --git a/.github/workflows/vercel_frontend_production.yml b/.github/workflows/vercel_frontend_production.yml new file mode 100644 index 00000000..b67b7a2e --- /dev/null +++ b/.github/workflows/vercel_frontend_production.yml @@ -0,0 +1,29 @@ +name: Vercel FrontEnd Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_FRONTEND_PROJECT_ID }} +on: + push: + branches: + - main +jobs: + deploy: + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v2 + - name: Setup Environment Variables + run: | + echo VITE_APP_API_URL=${{ vars.PRD_APP_API_URL }} > .env + working-directory: app/frontend + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + working-directory: app/frontend diff --git a/.github/workflows/vercel_preview.yml b/.github/workflows/vercel_preview.yml new file mode 100644 index 00000000..470144ee --- /dev/null +++ b/.github/workflows/vercel_preview.yml @@ -0,0 +1,45 @@ +name: Vercel Preview Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches-ignore: + - main +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Start Database Services + uses: hoverkraft-tech/compose-action@v2.0.1 + with: + compose-file: "./docker-compose.yml" + services: | + db_postgresql + + - name: Setup Graphviz + uses: tlylt/install-graphviz@main + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + - name: Grant execute permission for Gradle wrapper + run: chmod +x ./gradlew + working-directory: app/backend/api + - name: Run migrations + run: | + ./gradlew assemble + ./gradlew flywayMigrate + working-directory: app/backend/api + + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/vercel_productin.yml b/.github/workflows/vercel_productin.yml new file mode 100644 index 00000000..e1de6c45 --- /dev/null +++ b/.github/workflows/vercel_productin.yml @@ -0,0 +1,45 @@ +name: Vercel Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Start Database Services + uses: hoverkraft-tech/compose-action@v2.0.1 + with: + compose-file: "./docker-compose.yml" + services: | + db_postgresql + + - name: Setup Graphviz + uses: tlylt/install-graphviz@main + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + - name: Grant execute permission for Gradle wrapper + run: chmod +x ./gradlew + working-directory: app/backend/api + - name: Run migrations + run: | + ./gradlew assemble + ./gradlew flywayMigrate + working-directory: app/backend/api + + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.gitignore b/.gitignore index 00764734..2d6581e3 100644 --- a/.gitignore +++ b/.gitignore @@ -136,5 +136,15 @@ public ops/docker/schemaspy/output ops/docker/mssql/data ops/docker/mssql/log - +ops/docker/allure tmp + +app/frontend/cypress/screenshots +app/frontend/cypress/downloads +app/frontend/allure-results + +my.secrets + +.sonarlint + +!docs/journal/public \ No newline at end of file diff --git a/README.md b/README.md index 62acdfb5..1cfdc469 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,18 @@ [![Node.js CI](https://github.com/k2works/case-study-sales/actions/workflows/node.js.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/node.js.yml) [![Java CI](https://github.com/k2works/case-study-sales/actions/workflows/gradle.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/gradle.yml) +[![Heroku Production](https://github.com/k2works/case-study-sales/actions/workflows/heroku_backend_production.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/heroku_backend_production.yml) +[![Heroku Develop](https://github.com/k2works/case-study-sales/actions/workflows/heroku_backend_develop.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/heroku_backend_develop.yml) + + +[![Vercel Production](https://github.com/k2works/case-study-sales/actions/workflows/vercel_frontend_production.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/vercel_frontend_production.yml) +[![Vercel Develop](https://github.com/k2works/case-study-sales/actions/workflows/vercel_frontend_preview.yml/badge.svg)](https://github.com/k2works/case-study-sales/actions/workflows/vercel_frontend_preview.yml) + +[![Maintainability](https://api.codeclimate.com/v1/badges/8ff7a5b4be0f3a63ca4f/maintainability)](https://codeclimate.com/github/k2works/case-study-sales/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/8ff7a5b4be0f3a63ca4f/test_coverage)](https://codeclimate.com/github/k2works/case-study-sales/test_coverage) + +[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=k2works_case-study-sales) + ## 概要 [ガイドライン](./docs/slides/PITCHME.md) @@ -11,15 +23,17 @@ ### 前提 -| ソフトウェア | バージョン | 備考 | -|:-------|:------|:---| -| Java | 21 | | -| nodejs | 20.x | | +| ソフトウェア | バージョン | 備考 | +|:----------|:------|:------------| +| Java | 21 | | +| nodejs | 20.x | | +| graphviz | | ドキュメント生成に必要 | ### Quick Start ```bash npm install +npm run build npm start ``` ## 構成 diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java b/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java deleted file mode 100644 index 80787903..00000000 --- a/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.example.sms.domain.model.common.money; - -import com.example.sms.domain.type.money.CurrencyType; - -/** - * 通貨ペア - */ -class Pair { - private CurrencyType from; - private CurrencyType to; - - Pair(CurrencyType from, CurrencyType to) { - this.from = from; - this.to = to; - } - - public boolean equals(Object object) { - Pair pair = (Pair) object; - return from.equals(pair.from) && to.equals(pair.to); - } - - public int hashCode() { - return 0; - } -} diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/Password.java b/api/src/main/java/com/example/sms/domain/model/system/user/Password.java deleted file mode 100644 index 66bca975..00000000 --- a/api/src/main/java/com/example/sms/domain/model/system/user/Password.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.example.sms.domain.model.system.user; - -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * パスワード - */ -@Value -@NoArgsConstructor(force = true) -public class Password { - String value; - - public Password(String value) { - if (value == null || value.isEmpty()) { - this.value = ""; - } else { - checkPolicy(value); - this.value = value; - } - } - - private void checkPolicy(String value) { - if (value.length() < 8) { - throw new PasswordException("パスワードは8文字以上である必要があります"); - } - - String regex = "(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])"; - Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(value); - if (!matcher.find()) throw new PasswordException("パスワードは小文字、大文字、数字を含む必要があります"); - } - - /** - * パスワード - */ - public String Value() { - return value; - } -} diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" deleted file mode 100644 index c1933d12..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 部門コード, 開始日, 終了日, 部門名, 組織階層, 部門パス, 最下層区分, 伝票入力可否, 作成日時, 作成者名, 更新日時, - 更新者名 - - - - - delete from public.部門マスタ - where 部門コード = #{部門コード,jdbcType=VARCHAR} - and 開始日 = #{開始日,jdbcType=TIMESTAMP} - - - - insert into public.部門マスタ (部門コード, 開始日, 終了日, - 部門名, 組織階層, 部門パス, 最下層区分, - 伝票入力可否, 作成日時, 作成者名, - 更新日時, 更新者名) - values (#{部門コード,jdbcType=VARCHAR}, #{開始日,jdbcType=TIMESTAMP}, #{終了日,jdbcType=TIMESTAMP}, - #{部門名,jdbcType=VARCHAR}, #{組織階層,jdbcType=INTEGER}, #{部門パス,jdbcType=VARCHAR}, - #{最下層区分,jdbcType=INTEGER}, - #{伝票入力可否,jdbcType=INTEGER}, #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, - #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.部門マスタ - - - 部門コード, - - - 開始日, - - - 終了日, - - - 部門名, - - - 組織階層, - - - 部門パス, - - - 最下層区分, - - - 伝票入力可否, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{部門コード,jdbcType=VARCHAR}, - - - #{開始日,jdbcType=TIMESTAMP}, - - - #{終了日,jdbcType=TIMESTAMP}, - - - #{部門名,jdbcType=VARCHAR}, - - - #{組織階層,jdbcType=INTEGER}, - - - #{部門パス,jdbcType=VARCHAR}, - - - #{最下層区分,jdbcType=INTEGER}, - - - #{伝票入力可否,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.部門マスタ - - - 終了日 = #{終了日,jdbcType=TIMESTAMP}, - - - 部門名 = #{部門名,jdbcType=VARCHAR}, - - - 組織階層 = #{組織階層,jdbcType=INTEGER}, - - - 部門パス = #{部門パス,jdbcType=VARCHAR}, - - - 最下層区分 = #{最下層区分,jdbcType=INTEGER}, - - - 伝票入力可否 = #{伝票入力可否,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 部門コード = #{部門コード,jdbcType=VARCHAR} - and 開始日 = #{開始日,jdbcType=TIMESTAMP} - - - - update public.部門マスタ - set 終了日 = #{終了日,jdbcType=TIMESTAMP}, - 部門名 = #{部門名,jdbcType=VARCHAR}, - 組織階層 = #{組織階層,jdbcType=INTEGER}, - 部門パス = #{部門パス,jdbcType=VARCHAR}, - 最下層区分 = #{最下層区分,jdbcType=INTEGER}, - 伝票入力可否 = #{伝票入力可否,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 部門コード = #{部門コード,jdbcType=VARCHAR} - and 開始日 = #{開始日,jdbcType=TIMESTAMP} - - - - - - diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" deleted file mode 100644 index ff444e97..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - 社員コード, 社員名, 社員名カナ, パスワード, 電話番号, FAX番号, 部門コード, 開始日, 職種コード, 承認権限コード, - 作成日時, 作成者名, 更新日時, - 更新者名, user_id - - - - - delete from public.社員マスタ - where 社員コード = #{社員コード,jdbcType=VARCHAR} - - - - insert into public.社員マスタ (社員コード, 社員名, 社員名カナ, - パスワード, 電話番号, FAX番号, - 部門コード, 開始日, 職種コード, - 承認権限コード, 作成日時, 作成者名, - 更新日時, 更新者名, user_id - ) - values (#{社員コード,jdbcType=VARCHAR}, #{社員名,jdbcType=VARCHAR}, #{社員名カナ,jdbcType=VARCHAR}, - #{パスワード,jdbcType=VARCHAR}, #{電話番号,jdbcType=VARCHAR}, #{fax番号,jdbcType=VARCHAR}, - #{部門コード,jdbcType=VARCHAR}, #{開始日,jdbcType=TIMESTAMP}, #{職種コード,jdbcType=VARCHAR}, - #{承認権限コード,jdbcType=VARCHAR}, #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, - #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR} - ) - - - - insert into public.社員マスタ - - - 社員コード, - - - 社員名, - - - 社員名カナ, - - - パスワード, - - - 電話番号, - - - FAX番号, - - - 部門コード, - - - 開始日, - - - 職種コード, - - - 承認権限コード, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - user_id, - - - - - #{社員コード,jdbcType=VARCHAR}, - - - #{社員名,jdbcType=VARCHAR}, - - - #{社員名カナ,jdbcType=VARCHAR}, - - - #{パスワード,jdbcType=VARCHAR}, - - - #{電話番号,jdbcType=VARCHAR}, - - - #{fax番号,jdbcType=VARCHAR}, - - - #{部門コード,jdbcType=VARCHAR}, - - - #{開始日,jdbcType=TIMESTAMP}, - - - #{職種コード,jdbcType=VARCHAR}, - - - #{承認権限コード,jdbcType=VARCHAR}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - #{userId,jdbcType=VARCHAR}, - - - > - - - - update public.社員マスタ - - - 社員名 = #{社員名,jdbcType=VARCHAR}, - - - 社員名カナ = #{社員名カナ,jdbcType=VARCHAR}, - - - パスワード = #{パスワード,jdbcType=VARCHAR}, - - - 電話番号 = #{電話番号,jdbcType=VARCHAR}, - - - FAX番号 = #{fax番号,jdbcType=VARCHAR}, - - - 部門コード = #{部門コード,jdbcType=VARCHAR}, - - - 開始日 = #{開始日,jdbcType=TIMESTAMP}, - - - 職種コード = #{職種コード,jdbcType=VARCHAR}, - - - 承認権限コード = #{承認権限コード,jdbcType=VARCHAR}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - user_id = #{userId,jdbcType=VARCHAR}, - - - where 社員コード = #{社員コード,jdbcType=VARCHAR} - - - - update public.社員マスタ - set 社員名 = #{社員名,jdbcType=VARCHAR}, - 社員名カナ = #{社員名カナ,jdbcType=VARCHAR}, - パスワード = #{パスワード,jdbcType=VARCHAR}, - 電話番号 = #{電話番号,jdbcType=VARCHAR}, - FAX番号 = #{fax番号,jdbcType=VARCHAR}, - 部門コード = #{部門コード,jdbcType=VARCHAR}, - 開始日 = #{開始日,jdbcType=TIMESTAMP}, - 職種コード = #{職種コード,jdbcType=VARCHAR}, - 承認権限コード = #{承認権限コード,jdbcType=VARCHAR}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - user_id = #{userId,jdbcType=VARCHAR} - where 社員コード = #{社員コード,jdbcType=VARCHAR} - - - - - - diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryEntityMapper.java b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryEntityMapper.java deleted file mode 100644 index 24dc384e..00000000 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryEntityMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.example.sms.infrastructure.datasource.master.product; - -import com.example.sms.domain.model.master.product.Product; -import com.example.sms.domain.model.master.product.ProductCategory; -import com.example.sms.domain.type.product.*; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class ProductCategoryEntityMapper { - - public ProductCategory mapToDomainModel(商品分類マスタ productCategoryEntity) { - ProductCategory productCategory = ProductCategory.of( - productCategoryEntity.get商品分類コード(), - productCategoryEntity.get商品分類名(), - productCategoryEntity.get商品分類階層(), - productCategoryEntity.get商品分類パス(), - productCategoryEntity.get最下層区分() - ); - - List products = productCategoryEntity.get商品マスタ().stream() - .map(this::mapToProduct) - .toList(); - - return ProductCategory.of(productCategory, products); - } - - private Product mapToProduct(商品マスタ productEntity) { - return Product.of( - productEntity.get商品コード(), - productEntity.get商品正式名(), - productEntity.get商品略称(), - productEntity.get商品名カナ(), - ProductType.fromCode(productEntity.get商品区分()), - productEntity.get販売単価(), - productEntity.get仕入単価(), - productEntity.get売上原価(), - TaxType.fromCode(productEntity.get税区分()), - productEntity.get商品分類コード(), - MiscellaneousType.fromCode(productEntity.get雑区分()), - StockManagementTargetType.fromCode(productEntity.get在庫管理対象区分()), - StockAllocationType.fromCode(productEntity.get在庫引当区分()), - productEntity.get仕入先コード(), - productEntity.get仕入先枝番() - ); - } - - public 商品分類マスタ mapToEntity(ProductCategory product) { - 商品分類マスタ productCategoryEntity = new 商品分類マスタ(); - productCategoryEntity.set商品分類コード(product.getProductCategoryCode().getValue()); - productCategoryEntity.set商品分類名(product.getProductCategoryName()); - productCategoryEntity.set商品分類階層(product.getProductCategoryHierarchy()); - productCategoryEntity.set商品分類パス(product.getProductCategoryPath()); - productCategoryEntity.set最下層区分(product.getLowestLevelDivision()); - - return productCategoryEntity; - } -} diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java deleted file mode 100644 index ff225f97..00000000 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.example.sms.infrastructure.datasource.master.product; - -import com.example.sms.domain.model.master.product.Product; -import com.example.sms.domain.model.master.product.ProductList; -import com.example.sms.domain.type.product.ProductType; -import com.example.sms.infrastructure.PageInfoHelper; -import com.example.sms.service.master.product.ProductRepository; -import com.github.pagehelper.PageInfo; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Repository; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Optional; - -@Repository -public class ProductDataSource implements ProductRepository { - final 商品マスタMapper productMapper; - final 代替商品Mapper substituteProductMapper; - final 部品表Mapper bomMapper; - final 顧客別販売単価Mapper customerSellingPriceMapper; - final ProductEntityMapper productEntityMapper; - - public ProductDataSource(商品マスタMapper productMapper, 代替商品Mapper substituteProductMapper, 部品表Mapper bomMapper, 顧客別販売単価Mapper customerSellingPriceMapper, ProductEntityMapper productEntityMapper) { - this.productMapper = productMapper; - this.substituteProductMapper = substituteProductMapper; - this.bomMapper = bomMapper; - this.customerSellingPriceMapper = customerSellingPriceMapper; - this.productEntityMapper = productEntityMapper; - } - - @Override - public void deleteAll() { - customerSellingPriceMapper.deleteAll(); - bomMapper.deleteAll(); - substituteProductMapper.deleteAll(); - productMapper.deleteAll(); - } - - @Override - public void save(Product product) { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - String username = authentication != null && authentication.getName() != null ? authentication.getName() : "system"; - - Optional<商品マスタ> productEntity = Optional.ofNullable(productMapper.selectByPrimaryKey(product.getProductCode().getValue())); - if (productEntity.isEmpty()) { - 商品マスタ newProductEntity = productEntityMapper.mapToEntity(product); - newProductEntity.set作成日時(LocalDateTime.now()); - newProductEntity.set作成者名(username); - newProductEntity.set更新日時(LocalDateTime.now()); - newProductEntity.set更新者名(username); - productMapper.insert(newProductEntity); - - if (product.getSubstituteProduct() != null) { - product.getSubstituteProduct().forEach(substituteProduct -> { - 代替商品 substituteProductEntity = productEntityMapper.mapToEntity(substituteProduct); - substituteProductEntity.set作成日時(LocalDateTime.now()); - substituteProductEntity.set作成者名(username); - substituteProductEntity.set更新日時(LocalDateTime.now()); - substituteProductEntity.set更新者名(username); - substituteProductMapper.insert(substituteProductEntity); - }); - } - - if (product.getBoms() != null) { - product.getBoms().forEach(bom -> { - 部品表 bomEntity = productEntityMapper.mapToEntity(bom); - bomEntity.set作成日時(LocalDateTime.now()); - bomEntity.set作成者名(username); - bomEntity.set更新日時(LocalDateTime.now()); - bomEntity.set更新者名(username); - bomMapper.insert(bomEntity); - }); - } - - if (product.getCustomerSpecificSellingPrices() != null) { - product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { - 顧客別販売単価 customerSellingPriceEntity = productEntityMapper.mapToEntity(customerSpecificSellingPrice); - customerSellingPriceEntity.set作成日時(LocalDateTime.now()); - customerSellingPriceEntity.set作成者名(username); - customerSellingPriceEntity.set更新日時(LocalDateTime.now()); - customerSellingPriceEntity.set更新者名(username); - customerSellingPriceMapper.insert(customerSellingPriceEntity); - }); - } - } else { - 商品マスタ updateProductEntity = productEntityMapper.mapToEntity(product); - updateProductEntity.set作成日時(productEntity.get().get作成日時()); - updateProductEntity.set作成者名(productEntity.get().get作成者名()); - updateProductEntity.set更新日時(LocalDateTime.now()); - updateProductEntity.set更新者名(username); - productMapper.updateByPrimaryKey(updateProductEntity); - - if (product.getSubstituteProduct() != null) { - substituteProductMapper.deleteByProductCode(product.getProductCode().getValue()); - - product.getSubstituteProduct().forEach(substituteProduct -> { - 代替商品Key key = new 代替商品Key(); - key.set代替商品コード(substituteProduct.getSubstituteProductCode().getValue()); - key.set商品コード(substituteProduct.getProductCode().getValue()); - substituteProductMapper.deleteByPrimaryKey(key); - - 代替商品 substituteProductEntity = productEntityMapper.mapToEntity(substituteProduct); - substituteProductEntity.set作成日時(LocalDateTime.now()); - substituteProductEntity.set作成者名(username); - substituteProductEntity.set更新日時(LocalDateTime.now()); - substituteProductEntity.set更新者名(username); - substituteProductMapper.insert(substituteProductEntity); - }); - } - - if (product.getBoms() != null) { - bomMapper.deleteByProductCode(product.getProductCode().getValue()); - - product.getBoms().forEach(bom -> { - 部品表Key key = new 部品表Key(); - key.set商品コード(bom.getProductCode().getValue()); - key.set部品コード(bom.getComponentCode().getValue()); - bomMapper.deleteByPrimaryKey(key); - - 部品表 bomEntity = productEntityMapper.mapToEntity(bom); - bomEntity.set作成日時(LocalDateTime.now()); - bomEntity.set作成者名(username); - bomEntity.set更新日時(LocalDateTime.now()); - bomEntity.set更新者名(username); - bomMapper.insert(bomEntity); - }); - } - - if (product.getCustomerSpecificSellingPrices() != null) { - customerSellingPriceMapper.deleteByProductCode(product.getProductCode().getValue()); - - product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { - 顧客別販売単価Key key = new 顧客別販売単価Key(); - key.set商品コード(customerSpecificSellingPrice.getProductCode().getValue()); - key.set取引先コード(customerSpecificSellingPrice.getCustomerCode()); - customerSellingPriceMapper.deleteByPrimaryKey(key); - - 顧客別販売単価 customerSellingPriceEntity = productEntityMapper.mapToEntity(customerSpecificSellingPrice); - customerSellingPriceEntity.set作成日時(LocalDateTime.now()); - customerSellingPriceEntity.set作成者名(username); - customerSellingPriceEntity.set更新日時(LocalDateTime.now()); - customerSellingPriceEntity.set更新者名(username); - customerSellingPriceMapper.insert(customerSellingPriceEntity); - }); - } - } - } - - @Override - public ProductList selectAll() { - List<商品マスタ> productEntities = productMapper.selectAll(); - - return new ProductList(productEntities.stream() - .map(productEntityMapper::mapToDomainModel) - .toList()); - } - - @Override - public PageInfo selectAllWithPageInfo() { - List<商品マスタ> productEntities = productMapper.selectAll(); - PageInfo<商品マスタ> pageInfo = new PageInfo<>(productEntities); - - return PageInfoHelper.of(pageInfo, productEntityMapper::mapToDomainModel); - } - - @Override - public PageInfo selectAllBoms() { - List<商品マスタ> productEntities = productMapper.selectAllBoms(List.of(ProductType.製品.getCode(), ProductType.部品.getCode(), ProductType.包材.getCode())); - PageInfo<商品マスタ> pageInfo = new PageInfo<>(productEntities); - - return PageInfoHelper.of(pageInfo, productEntityMapper::mapToDomainModel); - } - - @Override - public Optional findById(String productCode) { - 商品マスタ productEntity = productMapper.selectByPrimaryKey(productCode); - if (productEntity != null) { - return Optional.of(productEntityMapper.mapToDomainModel(productEntity)); - } - return Optional.empty(); - } - - @Override - public void deleteById(Product product) { - if (!product.getSubstituteProduct().isEmpty()) { - product.getSubstituteProduct().forEach(substituteProduct -> { - 代替商品Key key = new 代替商品Key(); - key.set商品コード(substituteProduct.getProductCode().getValue()); - key.set代替商品コード(substituteProduct.getSubstituteProductCode().getValue()); - substituteProductMapper.deleteByPrimaryKey(key); - }); - } - - if (!product.getBoms().isEmpty()) { - product.getBoms().forEach(bom -> { - 部品表Key key = new 部品表Key(); - key.set商品コード(bom.getProductCode().getValue()); - key.set部品コード(bom.getComponentCode().getValue()); - bomMapper.deleteByPrimaryKey(key); - }); - } - - if (!product.getCustomerSpecificSellingPrices().isEmpty()) { - product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { - 顧客別販売単価Key key = new 顧客別販売単価Key(); - key.set商品コード(customerSpecificSellingPrice.getProductCode().getValue()); - key.set取引先コード(customerSpecificSellingPrice.getCustomerCode()); - customerSellingPriceMapper.deleteByPrimaryKey(key); - }); - } - - productMapper.deleteByPrimaryKey(product.getProductCode().getValue()); - } -} diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" deleted file mode 100644 index dab5d327..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - 商品コード, 代替商品コード, 優先順位, 作成日時, 作成者名, 更新日時, 更新者名 - - - - - delete from public.代替商品 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} - - - - insert into public.代替商品 (商品コード, 代替商品コード, 優先順位, - 作成日時, 作成者名, 更新日時, - 更新者名) - values (#{商品コード,jdbcType=VARCHAR}, #{代替商品コード,jdbcType=VARCHAR}, #{優先順位,jdbcType=INTEGER}, - #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, - #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.代替商品 - - - 商品コード, - - - 代替商品コード, - - - 優先順位, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{商品コード,jdbcType=VARCHAR}, - - - #{代替商品コード,jdbcType=VARCHAR}, - - - #{優先順位,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.代替商品 - - - 優先順位 = #{優先順位,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} - - - - update public.代替商品 - set 優先順位 = #{優先順位,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} - - - - - - - - delete - from public.代替商品 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" deleted file mode 100644 index ac697006..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 商品コード, 商品正式名, 商品略称, 商品名カナ, 商品区分, 製品型番, 販売単価, 仕入単価, 売上原価, 税区分, 商品分類コード, - 雑区分, 在庫管理対象区分, - 在庫引当区分, 仕入先コード, 仕入先枝番, 作成日時, 作成者名, 更新日時, 更新者名 - - - - - delete from public.商品マスタ - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - - - insert into public.商品マスタ (商品コード, 商品正式名, 商品略称, - 商品名カナ, 商品区分, 製品型番, - 販売単価, 仕入単価, 売上原価, 税区分, - 商品分類コード, 雑区分, 在庫管理対象区分, - 在庫引当区分, 仕入先コード, 仕入先枝番, - 作成日時, 作成者名, 更新日時, - 更新者名) - values (#{商品コード,jdbcType=VARCHAR}, #{商品正式名,jdbcType=VARCHAR}, #{商品略称,jdbcType=VARCHAR}, - #{商品名カナ,jdbcType=VARCHAR}, #{商品区分,jdbcType=VARCHAR}, #{製品型番,jdbcType=VARCHAR}, - #{販売単価,jdbcType=INTEGER}, #{仕入単価,jdbcType=INTEGER}, #{売上原価,jdbcType=INTEGER}, - #{税区分,jdbcType=INTEGER}, - #{商品分類コード,jdbcType=VARCHAR}, #{雑区分,jdbcType=INTEGER}, #{在庫管理対象区分,jdbcType=INTEGER}, - #{在庫引当区分,jdbcType=INTEGER}, #{仕入先コード,jdbcType=VARCHAR}, #{仕入先枝番,jdbcType=INTEGER}, - #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, - #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.商品マスタ - - - 商品コード, - - - 商品正式名, - - - 商品略称, - - - 商品名カナ, - - - 商品区分, - - - 製品型番, - - - 販売単価, - - - 仕入単価, - - - 売上原価, - - - 税区分, - - - 商品分類コード, - - - 雑区分, - - - 在庫管理対象区分, - - - 在庫引当区分, - - - 仕入先コード, - - - 仕入先枝番, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{商品コード,jdbcType=VARCHAR}, - - - #{商品正式名,jdbcType=VARCHAR}, - - - #{商品略称,jdbcType=VARCHAR}, - - - #{商品名カナ,jdbcType=VARCHAR}, - - - #{商品区分,jdbcType=VARCHAR}, - - - #{製品型番,jdbcType=VARCHAR}, - - - #{販売単価,jdbcType=INTEGER}, - - - #{仕入単価,jdbcType=INTEGER}, - - - #{売上原価,jdbcType=INTEGER}, - - - #{税区分,jdbcType=INTEGER}, - - - #{商品分類コード,jdbcType=VARCHAR}, - - - #{雑区分,jdbcType=INTEGER}, - - - #{在庫管理対象区分,jdbcType=INTEGER}, - - - #{在庫引当区分,jdbcType=INTEGER}, - - - #{仕入先コード,jdbcType=VARCHAR}, - - - #{仕入先枝番,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.商品マスタ - - - 商品正式名 = #{商品正式名,jdbcType=VARCHAR}, - - - 商品略称 = #{商品略称,jdbcType=VARCHAR}, - - - 商品名カナ = #{商品名カナ,jdbcType=VARCHAR}, - - - 商品区分 = #{商品区分,jdbcType=VARCHAR}, - - - 製品型番 = #{製品型番,jdbcType=VARCHAR}, - - - 販売単価 = #{販売単価,jdbcType=INTEGER}, - - - 仕入単価 = #{仕入単価,jdbcType=INTEGER}, - - - 売上原価 = #{売上原価,jdbcType=INTEGER}, - - - 税区分 = #{税区分,jdbcType=INTEGER}, - - - 商品分類コード = #{商品分類コード,jdbcType=VARCHAR}, - - - 雑区分 = #{雑区分,jdbcType=INTEGER}, - - - 在庫管理対象区分 = #{在庫管理対象区分,jdbcType=INTEGER}, - - - 在庫引当区分 = #{在庫引当区分,jdbcType=INTEGER}, - - - 仕入先コード = #{仕入先コード,jdbcType=VARCHAR}, - - - 仕入先枝番 = #{仕入先枝番,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - - - update public.商品マスタ - set 商品正式名 = #{商品正式名,jdbcType=VARCHAR}, - 商品略称 = #{商品略称,jdbcType=VARCHAR}, - 商品名カナ = #{商品名カナ,jdbcType=VARCHAR}, - 商品区分 = #{商品区分,jdbcType=VARCHAR}, - 製品型番 = #{製品型番,jdbcType=VARCHAR}, - 販売単価 = #{販売単価,jdbcType=INTEGER}, - 仕入単価 = #{仕入単価,jdbcType=INTEGER}, - 売上原価 = #{売上原価,jdbcType=INTEGER}, - 税区分 = #{税区分,jdbcType=INTEGER}, - 商品分類コード = #{商品分類コード,jdbcType=VARCHAR}, - 雑区分 = #{雑区分,jdbcType=INTEGER}, - 在庫管理対象区分 = #{在庫管理対象区分,jdbcType=INTEGER}, - 在庫引当区分 = #{在庫引当区分,jdbcType=INTEGER}, - 仕入先コード = #{仕入先コード,jdbcType=VARCHAR}, - 仕入先枝番 = #{仕入先枝番,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - - - - - - - diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" deleted file mode 100644 index 8248004c..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 商品分類コード, 商品分類名, 商品分類階層, 商品分類パス, 最下層区分, 作成日時, 作成者名, 更新日時, 更新者名 - - - - - delete from public.商品分類マスタ - where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} - - - - insert into public.商品分類マスタ (商品分類コード, 商品分類名, 商品分類階層, - 商品分類パス, 最下層区分, 作成日時, - 作成者名, 更新日時, 更新者名) - values (#{商品分類コード,jdbcType=VARCHAR}, #{商品分類名,jdbcType=VARCHAR}, #{商品分類階層,jdbcType=INTEGER}, - #{商品分類パス,jdbcType=VARCHAR}, #{最下層区分,jdbcType=INTEGER}, #{作成日時,jdbcType=TIMESTAMP}, - #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.商品分類マスタ - - - 商品分類コード, - - - 商品分類名, - - - 商品分類階層, - - - 商品分類パス, - - - 最下層区分, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{商品分類コード,jdbcType=VARCHAR}, - - - #{商品分類名,jdbcType=VARCHAR}, - - - #{商品分類階層,jdbcType=INTEGER}, - - - #{商品分類パス,jdbcType=VARCHAR}, - - - #{最下層区分,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.商品分類マスタ - - - 商品分類名 = #{商品分類名,jdbcType=VARCHAR}, - - - 商品分類階層 = #{商品分類階層,jdbcType=INTEGER}, - - - 商品分類パス = #{商品分類パス,jdbcType=VARCHAR}, - - - 最下層区分 = #{最下層区分,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} - - - - update public.商品分類マスタ - set 商品分類名 = #{商品分類名,jdbcType=VARCHAR}, - 商品分類階層 = #{商品分類階層,jdbcType=INTEGER}, - 商品分類パス = #{商品分類パス,jdbcType=VARCHAR}, - 最下層区分 = #{最下層区分,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} - - - - diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.xml" deleted file mode 100644 index 4e1149aa..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.xml" +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - 商品コード, 部品コード, 部品数量, 作成日時, 作成者名, 更新日時, 更新者名 - - - - - delete from public.部品表 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 部品コード = #{部品コード,jdbcType=VARCHAR} - - - - insert into public.部品表 (商品コード, 部品コード, 部品数量, - 作成日時, 作成者名, 更新日時, - 更新者名) - values (#{商品コード,jdbcType=VARCHAR}, #{部品コード,jdbcType=VARCHAR}, #{部品数量,jdbcType=INTEGER}, - #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, - #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.部品表 - - - 商品コード, - - - 部品コード, - - - 部品数量, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{商品コード,jdbcType=VARCHAR}, - - - #{部品コード,jdbcType=VARCHAR}, - - - #{部品数量,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.部品表 - - - 部品数量 = #{部品数量,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 部品コード = #{部品コード,jdbcType=VARCHAR} - - - - update public.部品表 - set 部品数量 = #{部品数量,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 部品コード = #{部品コード,jdbcType=VARCHAR} - - - - - - - - delete - from public.部品表 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" "b/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" deleted file mode 100644 index 80d84c6e..00000000 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - 商品コード, 取引先コード, 販売単価, 作成日時, 作成者名, 更新日時, 更新者名 - - - - - delete from public.顧客別販売単価 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 取引先コード = #{取引先コード,jdbcType=VARCHAR} - - - - insert into public.顧客別販売単価 (商品コード, 取引先コード, 販売単価, - 作成日時, 作成者名, 更新日時, - 更新者名) - values (#{商品コード,jdbcType=VARCHAR}, #{取引先コード,jdbcType=VARCHAR}, #{販売単価,jdbcType=INTEGER}, - #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, - #{更新者名,jdbcType=VARCHAR}) - - - - insert into public.顧客別販売単価 - - - 商品コード, - - - 取引先コード, - - - 販売単価, - - - 作成日時, - - - 作成者名, - - - 更新日時, - - - 更新者名, - - - - - #{商品コード,jdbcType=VARCHAR}, - - - #{取引先コード,jdbcType=VARCHAR}, - - - #{販売単価,jdbcType=INTEGER}, - - - #{作成日時,jdbcType=TIMESTAMP}, - - - #{作成者名,jdbcType=VARCHAR}, - - - #{更新日時,jdbcType=TIMESTAMP}, - - - #{更新者名,jdbcType=VARCHAR}, - - - - - - update public.顧客別販売単価 - - - 販売単価 = #{販売単価,jdbcType=INTEGER}, - - - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - - - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - - - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - - - 更新者名 = #{更新者名,jdbcType=VARCHAR}, - - - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 取引先コード = #{取引先コード,jdbcType=VARCHAR} - - - - update public.顧客別販売単価 - set 販売単価 = #{販売単価,jdbcType=INTEGER}, - 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, - 作成者名 = #{作成者名,jdbcType=VARCHAR}, - 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, - 更新者名 = #{更新者名,jdbcType=VARCHAR} - where 商品コード = #{商品コード,jdbcType=VARCHAR} - and 取引先コード = #{取引先コード,jdbcType=VARCHAR} - - - - - - - - delete - from public.顧客別販売単価 - where 商品コード = #{商品コード,jdbcType=VARCHAR} - - diff --git a/api/src/test/java/com/example/sms/presentation/api/system/auth/AuthApiControllerTest.java b/api/src/test/java/com/example/sms/presentation/api/system/auth/AuthApiControllerTest.java deleted file mode 100644 index 0ea347e1..00000000 --- a/api/src/test/java/com/example/sms/presentation/api/system/auth/AuthApiControllerTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.example.sms.presentation.api.system.auth; - -import com.example.sms.PresentationTest; -import com.example.sms.TestDataFactory; -import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; -import com.example.sms.service.system.auth.AuthApiService; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.core.Authentication; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import java.util.Objects; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@PresentationTest -@AutoConfigureMybatis -@DisplayName("認証APIコントローラ") -public class AuthApiControllerTest { - @Autowired - MockMvc mockMvc; - - @MockBean - private AuthApiService authApiService; - - @Autowired - TestDataFactory testDataFactory; - - @BeforeEach - void setUp() { - testDataFactory.setUpForAuthApiService(); - } - - @Test - @DisplayName("ユーザーを認証してJWTを返すことができる") - @Disabled("CIで失敗するため無効化") - void authenticateUserAndReturnJwt() throws Exception { - String jwtToken = "testjwt"; - when(authApiService.authenticateUser(any(Authentication.class), any(), any())).thenReturn(jwtToken); - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/api/auth/signin") - .contentType(MediaType.APPLICATION_JSON) - .content("{\"userId\":\"U999999\",\"password\":\"demo\"}")) - .andExpect(status().isOk()) - .andReturn(); - String actualResponseBody = mvcResult.getResponse().getContentAsString(); - String expectedResponseBody = "{\"userId\":\"U999999\",\"roles\":[\"ROLE_USER\"],\"accessToken\":\"testjwt\",\"tokenType\":\"Bearer\"}"; - // 改行コードとスペースを削除して比較 - expectedResponseBody = expectedResponseBody.replaceAll("\\r|\\n|\\s", ""); - actualResponseBody = actualResponseBody.replaceAll("\\r|\\n|\\s", ""); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals(expectedResponseBody, actualResponseBody); - } - - @Test - @DisplayName("ユーザーを新規登録できる") - void registerNewUser() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/api/auth/signup") - .contentType(MediaType.APPLICATION_JSON) - .content("{\"userId\":\"U999990\",\"password\":\"testpassword\",\"firstName\":\"Test\",\"lastName\":\"User\",\"role\":\"USER\"}")) - .andExpect(status().isOk()) - .andReturn(); - ResponseEntity responseEntity = ResponseEntity.ok(new MessageResponse("User registered successfully!")); - String actualMessage = Objects.requireNonNull(responseEntity.getBody()).getMessage(); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals("User registered successfully!", actualMessage); - } -} diff --git a/api/src/test/java/com/example/sms/presentation/api/system/user/UserApiControllerTest.java b/api/src/test/java/com/example/sms/presentation/api/system/user/UserApiControllerTest.java deleted file mode 100644 index 96971a30..00000000 --- a/api/src/test/java/com/example/sms/presentation/api/system/user/UserApiControllerTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.example.sms.presentation.api.system.user; - -import com.example.sms.PresentationTest; -import com.example.sms.TestDataFactory; -import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import java.util.Objects; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@DisplayName("ユーザーAPI") -@PresentationTest -@AutoConfigureMybatis -public class UserApiControllerTest { - @Autowired - MockMvc mockMvc; - - @Autowired - TestDataFactory testDataFactory; - - @BeforeEach - void setUp() { - testDataFactory.setUpForUserManagementService(); - } - - @Test - @WithMockUser(username = "U888888", roles = {"ADMIN"}) - @DisplayName("ユーザー一覧を取得できる") - void canRetrieveUserList() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/api/users") - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andReturn(); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - } - - @Test - @WithMockUser(username = "U888888", roles = {"ADMIN"}) - @DisplayName("ユーザーを取得できる") - void canRetrieveUser() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/api/users/U999999") - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andReturn(); - String actualResponseBody = mvcResult.getResponse().getContentAsString(); - String expectedResponseBody = """ - { - "userId":{"value":"U999999"}, - "password":{"value":"$2a$10$oxSJl.keBwxmsMLkcT9lPeAIxfNTPNQxpeywMrF7A3kVszwUTqfTK"}, - "name":{"firstName":"first","lastName":"last"}, - "roleName":"USER" - } - """; - // 改行コードとスペースを削除して比較 - expectedResponseBody = expectedResponseBody.replaceAll("\\r|\\n|\\s", ""); - actualResponseBody = actualResponseBody.replaceAll("\\r|\\n|\\s", ""); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals(expectedResponseBody, actualResponseBody); - } - - @Test - @WithMockUser(username = "U888888", roles = {"ADMIN"}) - @DisplayName("ユーザーを作成できる") - void canCreateUser() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/api/users") - .contentType(MediaType.APPLICATION_JSON) - .content(""" - { - "userId": "U999990", - "password": "newPassword", - "firstName": "Ddd", - "lastName": "Ddd", - "roleName": "USER" - } - """)) - .andExpect(status().isOk()) - .andReturn(); - ResponseEntity responseEntity = ResponseEntity.ok(new MessageResponse("User registered successfully!")); - String actualMessage = Objects.requireNonNull(responseEntity.getBody()).getMessage(); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals("User registered successfully!", actualMessage); - } - - @Test - @WithMockUser(username = "U888888", roles = {"ADMIN"}) - @DisplayName("ユーザーを更新できる") - void canUpdateUser() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.put("/api/users/U999999") - .contentType(MediaType.APPLICATION_JSON) - .content(""" - { - "userId": "U999999", - "password": "password", - "firstName": "firstName2", - "lastName": "lastName2", - "roleName": "ADMIN" - }""")) - .andExpect(status().isOk()) - .andReturn(); - ResponseEntity responseEntity = ResponseEntity.ok(new MessageResponse("User updated successfully!")); - String actualMessage = Objects.requireNonNull(responseEntity.getBody()).getMessage(); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals("User updated successfully!", actualMessage); - } - - @Test - @WithMockUser(username = "U888888", roles = {"ADMIN"}) - @DisplayName("ユーザーを削除できる") - void canDeleteUser() throws Exception { - MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.delete("/api/users/U999999") - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andReturn(); - ResponseEntity responseEntity = ResponseEntity.ok(new MessageResponse("User deleted successfully!")); - String actualMessage = Objects.requireNonNull(responseEntity.getBody()).getMessage(); - assertEquals(HttpStatus.OK.value(), mvcResult.getResponse().getStatus()); - assertEquals("User deleted successfully!", actualMessage); - } -} diff --git a/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java b/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java deleted file mode 100644 index a9d1672a..00000000 --- a/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.example.sms.service.master.department; - -import com.example.sms.IntegrationTest; -import com.example.sms.TestDataFactory; -import com.example.sms.domain.model.master.department.Department; -import com.example.sms.domain.model.master.department.DepartmentList; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -@IntegrationTest -@DisplayName("部門サービス") -public class DepartmentServiceTest { - @Autowired - DepartmentService departmentService; - - @Autowired - TestDataFactory testDataFactory; - - @BeforeEach - void setUp() { - testDataFactory.setUpForDepartmentService(); - } - - @Nested - @DisplayName("部門管理") - class DepartmentManagementTests { - @Test - @DisplayName("部門一覧を取得できる") - void getAllDepartments() { - DepartmentList result = departmentService.selectAll(); - - assertEquals(2, result.asList().size()); - } - - @Test - @DisplayName("部門を新規登録できる") - void registerNewDepartment() { - Department newDepartment = testDataFactory.Department(); - - departmentService.register(newDepartment); - - DepartmentList result = departmentService.selectAll(); - assertEquals(3, result.asList().size()); - assertEquals(2, result.asList().getFirst().getEmployees().size()); - } - - @Test - @DisplayName("部門の登録情報を編集できる") - void editDepartmentDetails() { - Department department = testDataFactory.Department(); - - Department updateDepartment = Department.of(department.getDepartmentId(), department.getEndDate().getValue(), "editedDepartmentName", department.getLayer(), department.getPath().getValue(), department.getLowerType().getValue(), department.getSlitYn().getValue()); - departmentService.save(updateDepartment); - - Department result = departmentService.find(department.getDepartmentId()); - assertEquals("editedDepartmentName", result.getDepartmentName()); - } - - @Test - @DisplayName("部門を削除できる") - void deleteDepartment() { - Department department = testDataFactory.Department(); - - departmentService.delete(department.getDepartmentId()); - - DepartmentList result = departmentService.selectAll(); - assertEquals(2, result.asList().size()); - } - - @Test - @DisplayName("部門を検索できる") - void findDepartment() { - Department department = testDataFactory.Department(); - - departmentService.register(department); - - Department result = departmentService.find(department.getDepartmentId()); - assertEquals(department, result); - } - } -} diff --git a/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java b/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java deleted file mode 100644 index 26794ecf..00000000 --- a/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.example.sms.service.master.employee; - -import com.example.sms.IntegrationTest; -import com.example.sms.TestDataFactory; -import com.example.sms.domain.model.master.employee.Employee; -import com.example.sms.domain.model.master.employee.EmployeeList; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -@IntegrationTest -@DisplayName("社員サービス") -public class EmployeeServiceTest { - @Autowired - private EmployeeService employeeService; - - @Autowired - private TestDataFactory testDataFactory; - - @BeforeEach - void setUp() { - testDataFactory.setUpForEmployeeService(); - } - - @Test - @DisplayName("社員一覧を取得できる") - void shouldRetrieveAllEmployees() { - EmployeeList result = employeeService.selectAll(); - assertEquals(2, result.asList().size()); - } - - @Test - @DisplayName("社員を新規登録できる") - void shouldRegisterNewEmployee() { - Employee newEmployee = testDataFactory.Employee(); - - employeeService.register(newEmployee); - - EmployeeList result = employeeService.selectAll(); - assertEquals(3, result.asList().size()); - } - - @Test - @DisplayName("社員の登録情報を編集できる") - void shouldEditEmployeeDetails() { - Employee employee = testDataFactory.Employee(); - Employee updateEmployee = Employee.of( - Employee.of(employee.getEmpCode().getValue(), "edited EmployeeName", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), - employee.getDepartment(), - employee.getUser() - ); - - employeeService.save(updateEmployee); - - Employee result = employeeService.find(employee.getEmpCode()); - assertEquals("edited EmployeeName", result.getEmpName().Name()); - } - - @Test - @DisplayName("社員を削除できる") - void shouldDeleteEmployee() { - Employee employee = testDataFactory.Employee(); - - employeeService.delete(employee.getEmpCode()); - - EmployeeList result = employeeService.selectAll(); - assertEquals(2, result.asList().size()); - } - - @Test - @DisplayName("社員を検索できる") - void shouldFindEmployee() { - Employee employee = testDataFactory.Employee(); - employeeService.register(employee); - - Employee result = employeeService.find(employee.getEmpCode()); - - assertEquals(employee, result); - } -} diff --git a/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java b/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java deleted file mode 100644 index 4d6b30c6..00000000 --- a/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.example.sms.service.master.product; - -import com.example.sms.IntegrationTest; -import com.example.sms.TestDataFactory; -import com.example.sms.domain.model.master.product.Product; -import com.example.sms.domain.model.master.product.ProductCategory; -import com.example.sms.domain.model.master.product.ProductCategoryList; -import com.example.sms.domain.model.master.product.ProductList; -import com.example.sms.domain.type.product.*; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import static org.junit.Assert.assertEquals; - -@IntegrationTest -@DisplayName("商品サービス") -public class ProductServiceTest { - @Autowired - private ProductService productService; - - @Autowired - private TestDataFactory testDataFactory; - - @BeforeEach - void setUp() { - testDataFactory.setUpForProductService(); - } - - @Nested - @DisplayName("商品") - class ProductTest { - @Test - @DisplayName("商品一覧を取得できる") - void shouldRetrieveAllProducts() { - ProductList result = productService.selectAll(); - assertEquals(3, result.asList().size()); - } - - @Test - @DisplayName("商品を新規登録できる") - void shouldRegisterNewProduct() { - Product newProduct = testDataFactory.Product(); - - productService.register(newProduct); - - ProductList result = productService.selectAll(); - assertEquals(4, result.asList().size()); - Product product = productService.find(newProduct.getProductCode().getValue()); - assertEquals(newProduct, product); - } - - @Test - @DisplayName("商品の登録情報を編集できる") - void shouldEditProductDetails() { - Product product = testDataFactory.Product(); - productService.register(product); - - Product updateProduct = Product.of(product.getProductCode().getValue(), "更新後商品正式名", "更新後商品略称", "更新後商品名カナ", ProductType.商品, 2000, 3000, 4000, TaxType.内税, "99999999", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "99999999", 6); - productService.save(updateProduct); - - Product result = productService.find(product.getProductCode().getValue()); - assertEquals("更新後商品正式名", result.getProductName().getProductFormalName()); - assertEquals(updateProduct, result); - } - - @Test - @DisplayName("商品を削除できる") - void shouldDeleteProduct() { - Product product = testDataFactory.Product(); - productService.register(product); - - productService.delete(product); - - ProductList result = productService.selectAll(); - assertEquals(3, result.asList().size()); - } - } - - @Nested - @DisplayName("商品分類") - class ProductCategoryTest { - @Test - @DisplayName("商品分類一覧を取得できる") - void shouldRetrieveAllProductCategories() { - ProductCategoryList result = productService.selectAllCategory(); - assertEquals(2, result.asList().size()); - } - - @Test - @DisplayName("商品分類を新規登録できる") - void shouldRegisterNewProductCategory() { - ProductCategory newProductCategory = testDataFactory.ProductCategory(); - productService.registerCategory(newProductCategory); - - ProductCategoryList result = productService.selectAllCategory(); - assertEquals(3, result.asList().size()); - ProductCategory productCategory = productService.findCategory(newProductCategory.getProductCategoryCode().getValue()); - assertEquals(newProductCategory, productCategory); - } - - @Test - @DisplayName("商品分類の登録情報を編集できる") - void shouldEditProductCategoryDetails() { - ProductCategory productCategory = testDataFactory.ProductCategory(); - productService.registerCategory(productCategory); - - ProductCategory updateProductCategory = ProductCategory.of(productCategory.getProductCategoryCode().getValue(), "更新後商品分類名", productCategory.getProductCategoryHierarchy(), productCategory.getProductCategoryPath(), productCategory.getLowestLevelDivision()); - productService.saveCategory(updateProductCategory); - - ProductCategory result = productService.findCategory(productCategory.getProductCategoryCode().getValue()); - assertEquals("更新後商品分類名", result.getProductCategoryName()); - assertEquals(updateProductCategory, result); - } - - @Test - @DisplayName("商品分類を削除できる") - void shouldDeleteProductCategory() { - ProductCategory productCategory = testDataFactory.ProductCategory(); - productService.registerCategory(productCategory); - - productService.deleteCategory(productCategory); - - ProductCategoryList result = productService.selectAllCategory(); - assertEquals(2, result.asList().size()); - } - } -} diff --git a/api/.gitignore b/app/backend/api/.gitignore similarity index 59% rename from api/.gitignore rename to app/backend/api/.gitignore index 4551a8f2..77ac088e 100644 --- a/api/.gitignore +++ b/app/backend/api/.gitignore @@ -36,4 +36,6 @@ out/ ### VS Code ### .vscode/ -**/src/main/java/**/autogen +/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/FlywaySchemaHistoryMapper.java +/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/FlywaySchemaHistoryMapper.xml +/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/FlywaySchemaHistory.java diff --git a/api/Procfile b/app/backend/api/Procfile similarity index 100% rename from api/Procfile rename to app/backend/api/Procfile diff --git a/api/build.gradle b/app/backend/api/build.gradle similarity index 75% rename from api/build.gradle rename to app/backend/api/build.gradle index d729f4f8..034b9d3c 100644 --- a/api/build.gradle +++ b/app/backend/api/build.gradle @@ -12,6 +12,9 @@ plugins { id "org.flywaydb.flyway" version "10.7.2" id 'de.undercouch.download' version '4.0.1' id "com.thinkimi.gradle.MybatisGenerator" version "2.4" + id 'io.qameta.allure' version '2.12.0' + id 'jacoco' + id "org.sonarqube" version "6.0.1.5171" } group = 'com.example' @@ -38,6 +41,15 @@ sourceSets { resources.srcDirs = ["src/main/java", "src/main/resources"] } } +def allureVersion = "2.24.0" + +sonar { + properties { + property "sonar.projectKey", "k2works_case-study-sales" + property "sonar.organization", "k2works" + property "sonar.host.url", "https://sonarcloud.io" + } +} dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' @@ -73,7 +85,19 @@ dependencies { testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.11.0-M1' testImplementation 'com.tngtech.archunit:archunit:1.2.2' testImplementation 'com.tngtech.archunit:archunit-junit5:1.2.2' + implementation 'com.github.pagehelper:pagehelper-spring-boot-starter:1.4.7' + testImplementation platform("io.qameta.allure:allure-bom:$allureVersion") + testImplementation "io.qameta.allure:allure-cucumber7-jvm" + testImplementation "io.qameta.allure:allure-junit-platform" implementation 'com.github.pagehelper:pagehelper-spring-boot-starter:2.1.0' + testImplementation "org.junit.jupiter:junit-jupiter:5.8.1" + testImplementation "org.testcontainers:testcontainers:1.20.4" + testImplementation "org.testcontainers:junit-jupiter:1.20.4" + testImplementation "org.testcontainers:postgresql:1.20.4" + implementation 'org.aspectj:aspectjrt:1.9.22' + implementation 'org.aspectj:aspectjtools:1.9.22' + implementation 'org.aspectj:aspectjweaver:1.9.22' + implementation 'com.opencsv:opencsv:5.8' } tasks.named('test') { @@ -120,3 +144,26 @@ mybatisProperties = ['jdbcUrl' : 'jdbc:postgresql://localhost:5432/mydb', 'jdbcUsername' : 'root', 'jdbcPassword' : 'password',] } + +allure { + adapter { + aspectjWeaver.set(false) + } +} + +test { + finalizedBy jacocoTestReport +} + +jacocoTestReport { + reports { + xml.required = true + html.required = true + } +} + +sonar { + properties { + property "sonar.exclusions", "**/autogen/**" + } +} \ No newline at end of file diff --git a/api/gradle/wrapper/gradle-wrapper.jar b/app/backend/api/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from api/gradle/wrapper/gradle-wrapper.jar rename to app/backend/api/gradle/wrapper/gradle-wrapper.jar diff --git a/api/gradle/wrapper/gradle-wrapper.properties b/app/backend/api/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from api/gradle/wrapper/gradle-wrapper.properties rename to app/backend/api/gradle/wrapper/gradle-wrapper.properties diff --git a/api/gradlew b/app/backend/api/gradlew similarity index 100% rename from api/gradlew rename to app/backend/api/gradlew diff --git a/api/gradlew.bat b/app/backend/api/gradlew.bat similarity index 100% rename from api/gradlew.bat rename to app/backend/api/gradlew.bat diff --git a/api/settings.gradle b/app/backend/api/settings.gradle similarity index 100% rename from api/settings.gradle rename to app/backend/api/settings.gradle diff --git a/api/src/main/java/com/example/sms/SmsApplication.java b/app/backend/api/src/main/java/com/example/sms/SmsApplication.java similarity index 82% rename from api/src/main/java/com/example/sms/SmsApplication.java rename to app/backend/api/src/main/java/com/example/sms/SmsApplication.java index 4882c757..4033585d 100644 --- a/api/src/main/java/com/example/sms/SmsApplication.java +++ b/app/backend/api/src/main/java/com/example/sms/SmsApplication.java @@ -1,11 +1,13 @@ package com.example.sms; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication +@MapperScan("com.example.sms.infrastructure.datasource") public class SmsApplication { public static void main(String[] args) { diff --git a/api/src/main/java/com/example/sms/WebSecurityConfig.java b/app/backend/api/src/main/java/com/example/sms/WebSecurityConfig.java similarity index 81% rename from api/src/main/java/com/example/sms/WebSecurityConfig.java rename to app/backend/api/src/main/java/com/example/sms/WebSecurityConfig.java index eec86181..55bc6f64 100644 --- a/api/src/main/java/com/example/sms/WebSecurityConfig.java +++ b/app/backend/api/src/main/java/com/example/sms/WebSecurityConfig.java @@ -14,6 +14,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; @Configuration @EnableWebSecurity @@ -23,14 +24,17 @@ public class WebSecurityConfig { PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } + @Bean public AuthTokenFilter authenticationJwtTokenFilter() { return new AuthTokenFilter(); } + @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } + @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.formLogin(login -> login @@ -47,13 +51,15 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti ).csrf(csrf -> csrf.ignoringRequestMatchers(PathRequest.toH2Console()) ).csrf(csrf -> csrf.ignoringRequestMatchers("/api/**") ).cors(cors -> cors - .configurationSource(request -> new org.springframework.web.cors.CorsConfiguration() {{ - setAllowedOriginPatterns(java.util.List.of("*")); - setAllowedMethods(java.util.List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); - setAllowedHeaders(java.util.List.of("*")); - setAllowCredentials(true); - }} - ) + .configurationSource(request -> { + org.springframework.web.cors.CorsConfiguration corsConfiguration = new org.springframework.web.cors.CorsConfiguration(); + corsConfiguration.setAllowedOriginPatterns(java.util.List.of("*")); + corsConfiguration.addAllowedOrigin("http://localhost:8080"); + corsConfiguration.addAllowedMethod(CorsConfiguration.ALL); + corsConfiguration.addAllowedHeader(CorsConfiguration.ALL); + corsConfiguration.setAllowCredentials(true); + return corsConfiguration; + }) ).authorizeHttpRequests(authz -> authz .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll() .requestMatchers("/h2-console/**").permitAll() @@ -63,7 +69,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti //).sessionManagement(s -> s.sessionCreationPolicy(SessionCreationPolicy.STATELESS) //).exceptionHandling(ex -> ex.authenticationEntryPoint(new AuthEntryPointJwt()) ); - http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class); return http.build(); } diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/Exchange.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Exchange.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/money/Exchange.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Exchange.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/Expression.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Expression.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/money/Expression.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Expression.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/Money.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Money.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/money/Money.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Money.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java new file mode 100644 index 00000000..78ecb0a4 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Pair.java @@ -0,0 +1,50 @@ +package com.example.sms.domain.model.common.money; + +import com.example.sms.domain.type.money.CurrencyType; +import java.util.Objects; + +/** + * 通貨ペア + */ +public class Pair { + private final CurrencyType from; + private final CurrencyType to; + + public Pair(CurrencyType from, CurrencyType to) { + this.from = from; + this.to = to; + } + + public CurrencyType getFrom() { + return from; + } + + public CurrencyType getTo() { + return to; + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof Pair)) { + return false; + } + Pair pair = (Pair) object; + return from.equals(pair.from) && to.equals(pair.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + return "Pair{" + + "from=" + from + + ", to=" + to + + '}'; + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/Sum.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Sum.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/money/Sum.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/money/Sum.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/money/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/money/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/money/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/money/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/quantity/Quantity.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/quantity/Quantity.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/quantity/Quantity.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/quantity/Quantity.java diff --git a/api/src/main/java/com/example/sms/domain/model/common/quantity/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/common/quantity/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/common/quantity/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/common/quantity/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/Department.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/Department.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/Department.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/Department.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentEndDate.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentEndDate.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentEndDate.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentEndDate.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentId.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentId.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentId.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentId.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java similarity index 52% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java index 21c7d761..749f0709 100644 --- a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentList.java @@ -1,5 +1,7 @@ package com.example.sms.domain.model.master.department; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -9,13 +11,19 @@ public class DepartmentList { List value; public DepartmentList(List value) { - this.value = value; + this.value = Collections.unmodifiableList(value); } public int size() { return value.size(); } + public DepartmentList add(Department department) { + List newValue = new ArrayList<>(value); + newValue.add(department); + return new DepartmentList(newValue); + } + public List asList() { return value; } diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentPath.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentPath.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentPath.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentPath.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentStartDate.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentStartDate.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/DepartmentStartDate.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/DepartmentStartDate.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/department/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/department/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/department/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/department/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/Employee.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/Employee.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/Employee.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/Employee.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java similarity index 52% rename from api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java index c8632614..d2b30f73 100644 --- a/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeList.java @@ -1,5 +1,7 @@ package com.example.sms.domain.model.master.employee; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -9,13 +11,19 @@ public class EmployeeList { List value; public EmployeeList(List value) { - this.value = value; + this.value = Collections.unmodifiableList(value); } public int size() { return value.size(); } + public EmployeeList add(Employee employee) { + List newValue = new ArrayList<>(value); + newValue.add(employee); + return new EmployeeList(newValue); + } + public List asList() { return value; } diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeName.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeName.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeName.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/EmployeeName.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/FaxNumber.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/FaxNumber.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/FaxNumber.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/FaxNumber.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/JobCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/JobCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/JobCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/JobCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/PhoneNumber.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/PhoneNumber.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/PhoneNumber.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/PhoneNumber.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/employee/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/employee/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/employee/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/Bom.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/Bom.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/Bom.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/Bom.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/CustomerSpecificSellingPrice.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/CustomerSpecificSellingPrice.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/CustomerSpecificSellingPrice.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/CustomerSpecificSellingPrice.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/Product.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/Product.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/Product.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/Product.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategory.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategory.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductCategory.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategory.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java similarity index 52% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java index 8f0f5f6f..4d110124 100644 --- a/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCategoryList.java @@ -1,5 +1,7 @@ package com.example.sms.domain.model.master.product; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -9,13 +11,19 @@ public class ProductCategoryList { List value; public ProductCategoryList(List value) { - this.value = value; + this.value = Collections.unmodifiableList(value); } public int size() { return value.size(); } + public ProductCategoryList add(ProductCategory productCategory) { + List newValue = new ArrayList<>(value); + newValue.add(productCategory); + return new ProductCategoryList(newValue); + } + public List asList() { return value; } diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java similarity index 52% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java index 96dfcaf4..b06fac61 100644 --- a/api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductList.java @@ -1,5 +1,7 @@ package com.example.sms.domain.model.master.product; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -9,13 +11,19 @@ public class ProductList { List value; public ProductList(List value) { - this.value = value; + this.value = Collections.unmodifiableList(value); } public int size() { return value.size(); } + public ProductList add(Product product) { + List newValue = new ArrayList<>(value); + newValue.add(product); + return new ProductList(newValue); + } + public List asList() { return value; } diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/ProductName.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductName.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/ProductName.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/ProductName.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/SubstituteProduct.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/SubstituteProduct.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/SubstituteProduct.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/SubstituteProduct.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/SupplierCode.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/SupplierCode.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/SupplierCode.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/SupplierCode.java diff --git a/api/src/main/java/com/example/sms/domain/model/master/product/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/master/product/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/master/product/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/master/product/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistory.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistory.java new file mode 100644 index 00000000..538214eb --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistory.java @@ -0,0 +1,63 @@ +package com.example.sms.domain.model.system.audit; + +import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +import java.time.LocalDateTime; + +/** + * アプリケーション実行履歴 + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class ApplicationExecutionHistory { + /** + * ID + */ + Integer id; + + /** + * アプリケーション実行プロセス + */ + ApplicationExecutionProcess process; + + /** + * アプリケーション実行履歴区分 + */ + ApplicationExecutionHistoryType type; + + /** + * プロセス開始日時 + */ + LocalDateTime processStart; + + /** + * プロセス終了日時 + */ + LocalDateTime processEnd; + + /** + * プロセスフラグ + */ + ApplicationExecutionProcessFlag processFlag; + + /** + * プロセス詳細 + */ + String processDetails; + + /** + * ユーザー + */ + User user; + + public static ApplicationExecutionHistory of(Integer id, String processName, String processCode, ApplicationExecutionHistoryType type, LocalDateTime processStart, LocalDateTime processEnd, ApplicationExecutionProcessFlag processFlag, String processDetails, User user) { + ApplicationExecutionProcess process = ApplicationExecutionProcess.of(processName, processCode); + return new ApplicationExecutionHistory(id, process, type, processStart, processEnd, processFlag, processDetails, user); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistoryList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistoryList.java new file mode 100644 index 00000000..2366ede3 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionHistoryList.java @@ -0,0 +1,30 @@ +package com.example.sms.domain.model.system.audit; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * アプリケーション実行履歴一覧 + */ +public class ApplicationExecutionHistoryList { + List value; + + public ApplicationExecutionHistoryList(List value) { + this.value = Collections.unmodifiableList(value); + } + + public int size() { + return value.size(); + } + + public ApplicationExecutionHistoryList add(ApplicationExecutionHistory applicationExecutionHistory) { + List newValue = new ArrayList<>(value); + newValue.add(applicationExecutionHistory); + return new ApplicationExecutionHistoryList(newValue); + } + + public List asList() { + return value; + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionProcess.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionProcess.java new file mode 100644 index 00000000..93303785 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/ApplicationExecutionProcess.java @@ -0,0 +1,36 @@ +package com.example.sms.domain.model.system.audit; + +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +import java.util.Objects; + +/** + * アプリケーション実行プロセス + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class ApplicationExecutionProcess { + ApplicationExecutionProcessType processType; + String name; + String code; + + public static ApplicationExecutionProcess of(String processName, String processCode) { + ApplicationExecutionProcessType processType = ApplicationExecutionProcessType.fromNameAndCode(processName, processCode); + if (!processType.getCode().equals(processCode)) { + throw new IllegalArgumentException("不正なプロセスコードです。"); + } + return new ApplicationExecutionProcess(processType, processName, processCode); + } + + public String getName() { + return Objects.requireNonNull(processType).getName(); + } + + public String getCode() { + return Objects.requireNonNull(processType).getCode(); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/package-info.java new file mode 100644 index 00000000..45f1580a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/audit/package-info.java @@ -0,0 +1,4 @@ +/** + * 監査 + */ +package com.example.sms.domain.model.system.audit; \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/domain/model/system/auth/AuthUserDetails.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/auth/AuthUserDetails.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/auth/AuthUserDetails.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/auth/AuthUserDetails.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/auth/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/auth/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/auth/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/auth/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Department.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Department.java new file mode 100644 index 00000000..01894a08 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Department.java @@ -0,0 +1,21 @@ +package com.example.sms.domain.model.system.download; + +import com.example.sms.domain.type.download.DownloadTarget; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +/** + * 部門ダウンロード条件 + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class Department implements DownloadCriteria { + DownloadTarget target; + String fileName; + + public static Department of() { + return new Department(DownloadTarget.部門, ""); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/DownloadCriteria.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/DownloadCriteria.java new file mode 100644 index 00000000..1aa15408 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/DownloadCriteria.java @@ -0,0 +1,12 @@ +package com.example.sms.domain.model.system.download; + +import com.example.sms.domain.type.download.DownloadTarget; + +/** + * ダウンロード条件 + */ +public interface DownloadCriteria { + DownloadTarget getTarget(); + + String getFileName(); +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Employee.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Employee.java new file mode 100644 index 00000000..7f2764fa --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Employee.java @@ -0,0 +1,21 @@ +package com.example.sms.domain.model.system.download; + +import com.example.sms.domain.type.download.DownloadTarget; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +/** + * 社員ダウンロード条件 + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class Employee implements DownloadCriteria { + DownloadTarget target; + String fileName; + + public static Employee of() { + return new Employee(DownloadTarget.社員, ""); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Product.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Product.java new file mode 100644 index 00000000..0081ea47 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/Product.java @@ -0,0 +1,21 @@ +package com.example.sms.domain.model.system.download; + +import com.example.sms.domain.type.download.DownloadTarget; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +/** + * 商品ダウンロード条件 + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class Product implements DownloadCriteria { + DownloadTarget target; + String fileName; + + public static Product of() { + return new Product(DownloadTarget.商品, ""); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/ProductCategory.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/ProductCategory.java new file mode 100644 index 00000000..08e40048 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/ProductCategory.java @@ -0,0 +1,21 @@ +package com.example.sms.domain.model.system.download; + +import com.example.sms.domain.type.download.DownloadTarget; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Value; + +/** + * 商品分類ダウンロード条件 + */ +@Value +@RequiredArgsConstructor +@NoArgsConstructor(force = true) +public class ProductCategory implements DownloadCriteria { + DownloadTarget target; + String fileName; + + public static ProductCategory of() { + return new ProductCategory(DownloadTarget.商品分類,""); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/package-info.java new file mode 100644 index 00000000..e253dc02 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/download/package-info.java @@ -0,0 +1,4 @@ +/** + * データダウンロード + */ +package com.example.sms.domain.model.system.download; \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/domain/model/system/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/Name.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/Name.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/Name.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/Name.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/Password.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/Password.java new file mode 100644 index 00000000..1625e7cc --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/Password.java @@ -0,0 +1,52 @@ +package com.example.sms.domain.model.system.user; + +import lombok.NoArgsConstructor; +import lombok.Value; + +/** + * パスワード + */ +@Value +@NoArgsConstructor(force = true) +public class Password { + String value; + + public Password(String value) { + if (value == null || value.isEmpty()) { + this.value = ""; + } else { + checkPolicy(value); + this.value = value; + } + } + + private void checkPolicy(String value) { + if (value == null || value.length() < 8) { + throw new PasswordException("パスワードは8文字以上である必要があります"); + } + + boolean hasDigit = false; + boolean hasLower = false; + boolean hasUpper = false; + + for (char c : value.toCharArray()) { + if (Character.isDigit(c)) hasDigit = true; + else if (Character.isLowerCase(c)) hasLower = true; + else if (Character.isUpperCase(c)) hasUpper = true; + + // すべての条件を満たしたら早期終了する + if (hasDigit && hasLower && hasUpper) break; + } + + if (!hasDigit || !hasLower || !hasUpper) { + throw new PasswordException("パスワードは小文字、大文字、数字を含む必要があります"); + } + } + + /** + * パスワード + */ + public String Value() { + return value; + } +} diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/PasswordException.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/PasswordException.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/PasswordException.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/PasswordException.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/User.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/User.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/User.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/User.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/UserException.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserException.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/UserException.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserException.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/UserId.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserId.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/UserId.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserId.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/UserIdException.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserIdException.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/UserIdException.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserIdException.java diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/UserList.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserList.java similarity index 53% rename from api/src/main/java/com/example/sms/domain/model/system/user/UserList.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserList.java index 89541395..ac582b44 100644 --- a/api/src/main/java/com/example/sms/domain/model/system/user/UserList.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/UserList.java @@ -1,6 +1,8 @@ package com.example.sms.domain.model.system.user; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -10,13 +12,19 @@ public class UserList { List value; public UserList(List value) { - this.value = value; + this.value = Collections.unmodifiableList(value); } public int size() { return value.size(); } + public UserList add(User user) { + List newValue = new ArrayList<>(value); + newValue.add(user); + return new UserList(newValue); + } + public List asList() { return value; } diff --git a/api/src/main/java/com/example/sms/domain/model/system/user/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/model/system/user/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/model/system/user/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/model/system/user/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionHistoryType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionHistoryType.java new file mode 100644 index 00000000..5e3fe399 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionHistoryType.java @@ -0,0 +1,22 @@ +package com.example.sms.domain.type.audit; + +/** + * アプリケーション実行履歴区分 + */ +public enum ApplicationExecutionHistoryType { + 同期, + 非同期; + + public String getName() { + return this.name(); + } + + public static ApplicationExecutionHistoryType fromName(String name) { + for (ApplicationExecutionHistoryType type : ApplicationExecutionHistoryType.values()) { + if (type.name().equals(name)) { + return type; + } + } + throw new IllegalArgumentException("不正なアプリケーション実行履歴区分です。"); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessFlag.java b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessFlag.java new file mode 100644 index 00000000..1d1b7b4a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessFlag.java @@ -0,0 +1,30 @@ +package com.example.sms.domain.type.audit; + +/** + * アプリケーション実行プロセスフラグ + */ +public enum ApplicationExecutionProcessFlag { + 未実行(0), + 実行中(1), + 実行済(2), + エラー(3); + + private final int i; + + ApplicationExecutionProcessFlag(int i) { + this.i = i; + } + + public int getValue() { + return i; + } + + public static ApplicationExecutionProcessFlag fromValue(int i) { + for (ApplicationExecutionProcessFlag flag : ApplicationExecutionProcessFlag.values()) { + if (flag.getValue() == i) { + return flag; + } + } + throw new IllegalArgumentException("無効な値: " + i); + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessType.java new file mode 100644 index 00000000..237fb25d --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/ApplicationExecutionProcessType.java @@ -0,0 +1,45 @@ +package com.example.sms.domain.type.audit; + +import lombok.Getter; + +/** + * アプリケーション実行プロセス区分 + */ +@Getter +public enum ApplicationExecutionProcessType { + ユーザー登録("ユーザー登録", "0001"), + ユーザー更新("ユーザー更新", "0002"), + ユーザー削除("ユーザー削除", "0003"), + 部門登録("部門登録", "0004"), + 部門更新("部門更新", "0005"), + 部門削除("部門削除", "0006"), + 社員登録("社員登録", "0007"), + 社員更新("社員更新", "0008"), + 社員削除("社員削除", "0009"), + 商品分類登録("商品分類登録", "0010"), + 商品分類更新("商品分類更新", "0011"), + 商品分類削除("商品分類削除", "0012"), + 商品登録("商品登録", "0013"), + 商品更新("商品更新", "0014"), + 商品削除("商品削除", "0015"), + データダウンロード("データダウンロード", "9001"), + その他("その他", "9999"); + + private final String name; + + private final String code; + + ApplicationExecutionProcessType(String name, String code) { + this.name = name; + this.code = code; + } + + public static ApplicationExecutionProcessType fromNameAndCode(String name, String code) { + for (ApplicationExecutionProcessType type : ApplicationExecutionProcessType.values()) { + if (type.getName().equals(name) && type.getCode().equals(code)) { + return type; + } + } + throw new IllegalArgumentException("無効な名前またはコード: " + name + ", " + code); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/audit/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/package-info.java new file mode 100644 index 00000000..be88d0a0 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/audit/package-info.java @@ -0,0 +1,4 @@ +/** + * 監査 + */ +package com.example.sms.domain.type.audit; \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/domain/type/department/DepartmentLowerType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/department/DepartmentLowerType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/department/DepartmentLowerType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/department/DepartmentLowerType.java diff --git a/api/src/main/java/com/example/sms/domain/type/department/SlitYnType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/department/SlitYnType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/department/SlitYnType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/department/SlitYnType.java diff --git a/api/src/main/java/com/example/sms/domain/type/department/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/department/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/department/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/department/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/download/DownloadTarget.java b/app/backend/api/src/main/java/com/example/sms/domain/type/download/DownloadTarget.java new file mode 100644 index 00000000..4a5912ed --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/download/DownloadTarget.java @@ -0,0 +1,20 @@ +package com.example.sms.domain.type.download; + +import lombok.Getter; + +/** + * ダウンロード対象 + */ +@Getter +public enum DownloadTarget { + 部門("department"), + 社員("employee"), + 商品分類("product_category"), + 商品("product"); + + private final String value; + + DownloadTarget(String value) { + this.value = value; + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/domain/type/download/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/download/package-info.java new file mode 100644 index 00000000..4d1a96e3 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/download/package-info.java @@ -0,0 +1,4 @@ +/** + * ダウンロード + */ +package com.example.sms.domain.type.download; \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java similarity index 83% rename from api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java index 2b5b8bbe..d15a1632 100644 --- a/api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/money/CurrencyType.java @@ -1,7 +1,7 @@ package com.example.sms.domain.type.money; /** - * 通過タイプ + * 通貨タイプ */ public enum CurrencyType { JPY,USD,CHF diff --git a/api/src/main/java/com/example/sms/domain/type/money/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/money/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/money/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/money/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/type/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/type/product/BusinessType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/BusinessType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/product/BusinessType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/BusinessType.java diff --git a/api/src/main/java/com/example/sms/domain/type/product/ItemType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/ItemType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/product/ItemType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/ItemType.java diff --git a/api/src/main/java/com/example/sms/domain/type/product/LiveStockType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/LiveStockType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/product/LiveStockType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/LiveStockType.java diff --git a/api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java similarity index 63% rename from api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java index ef5afee8..81900e84 100644 --- a/api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/product/MiscellaneousType.java @@ -15,6 +15,15 @@ public enum MiscellaneousType { this.code = code; } + public static Integer getCodeByName(String name) { + for (MiscellaneousType miscellaneousType : MiscellaneousType.values()) { + if (miscellaneousType.name().equals(name)) { + return miscellaneousType.getCode(); + } + } + throw new IllegalArgumentException("雑区分未登録:" + name); + } + public static MiscellaneousType fromCode(Integer code) { for (MiscellaneousType miscellaneousType : MiscellaneousType.values()) { if (miscellaneousType.code.equals(code)) { diff --git a/api/src/main/java/com/example/sms/domain/type/product/ProductType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/ProductType.java similarity index 65% rename from api/src/main/java/com/example/sms/domain/type/product/ProductType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/ProductType.java index 45758a7d..89f9451d 100644 --- a/api/src/main/java/com/example/sms/domain/type/product/ProductType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/product/ProductType.java @@ -15,6 +15,15 @@ public enum ProductType { this.code = code; } + public static String getCodeByName(String name) { + for (ProductType productType : ProductType.values()) { + if (productType.name().equals(name)) { + return productType.getCode(); + } + } + throw new IllegalArgumentException("商品区分未登録:" + name); + } + public static ProductType fromCode(String code) { for (ProductType productType : ProductType.values()) { if (productType.code.equals(code)) { diff --git a/api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java similarity index 63% rename from api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java index df4819a8..da7cacff 100644 --- a/api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/product/StockAllocationType.java @@ -15,6 +15,15 @@ public enum StockAllocationType { this.code = code; } + public static Integer getCodeByName(String name) { + for (StockAllocationType stockAllocationType : StockAllocationType.values()) { + if (stockAllocationType.name().equals(name)) { + return stockAllocationType.getCode(); + } + } + throw new IllegalArgumentException("在庫引当区分未登録:" + name); + } + public static StockAllocationType fromCode(Integer code) { for (StockAllocationType stockAllocationType : StockAllocationType.values()) { if (stockAllocationType.code.equals(code)) { diff --git a/api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java similarity index 63% rename from api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java index 57e18ac8..c0af1c71 100644 --- a/api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/product/StockManagementTargetType.java @@ -15,6 +15,15 @@ public enum StockManagementTargetType { this.code = code; } + public static Integer getCodeByName(String name) { + for (StockManagementTargetType stockManagementTargetType : StockManagementTargetType.values()) { + if (stockManagementTargetType.name().equals(name)) { + return stockManagementTargetType.getCode(); + } + } + throw new IllegalArgumentException("在庫管理対象区分未登録:" + name); + } + public static StockManagementTargetType fromCode(Integer code) { for (StockManagementTargetType stockManagementTargetType : StockManagementTargetType.values()) { if (stockManagementTargetType.code.equals(code)) { diff --git a/api/src/main/java/com/example/sms/domain/type/product/TaxType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/TaxType.java similarity index 64% rename from api/src/main/java/com/example/sms/domain/type/product/TaxType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/TaxType.java index 740435f9..56292428 100644 --- a/api/src/main/java/com/example/sms/domain/type/product/TaxType.java +++ b/app/backend/api/src/main/java/com/example/sms/domain/type/product/TaxType.java @@ -15,6 +15,15 @@ public enum TaxType { this.code = code; } + public static Integer getCodeByName(String name) { + for (TaxType taxType : TaxType.values()) { + if (taxType.name().equals(name)) { + return taxType.getCode(); + } + } + throw new IllegalArgumentException("税区分未登録:" + name); + } + public static TaxType fromCode(Integer code) { for (TaxType taxType : TaxType.values()) { if (taxType.code.equals(code)) { diff --git a/api/src/main/java/com/example/sms/domain/type/product/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/product/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/product/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/product/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/type/quantity/UnitType.java b/app/backend/api/src/main/java/com/example/sms/domain/type/quantity/UnitType.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/quantity/UnitType.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/quantity/UnitType.java diff --git a/api/src/main/java/com/example/sms/domain/type/quantity/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/quantity/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/quantity/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/quantity/package-info.java diff --git a/api/src/main/java/com/example/sms/domain/type/user/RoleName.java b/app/backend/api/src/main/java/com/example/sms/domain/type/user/RoleName.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/user/RoleName.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/user/RoleName.java diff --git a/api/src/main/java/com/example/sms/domain/type/user/package-info.java b/app/backend/api/src/main/java/com/example/sms/domain/type/user/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/domain/type/user/package-info.java rename to app/backend/api/src/main/java/com/example/sms/domain/type/user/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/CustomMappingStrategy.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/CustomMappingStrategy.java new file mode 100644 index 00000000..52a807b9 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/CustomMappingStrategy.java @@ -0,0 +1,35 @@ +package com.example.sms.infrastructure; + +import com.opencsv.bean.BeanField; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.CsvBindByName; +import com.opencsv.exceptions.CsvRequiredFieldEmptyException; +import org.apache.commons.lang3.StringUtils; + +public class CustomMappingStrategy extends ColumnPositionMappingStrategy{ + @Override + public String[] generateHeader(T bean) throws CsvRequiredFieldEmptyException { + final int numColumns = getFieldMap().values().size(); + super.generateHeader(bean); + + String[] header = new String[numColumns]; + + BeanField beanField; + for (int i = 0; i < numColumns; i++) { + beanField = findField(i); + String columnHeaderName = extractHeaderName(beanField); + header[i] = columnHeaderName; + } + return header; + } + + private String extractHeaderName(final BeanField beanField) { + if (beanField == null || beanField.getField() == null || beanField.getField().getDeclaredAnnotationsByType( + CsvBindByName.class).length == 0) { + return StringUtils.EMPTY; + } + + final CsvBindByName bindByNameAnnotation = beanField.getField().getDeclaredAnnotationsByType(CsvBindByName.class)[0]; + return bindByNameAnnotation.column(); + } +} diff --git a/api/src/main/java/com/example/sms/infrastructure/PageInfoHelper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/PageInfoHelper.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/PageInfoHelper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/PageInfoHelper.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/Pattern2WriteCSVUtil.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/Pattern2WriteCSVUtil.java new file mode 100644 index 00000000..1806b1db --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/Pattern2WriteCSVUtil.java @@ -0,0 +1,32 @@ +package com.example.sms.infrastructure; + +import com.opencsv.CSVWriter; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.util.List; + +public class Pattern2WriteCSVUtil{ + @FunctionalInterface + public interface CSVWriterFunction { + void accept(OutputStreamWriter streamWriter, List list) throws Exception; + } + + public static CSVWriterFunction writeCsv(Class clazz) { + return (streamWriter, csvList) -> { + CustomMappingStrategy mappingStrategy = new CustomMappingStrategy<>(); + mappingStrategy.setType(clazz); + StatefulBeanToCsv writer = new StatefulBeanToCsvBuilder(streamWriter) + .withSeparator(CSVWriter.DEFAULT_SEPARATOR) + .withMappingStrategy(mappingStrategy) + .withOrderedResults(false) + .build(); + writer.write(csvList); + streamWriter.flush(); + }; + } +} + diff --git a/api/src/main/java/com/example/sms/infrastructure/_configuration/SpringDocConfiguration.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/_configuration/SpringDocConfiguration.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/_configuration/SpringDocConfiguration.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/_configuration/SpringDocConfiguration.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/ObjectOptimisticLockingFailureException.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/ObjectOptimisticLockingFailureException.java new file mode 100644 index 00000000..7a541cb3 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/ObjectOptimisticLockingFailureException.java @@ -0,0 +1,18 @@ +package com.example.sms.infrastructure.datasource; + +import lombok.Getter; + +@Getter +public class ObjectOptimisticLockingFailureException extends RuntimeException { + + private final Class entityType; + private final Object identifier; + + public ObjectOptimisticLockingFailureException(Class entityType, Object identifier) { + super("Optimistic locking failed for entity type: " + + entityType.getSimpleName() + " with identifier: " + identifier); + this.entityType = entityType; + this.identifier = identifier; + } + +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.java new file mode 100644 index 00000000..7cb5fe75 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.java @@ -0,0 +1,53 @@ +package com.example.sms.infrastructure.datasource.autogen.mapper; + +import com.example.sms.infrastructure.datasource.autogen.model.ApplicationExecutionHistory; + +public interface ApplicationExecutionHistoryMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + int deleteByPrimaryKey(Integer id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + int insert(ApplicationExecutionHistory record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + int insertSelective(ApplicationExecutionHistory record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + ApplicationExecutionHistory selectByPrimaryKey(Integer id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + int updateByPrimaryKeySelective(ApplicationExecutionHistory record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table system.application_execution_history + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + int updateByPrimaryKey(ApplicationExecutionHistory record); +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.xml new file mode 100644 index 00000000..a6a7ef11 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/ApplicationExecutionHistoryMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + id, process_name, process_code, process_type, process_start, process_end, process_flag, + process_details, version, user_id + + + + + delete from system.application_execution_history + where id = #{id,jdbcType=INTEGER} + + + + insert into system.application_execution_history (id, process_name, process_code, + process_type, process_start, process_end, + process_flag, process_details, version, + user_id) + values (#{id,jdbcType=INTEGER}, #{processName,jdbcType=VARCHAR}, #{processCode,jdbcType=VARCHAR}, + #{processType,jdbcType=VARCHAR}, #{processStart,jdbcType=TIMESTAMP}, #{processEnd,jdbcType=TIMESTAMP}, + #{processFlag,jdbcType=INTEGER}, #{processDetails,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, + #{userId,jdbcType=VARCHAR}) + + + + insert into system.application_execution_history + + + id, + + + process_name, + + + process_code, + + + process_type, + + + process_start, + + + process_end, + + + process_flag, + + + process_details, + + + version, + + + user_id, + + + + + #{id,jdbcType=INTEGER}, + + + #{processName,jdbcType=VARCHAR}, + + + #{processCode,jdbcType=VARCHAR}, + + + #{processType,jdbcType=VARCHAR}, + + + #{processStart,jdbcType=TIMESTAMP}, + + + #{processEnd,jdbcType=TIMESTAMP}, + + + #{processFlag,jdbcType=INTEGER}, + + + #{processDetails,jdbcType=VARCHAR}, + + + #{version,jdbcType=INTEGER}, + + + #{userId,jdbcType=VARCHAR}, + + + + + + update system.application_execution_history + + + process_name = #{processName,jdbcType=VARCHAR}, + + + process_code = #{processCode,jdbcType=VARCHAR}, + + + process_type = #{processType,jdbcType=VARCHAR}, + + + process_start = #{processStart,jdbcType=TIMESTAMP}, + + + process_end = #{processEnd,jdbcType=TIMESTAMP}, + + + process_flag = #{processFlag,jdbcType=INTEGER}, + + + process_details = #{processDetails,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + update system.application_execution_history + set process_name = #{processName,jdbcType=VARCHAR}, + process_code = #{processCode,jdbcType=VARCHAR}, + process_type = #{processType,jdbcType=VARCHAR}, + process_start = #{processStart,jdbcType=TIMESTAMP}, + process_end = #{processEnd,jdbcType=TIMESTAMP}, + process_flag = #{processFlag,jdbcType=INTEGER}, + process_details = #{processDetails,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.java similarity index 65% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.java index 3cba94f2..87b26c28 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.java @@ -1,17 +1,13 @@ -package com.example.sms.infrastructure.datasource.system.user; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; -import java.util.List; - -@Mapper public interface UsrMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(String userId); @@ -19,7 +15,7 @@ public interface UsrMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(Usr record); @@ -27,7 +23,7 @@ public interface UsrMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(Usr record); @@ -35,7 +31,7 @@ public interface UsrMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ Usr selectByPrimaryKey(String userId); @@ -43,7 +39,7 @@ public interface UsrMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(Usr record); @@ -51,12 +47,7 @@ public interface UsrMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table system.usr * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(Usr record); - - List selectAll(); - - @Select("DELETE FROM system.usr") - void deleteAll(); -} +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.xml similarity index 79% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.xml rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.xml index 1576c095..26f3ac9a 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrMapper.xml +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/UsrMapper.xml @@ -1,11 +1,11 @@ - - + + @@ -17,7 +17,7 @@ user_id, first_name, last_name, password, role_name @@ -25,9 +25,9 @@ - select + select from system.usr where user_id = #{userId,jdbcType=VARCHAR} @@ -36,27 +36,27 @@ delete from system.usr where user_id = #{userId,jdbcType=VARCHAR} - + - insert into system.usr (user_id, first_name, last_name, + insert into system.usr (user_id, first_name, last_name, password, role_name) - values (#{userId,jdbcType=VARCHAR}, #{firstName,jdbcType=VARCHAR}, #{lastName,jdbcType=VARCHAR}, + values (#{userId,jdbcType=VARCHAR}, #{firstName,jdbcType=VARCHAR}, #{lastName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR}) - + insert into system.usr @@ -94,11 +94,11 @@ - + update system.usr @@ -117,11 +117,11 @@ where user_id = #{userId,jdbcType=VARCHAR} - + update system.usr set first_name = #{firstName,jdbcType=VARCHAR}, @@ -130,10 +130,4 @@ role_name = #{roleName,jdbcType=VARCHAR} where user_id = #{userId,jdbcType=VARCHAR} - - - + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" similarity index 64% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" index 99ffeee3..e629d102 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.java" @@ -1,17 +1,14 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.代替商品; +import com.example.sms.infrastructure.datasource.autogen.model.代替商品Key; -import java.util.List; - -@Mapper public interface 代替商品Mapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(代替商品Key key); @@ -19,7 +16,7 @@ public interface 代替商品Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(代替商品 record); @@ -27,7 +24,7 @@ public interface 代替商品Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(代替商品 record); @@ -35,7 +32,7 @@ public interface 代替商品Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 代替商品 selectByPrimaryKey(代替商品Key key); @@ -43,7 +40,7 @@ public interface 代替商品Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(代替商品 record); @@ -51,16 +48,7 @@ public interface 代替商品Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.代替商品 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(代替商品 record); - - @Delete("DELETE FROM 代替商品") - void deleteAll(); - - List<代替商品> selectAll(); - - 代替商品 selectByProductCode(String productCode); - - void deleteByProductCode(String value); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" new file mode 100644 index 00000000..f9c86e88 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\344\273\243\346\233\277\345\225\206\345\223\201Mapper.xml" @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + 商品コード, 代替商品コード, 優先順位, 作成日時, 作成者名, 更新日時, 更新者名 + + + + + delete from public.代替商品 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} + + + + insert into public.代替商品 (商品コード, 代替商品コード, 優先順位, + 作成日時, 作成者名, 更新日時, + 更新者名) + values (#{商品コード,jdbcType=VARCHAR}, #{代替商品コード,jdbcType=VARCHAR}, #{優先順位,jdbcType=INTEGER}, + #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, + #{更新者名,jdbcType=VARCHAR}) + + + + insert into public.代替商品 + + + 商品コード, + + + 代替商品コード, + + + 優先順位, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + + + #{商品コード,jdbcType=VARCHAR}, + + + #{代替商品コード,jdbcType=VARCHAR}, + + + #{優先順位,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + + + + update public.代替商品 + + + 優先順位 = #{優先順位,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} + + + + update public.代替商品 + set 優先順位 = #{優先順位,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR} + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 代替商品コード = #{代替商品コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" similarity index 62% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" index 650ad1cd..468c519f 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.java" @@ -1,17 +1,13 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.商品マスタ; -import java.util.List; - -@Mapper public interface 商品マスタMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(String 商品コード); @@ -19,7 +15,7 @@ public interface 商品マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(商品マスタ record); @@ -27,7 +23,7 @@ public interface 商品マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(商品マスタ record); @@ -35,7 +31,7 @@ public interface 商品マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 商品マスタ selectByPrimaryKey(String 商品コード); @@ -43,7 +39,7 @@ public interface 商品マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(商品マスタ record); @@ -51,16 +47,7 @@ public interface 商品マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(商品マスタ record); - - List<商品マスタ> selectAll(); - - @Delete("DELETE FROM public.商品マスタ") - void deleteAll(); - - List<商品マスタ> selectByProductCategoryCode(String 商品分類コード); - - List<商品マスタ> selectAllBoms(List 商品区分リスト); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" new file mode 100644 index 00000000..4e1b6bc5 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277Mapper.xml" @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 商品コード, 商品正式名, 商品略称, 商品名カナ, 商品区分, 製品型番, 販売単価, 仕入単価, 売上原価, 税区分, 商品分類コード, 雑区分, 在庫管理対象区分, + 在庫引当区分, 仕入先コード, 仕入先枝番, 作成日時, 作成者名, 更新日時, 更新者名, version + + + + + delete from public.商品マスタ + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + + + insert into public.商品マスタ (商品コード, 商品正式名, 商品略称, + 商品名カナ, 商品区分, 製品型番, + 販売単価, 仕入単価, 売上原価, 税区分, + 商品分類コード, 雑区分, 在庫管理対象区分, + 在庫引当区分, 仕入先コード, 仕入先枝番, + 作成日時, 作成者名, 更新日時, + 更新者名, version) + values (#{商品コード,jdbcType=VARCHAR}, #{商品正式名,jdbcType=VARCHAR}, #{商品略称,jdbcType=VARCHAR}, + #{商品名カナ,jdbcType=VARCHAR}, #{商品区分,jdbcType=VARCHAR}, #{製品型番,jdbcType=VARCHAR}, + #{販売単価,jdbcType=INTEGER}, #{仕入単価,jdbcType=INTEGER}, #{売上原価,jdbcType=INTEGER}, #{税区分,jdbcType=INTEGER}, + #{商品分類コード,jdbcType=VARCHAR}, #{雑区分,jdbcType=INTEGER}, #{在庫管理対象区分,jdbcType=INTEGER}, + #{在庫引当区分,jdbcType=INTEGER}, #{仕入先コード,jdbcType=VARCHAR}, #{仕入先枝番,jdbcType=INTEGER}, + #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, + #{更新者名,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}) + + + + insert into public.商品マスタ + + + 商品コード, + + + 商品正式名, + + + 商品略称, + + + 商品名カナ, + + + 商品区分, + + + 製品型番, + + + 販売単価, + + + 仕入単価, + + + 売上原価, + + + 税区分, + + + 商品分類コード, + + + 雑区分, + + + 在庫管理対象区分, + + + 在庫引当区分, + + + 仕入先コード, + + + 仕入先枝番, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + version, + + + + + #{商品コード,jdbcType=VARCHAR}, + + + #{商品正式名,jdbcType=VARCHAR}, + + + #{商品略称,jdbcType=VARCHAR}, + + + #{商品名カナ,jdbcType=VARCHAR}, + + + #{商品区分,jdbcType=VARCHAR}, + + + #{製品型番,jdbcType=VARCHAR}, + + + #{販売単価,jdbcType=INTEGER}, + + + #{仕入単価,jdbcType=INTEGER}, + + + #{売上原価,jdbcType=INTEGER}, + + + #{税区分,jdbcType=INTEGER}, + + + #{商品分類コード,jdbcType=VARCHAR}, + + + #{雑区分,jdbcType=INTEGER}, + + + #{在庫管理対象区分,jdbcType=INTEGER}, + + + #{在庫引当区分,jdbcType=INTEGER}, + + + #{仕入先コード,jdbcType=VARCHAR}, + + + #{仕入先枝番,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + #{version,jdbcType=INTEGER}, + + + + + + update public.商品マスタ + + + 商品正式名 = #{商品正式名,jdbcType=VARCHAR}, + + + 商品略称 = #{商品略称,jdbcType=VARCHAR}, + + + 商品名カナ = #{商品名カナ,jdbcType=VARCHAR}, + + + 商品区分 = #{商品区分,jdbcType=VARCHAR}, + + + 製品型番 = #{製品型番,jdbcType=VARCHAR}, + + + 販売単価 = #{販売単価,jdbcType=INTEGER}, + + + 仕入単価 = #{仕入単価,jdbcType=INTEGER}, + + + 売上原価 = #{売上原価,jdbcType=INTEGER}, + + + 税区分 = #{税区分,jdbcType=INTEGER}, + + + 商品分類コード = #{商品分類コード,jdbcType=VARCHAR}, + + + 雑区分 = #{雑区分,jdbcType=INTEGER}, + + + 在庫管理対象区分 = #{在庫管理対象区分,jdbcType=INTEGER}, + + + 在庫引当区分 = #{在庫引当区分,jdbcType=INTEGER}, + + + 仕入先コード = #{仕入先コード,jdbcType=VARCHAR}, + + + 仕入先枝番 = #{仕入先枝番,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=INTEGER}, + + + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + + + update public.商品マスタ + set 商品正式名 = #{商品正式名,jdbcType=VARCHAR}, + 商品略称 = #{商品略称,jdbcType=VARCHAR}, + 商品名カナ = #{商品名カナ,jdbcType=VARCHAR}, + 商品区分 = #{商品区分,jdbcType=VARCHAR}, + 製品型番 = #{製品型番,jdbcType=VARCHAR}, + 販売単価 = #{販売単価,jdbcType=INTEGER}, + 仕入単価 = #{仕入単価,jdbcType=INTEGER}, + 売上原価 = #{売上原価,jdbcType=INTEGER}, + 税区分 = #{税区分,jdbcType=INTEGER}, + 商品分類コード = #{商品分類コード,jdbcType=VARCHAR}, + 雑区分 = #{雑区分,jdbcType=INTEGER}, + 在庫管理対象区分 = #{在庫管理対象区分,jdbcType=INTEGER}, + 在庫引当区分 = #{在庫引当区分,jdbcType=INTEGER}, + 仕入先コード = #{仕入先コード,jdbcType=VARCHAR}, + 仕入先枝番 = #{仕入先枝番,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER} + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" similarity index 68% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" index 558d7745..fe373ba5 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.java" @@ -1,17 +1,13 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.商品分類マスタ; -import java.util.List; - -@Mapper public interface 商品分類マスタMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(String 商品分類コード); @@ -19,7 +15,7 @@ public interface 商品分類マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(商品分類マスタ record); @@ -27,7 +23,7 @@ public interface 商品分類マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(商品分類マスタ record); @@ -35,7 +31,7 @@ public interface 商品分類マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 商品分類マスタ selectByPrimaryKey(String 商品分類コード); @@ -43,7 +39,7 @@ public interface 商品分類マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(商品分類マスタ record); @@ -51,12 +47,7 @@ public interface 商品分類マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.商品分類マスタ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(商品分類マスタ record); - - @Delete("DELETE FROM public.商品分類マスタ") - void deleteAll(); - - List<商品分類マスタ> selectAll(); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" new file mode 100644 index 00000000..66879745 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277Mapper.xml" @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + 商品分類コード, 商品分類名, 商品分類階層, 商品分類パス, 最下層区分, 作成日時, 作成者名, 更新日時, 更新者名 + + + + + delete from public.商品分類マスタ + where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} + + + + insert into public.商品分類マスタ (商品分類コード, 商品分類名, 商品分類階層, + 商品分類パス, 最下層区分, 作成日時, + 作成者名, 更新日時, 更新者名) + values (#{商品分類コード,jdbcType=VARCHAR}, #{商品分類名,jdbcType=VARCHAR}, #{商品分類階層,jdbcType=INTEGER}, + #{商品分類パス,jdbcType=VARCHAR}, #{最下層区分,jdbcType=INTEGER}, #{作成日時,jdbcType=TIMESTAMP}, + #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}) + + + + insert into public.商品分類マスタ + + + 商品分類コード, + + + 商品分類名, + + + 商品分類階層, + + + 商品分類パス, + + + 最下層区分, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + + + #{商品分類コード,jdbcType=VARCHAR}, + + + #{商品分類名,jdbcType=VARCHAR}, + + + #{商品分類階層,jdbcType=INTEGER}, + + + #{商品分類パス,jdbcType=VARCHAR}, + + + #{最下層区分,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + + + + update public.商品分類マスタ + + + 商品分類名 = #{商品分類名,jdbcType=VARCHAR}, + + + 商品分類階層 = #{商品分類階層,jdbcType=INTEGER}, + + + 商品分類パス = #{商品分類パス,jdbcType=VARCHAR}, + + + 最下層区分 = #{最下層区分,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} + + + + update public.商品分類マスタ + set 商品分類名 = #{商品分類名,jdbcType=VARCHAR}, + 商品分類階層 = #{商品分類階層,jdbcType=INTEGER}, + 商品分類パス = #{商品分類パス,jdbcType=VARCHAR}, + 最下層区分 = #{最下層区分,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR} + where 商品分類コード = #{商品分類コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" similarity index 65% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" index c978ef72..acb8161e 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.java" @@ -1,17 +1,13 @@ -package com.example.sms.infrastructure.datasource.master.employee; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; -import java.util.List; - -@Mapper public interface 社員マスタMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(String 社員コード); @@ -19,7 +15,7 @@ public interface 社員マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(社員マスタ record); @@ -27,7 +23,7 @@ public interface 社員マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(社員マスタ record); @@ -35,7 +31,7 @@ public interface 社員マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 社員マスタ selectByPrimaryKey(String 社員コード); @@ -43,7 +39,7 @@ public interface 社員マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(社員マスタ record); @@ -51,14 +47,7 @@ public interface 社員マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.社員マスタ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(社員マスタ record); - - List<社員マスタ> selectAll(); - - @Delete("DELETE FROM 社員マスタ") - void deleteAll(); - - List<社員マスタ> selectByDepartmentCode(String 部門コード); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" new file mode 100644 index 00000000..fff06b52 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277Mapper.xml" @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + 社員コード, 社員名, 社員名カナ, パスワード, 電話番号, fax番号, 部門コード, 開始日, 職種コード, 承認権限コード, 作成日時, 作成者名, 更新日時, + 更新者名, user_id + + + + + delete from public.社員マスタ + where 社員コード = #{社員コード,jdbcType=VARCHAR} + + + + insert into public.社員マスタ (社員コード, 社員名, 社員名カナ, + パスワード, 電話番号, fax番号, + 部門コード, 開始日, 職種コード, + 承認権限コード, 作成日時, 作成者名, + 更新日時, 更新者名, user_id + ) + values (#{社員コード,jdbcType=VARCHAR}, #{社員名,jdbcType=VARCHAR}, #{社員名カナ,jdbcType=VARCHAR}, + #{パスワード,jdbcType=VARCHAR}, #{電話番号,jdbcType=VARCHAR}, #{fax番号,jdbcType=VARCHAR}, + #{部門コード,jdbcType=VARCHAR}, #{開始日,jdbcType=TIMESTAMP}, #{職種コード,jdbcType=VARCHAR}, + #{承認権限コード,jdbcType=VARCHAR}, #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, + #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR} + ) + + + + insert into public.社員マスタ + + + 社員コード, + + + 社員名, + + + 社員名カナ, + + + パスワード, + + + 電話番号, + + + fax番号, + + + 部門コード, + + + 開始日, + + + 職種コード, + + + 承認権限コード, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + user_id, + + + + + #{社員コード,jdbcType=VARCHAR}, + + + #{社員名,jdbcType=VARCHAR}, + + + #{社員名カナ,jdbcType=VARCHAR}, + + + #{パスワード,jdbcType=VARCHAR}, + + + #{電話番号,jdbcType=VARCHAR}, + + + #{fax番号,jdbcType=VARCHAR}, + + + #{部門コード,jdbcType=VARCHAR}, + + + #{開始日,jdbcType=TIMESTAMP}, + + + #{職種コード,jdbcType=VARCHAR}, + + + #{承認権限コード,jdbcType=VARCHAR}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + #{userId,jdbcType=VARCHAR}, + + + + + + update public.社員マスタ + + + 社員名 = #{社員名,jdbcType=VARCHAR}, + + + 社員名カナ = #{社員名カナ,jdbcType=VARCHAR}, + + + パスワード = #{パスワード,jdbcType=VARCHAR}, + + + 電話番号 = #{電話番号,jdbcType=VARCHAR}, + + + fax番号 = #{fax番号,jdbcType=VARCHAR}, + + + 部門コード = #{部門コード,jdbcType=VARCHAR}, + + + 開始日 = #{開始日,jdbcType=TIMESTAMP}, + + + 職種コード = #{職種コード,jdbcType=VARCHAR}, + + + 承認権限コード = #{承認権限コード,jdbcType=VARCHAR}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + user_id = #{userId,jdbcType=VARCHAR}, + + + where 社員コード = #{社員コード,jdbcType=VARCHAR} + + + + update public.社員マスタ + set 社員名 = #{社員名,jdbcType=VARCHAR}, + 社員名カナ = #{社員名カナ,jdbcType=VARCHAR}, + パスワード = #{パスワード,jdbcType=VARCHAR}, + 電話番号 = #{電話番号,jdbcType=VARCHAR}, + fax番号 = #{fax番号,jdbcType=VARCHAR}, + 部門コード = #{部門コード,jdbcType=VARCHAR}, + 開始日 = #{開始日,jdbcType=TIMESTAMP}, + 職種コード = #{職種コード,jdbcType=VARCHAR}, + 承認権限コード = #{承認権限コード,jdbcType=VARCHAR}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + user_id = #{userId,jdbcType=VARCHAR} + where 社員コード = #{社員コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.java" similarity index 63% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.java" index 01a66ef5..bc065157 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.java" @@ -1,17 +1,14 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.部品表; +import com.example.sms.infrastructure.datasource.autogen.model.部品表Key; -import java.util.List; - -@Mapper public interface 部品表Mapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(部品表Key key); @@ -19,7 +16,7 @@ public interface 部品表Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(部品表 record); @@ -27,7 +24,7 @@ public interface 部品表Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(部品表 record); @@ -35,7 +32,7 @@ public interface 部品表Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 部品表 selectByPrimaryKey(部品表Key key); @@ -43,7 +40,7 @@ public interface 部品表Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(部品表 record); @@ -51,16 +48,7 @@ public interface 部品表Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部品表 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(部品表 record); - - @Delete("DELETE FROM public.部品表") - void deleteAll(); - - List<部品表> selectAll(); - - 部品表 selectByProductCode(String productCode); - - void deleteByProductCode(String value); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.xml" new file mode 100644 index 00000000..28832594 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\345\223\201\350\241\250Mapper.xml" @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + 商品コード, 部品コード, 部品数量, 作成日時, 作成者名, 更新日時, 更新者名 + + + + + delete from public.部品表 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 部品コード = #{部品コード,jdbcType=VARCHAR} + + + + insert into public.部品表 (商品コード, 部品コード, 部品数量, + 作成日時, 作成者名, 更新日時, + 更新者名) + values (#{商品コード,jdbcType=VARCHAR}, #{部品コード,jdbcType=VARCHAR}, #{部品数量,jdbcType=INTEGER}, + #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, + #{更新者名,jdbcType=VARCHAR}) + + + + insert into public.部品表 + + + 商品コード, + + + 部品コード, + + + 部品数量, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + + + #{商品コード,jdbcType=VARCHAR}, + + + #{部品コード,jdbcType=VARCHAR}, + + + #{部品数量,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + + + + update public.部品表 + + + 部品数量 = #{部品数量,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 部品コード = #{部品コード,jdbcType=VARCHAR} + + + + update public.部品表 + set 部品数量 = #{部品数量,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR} + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 部品コード = #{部品コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" similarity index 65% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" index d01756d5..2c205d25 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.java" @@ -1,17 +1,14 @@ -package com.example.sms.infrastructure.datasource.master.department; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタKey; -import java.util.List; - -@Mapper public interface 部門マスタMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(部門マスタKey key); @@ -19,7 +16,7 @@ public interface 部門マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(部門マスタ record); @@ -27,7 +24,7 @@ public interface 部門マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(部門マスタ record); @@ -35,7 +32,7 @@ public interface 部門マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 部門マスタ selectByPrimaryKey(部門マスタKey key); @@ -43,7 +40,7 @@ public interface 部門マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(部門マスタ record); @@ -51,14 +48,7 @@ public interface 部門マスタMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.部門マスタ * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(部門マスタ record); - - @Delete("DELETE FROM 部門マスタ") - void deleteAll(); - - List<部門マスタ> selectAll(); - - List<部門マスタ> selectByDepartmentCode(String departmentCode); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" new file mode 100644 index 00000000..0da1867e --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Mapper.xml" @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + 部門コード, 開始日, 終了日, 部門名, 組織階層, 部門パス, 最下層区分, 伝票入力可否, 作成日時, 作成者名, 更新日時, 更新者名 + + + + + delete from public.部門マスタ + where 部門コード = #{部門コード,jdbcType=VARCHAR} + and 開始日 = #{開始日,jdbcType=TIMESTAMP} + + + + insert into public.部門マスタ (部門コード, 開始日, 終了日, + 部門名, 組織階層, 部門パス, 最下層区分, + 伝票入力可否, 作成日時, 作成者名, + 更新日時, 更新者名) + values (#{部門コード,jdbcType=VARCHAR}, #{開始日,jdbcType=TIMESTAMP}, #{終了日,jdbcType=TIMESTAMP}, + #{部門名,jdbcType=VARCHAR}, #{組織階層,jdbcType=INTEGER}, #{部門パス,jdbcType=VARCHAR}, #{最下層区分,jdbcType=INTEGER}, + #{伝票入力可否,jdbcType=INTEGER}, #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, + #{更新日時,jdbcType=TIMESTAMP}, #{更新者名,jdbcType=VARCHAR}) + + + + insert into public.部門マスタ + + + 部門コード, + + + 開始日, + + + 終了日, + + + 部門名, + + + 組織階層, + + + 部門パス, + + + 最下層区分, + + + 伝票入力可否, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + + + #{部門コード,jdbcType=VARCHAR}, + + + #{開始日,jdbcType=TIMESTAMP}, + + + #{終了日,jdbcType=TIMESTAMP}, + + + #{部門名,jdbcType=VARCHAR}, + + + #{組織階層,jdbcType=INTEGER}, + + + #{部門パス,jdbcType=VARCHAR}, + + + #{最下層区分,jdbcType=INTEGER}, + + + #{伝票入力可否,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + + + + update public.部門マスタ + + + 終了日 = #{終了日,jdbcType=TIMESTAMP}, + + + 部門名 = #{部門名,jdbcType=VARCHAR}, + + + 組織階層 = #{組織階層,jdbcType=INTEGER}, + + + 部門パス = #{部門パス,jdbcType=VARCHAR}, + + + 最下層区分 = #{最下層区分,jdbcType=INTEGER}, + + + 伝票入力可否 = #{伝票入力可否,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + where 部門コード = #{部門コード,jdbcType=VARCHAR} + and 開始日 = #{開始日,jdbcType=TIMESTAMP} + + + + update public.部門マスタ + set 終了日 = #{終了日,jdbcType=TIMESTAMP}, + 部門名 = #{部門名,jdbcType=VARCHAR}, + 組織階層 = #{組織階層,jdbcType=INTEGER}, + 部門パス = #{部門パス,jdbcType=VARCHAR}, + 最下層区分 = #{最下層区分,jdbcType=INTEGER}, + 伝票入力可否 = #{伝票入力可否,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR} + where 部門コード = #{部門コード,jdbcType=VARCHAR} + and 開始日 = #{開始日,jdbcType=TIMESTAMP} + + \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" similarity index 65% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" index d4350325..e570b290 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.java" @@ -1,17 +1,14 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.mapper; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.顧客別販売単価; +import com.example.sms.infrastructure.datasource.autogen.model.顧客別販売単価Key; -import java.util.List; - -@Mapper public interface 顧客別販売単価Mapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int deleteByPrimaryKey(顧客別販売単価Key key); @@ -19,7 +16,7 @@ public interface 顧客別販売単価Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insert(顧客別販売単価 record); @@ -27,7 +24,7 @@ public interface 顧客別販売単価Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int insertSelective(顧客別販売単価 record); @@ -35,7 +32,7 @@ public interface 顧客別販売単価Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ 顧客別販売単価 selectByPrimaryKey(顧客別販売単価Key key); @@ -43,7 +40,7 @@ public interface 顧客別販売単価Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKeySelective(顧客別販売単価 record); @@ -51,16 +48,7 @@ public interface 顧客別販売単価Mapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table public.顧客別販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ int updateByPrimaryKey(顧客別販売単価 record); - - @Delete("DELETE FROM public.顧客別販売単価") - void deleteAll(); - - List<顧客別販売単価> selectAll(); - - List<顧客別販売単価> selectByProductCode(String productCode); - - void deleteByProductCode(String value); -} +} \ No newline at end of file diff --git "a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" new file mode 100644 index 00000000..3c204037 --- /dev/null +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/mapper/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Mapper.xml" @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + 商品コード, 取引先コード, 販売単価, 作成日時, 作成者名, 更新日時, 更新者名 + + + + + delete from public.顧客別販売単価 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 取引先コード = #{取引先コード,jdbcType=VARCHAR} + + + + insert into public.顧客別販売単価 (商品コード, 取引先コード, 販売単価, + 作成日時, 作成者名, 更新日時, + 更新者名) + values (#{商品コード,jdbcType=VARCHAR}, #{取引先コード,jdbcType=VARCHAR}, #{販売単価,jdbcType=INTEGER}, + #{作成日時,jdbcType=TIMESTAMP}, #{作成者名,jdbcType=VARCHAR}, #{更新日時,jdbcType=TIMESTAMP}, + #{更新者名,jdbcType=VARCHAR}) + + + + insert into public.顧客別販売単価 + + + 商品コード, + + + 取引先コード, + + + 販売単価, + + + 作成日時, + + + 作成者名, + + + 更新日時, + + + 更新者名, + + + + + #{商品コード,jdbcType=VARCHAR}, + + + #{取引先コード,jdbcType=VARCHAR}, + + + #{販売単価,jdbcType=INTEGER}, + + + #{作成日時,jdbcType=TIMESTAMP}, + + + #{作成者名,jdbcType=VARCHAR}, + + + #{更新日時,jdbcType=TIMESTAMP}, + + + #{更新者名,jdbcType=VARCHAR}, + + + + + + update public.顧客別販売単価 + + + 販売単価 = #{販売単価,jdbcType=INTEGER}, + + + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + + + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + + + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + + + 更新者名 = #{更新者名,jdbcType=VARCHAR}, + + + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 取引先コード = #{取引先コード,jdbcType=VARCHAR} + + + + update public.顧客別販売単価 + set 販売単価 = #{販売単価,jdbcType=INTEGER}, + 作成日時 = #{作成日時,jdbcType=TIMESTAMP}, + 作成者名 = #{作成者名,jdbcType=VARCHAR}, + 更新日時 = #{更新日時,jdbcType=TIMESTAMP}, + 更新者名 = #{更新者名,jdbcType=VARCHAR} + where 商品コード = #{商品コード,jdbcType=VARCHAR} + and 取引先コード = #{取引先コード,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/ApplicationExecutionHistory.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/ApplicationExecutionHistory.java new file mode 100644 index 00000000..3f7ee2d8 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/ApplicationExecutionHistory.java @@ -0,0 +1,335 @@ +package com.example.sms.infrastructure.datasource.autogen.model; + +import java.time.LocalDateTime; + +public class ApplicationExecutionHistory { + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private Integer id; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_name + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private String processName; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_code + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private String processCode; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_type + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private String processType; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_start + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private LocalDateTime processStart; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_end + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private LocalDateTime processEnd; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_flag + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private Integer processFlag; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.process_details + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private String processDetails; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private Integer version; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column system.application_execution_history.user_id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private String userId; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.id + * + * @return the value of system.application_execution_history.id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public Integer getId() { + return id; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.id + * + * @param id the value for system.application_execution_history.id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_name + * + * @return the value of system.application_execution_history.process_name + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public String getProcessName() { + return processName; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_name + * + * @param processName the value for system.application_execution_history.process_name + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessName(String processName) { + this.processName = processName == null ? null : processName.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_code + * + * @return the value of system.application_execution_history.process_code + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public String getProcessCode() { + return processCode; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_code + * + * @param processCode the value for system.application_execution_history.process_code + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessCode(String processCode) { + this.processCode = processCode == null ? null : processCode.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_type + * + * @return the value of system.application_execution_history.process_type + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public String getProcessType() { + return processType; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_type + * + * @param processType the value for system.application_execution_history.process_type + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessType(String processType) { + this.processType = processType == null ? null : processType.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_start + * + * @return the value of system.application_execution_history.process_start + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public LocalDateTime getProcessStart() { + return processStart; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_start + * + * @param processStart the value for system.application_execution_history.process_start + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessStart(LocalDateTime processStart) { + this.processStart = processStart; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_end + * + * @return the value of system.application_execution_history.process_end + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public LocalDateTime getProcessEnd() { + return processEnd; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_end + * + * @param processEnd the value for system.application_execution_history.process_end + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessEnd(LocalDateTime processEnd) { + this.processEnd = processEnd; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_flag + * + * @return the value of system.application_execution_history.process_flag + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public Integer getProcessFlag() { + return processFlag; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_flag + * + * @param processFlag the value for system.application_execution_history.process_flag + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessFlag(Integer processFlag) { + this.processFlag = processFlag; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.process_details + * + * @return the value of system.application_execution_history.process_details + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public String getProcessDetails() { + return processDetails; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.process_details + * + * @param processDetails the value for system.application_execution_history.process_details + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setProcessDetails(String processDetails) { + this.processDetails = processDetails == null ? null : processDetails.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.version + * + * @return the value of system.application_execution_history.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public Integer getVersion() { + return version; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.version + * + * @param version the value for system.application_execution_history.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setVersion(Integer version) { + this.version = version; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column system.application_execution_history.user_id + * + * @return the value of system.application_execution_history.user_id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public String getUserId() { + return userId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column system.application_execution_history.user_id + * + * @param userId the value for system.application_execution_history.user_id + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setUserId(String userId) { + this.userId = userId == null ? null : userId.trim(); + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/Usr.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/Usr.java similarity index 82% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/user/Usr.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/Usr.java index 042c38cf..209b397e 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/Usr.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/Usr.java @@ -1,4 +1,4 @@ -package com.example.sms.infrastructure.datasource.system.user; +package com.example.sms.infrastructure.datasource.autogen.model; public class Usr { /** @@ -6,7 +6,7 @@ public class Usr { * This field was generated by MyBatis Generator. * This field corresponds to the database column system.usr.user_id * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String userId; @@ -15,7 +15,7 @@ public class Usr { * This field was generated by MyBatis Generator. * This field corresponds to the database column system.usr.first_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String firstName; @@ -24,7 +24,7 @@ public class Usr { * This field was generated by MyBatis Generator. * This field corresponds to the database column system.usr.last_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String lastName; @@ -33,7 +33,7 @@ public class Usr { * This field was generated by MyBatis Generator. * This field corresponds to the database column system.usr.password * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String password; @@ -42,7 +42,7 @@ public class Usr { * This field was generated by MyBatis Generator. * This field corresponds to the database column system.usr.role_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String roleName; @@ -52,7 +52,7 @@ public class Usr { * * @return the value of system.usr.user_id * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getUserId() { return userId; @@ -64,7 +64,7 @@ public String getUserId() { * * @param userId the value for system.usr.user_id * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setUserId(String userId) { this.userId = userId == null ? null : userId.trim(); @@ -76,7 +76,7 @@ public void setUserId(String userId) { * * @return the value of system.usr.first_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getFirstName() { return firstName; @@ -88,7 +88,7 @@ public String getFirstName() { * * @param firstName the value for system.usr.first_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setFirstName(String firstName) { this.firstName = firstName == null ? null : firstName.trim(); @@ -100,7 +100,7 @@ public void setFirstName(String firstName) { * * @return the value of system.usr.last_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getLastName() { return lastName; @@ -112,7 +112,7 @@ public String getLastName() { * * @param lastName the value for system.usr.last_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setLastName(String lastName) { this.lastName = lastName == null ? null : lastName.trim(); @@ -124,7 +124,7 @@ public void setLastName(String lastName) { * * @return the value of system.usr.password * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getPassword() { return password; @@ -136,7 +136,7 @@ public String getPassword() { * * @param password the value for system.usr.password * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setPassword(String password) { this.password = password == null ? null : password.trim(); @@ -148,7 +148,7 @@ public void setPassword(String password) { * * @return the value of system.usr.role_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getRoleName() { return roleName; @@ -160,9 +160,9 @@ public String getRoleName() { * * @param roleName the value for system.usr.role_name * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setRoleName(String roleName) { this.roleName = roleName == null ? null : roleName.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201.java" similarity index 82% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201.java" index fbcbf925..6ec3a817 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201.java" @@ -1,45 +1,50 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; public class 代替商品 extends 代替商品Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.優先順位 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 優先順位; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.作成日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.作成者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.更新日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.更新者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; @@ -48,7 +53,8 @@ public class 代替商品 extends 代替商品Key { * This method returns the value of the database column public.代替商品.優先順位 * * @return the value of public.代替商品.優先順位 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get優先順位() { return 優先順位; @@ -59,7 +65,8 @@ public class 代替商品 extends 代替商品Key { * This method sets the value of the database column public.代替商品.優先順位 * * @param 優先順位 the value for public.代替商品.優先順位 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set優先順位(Integer 優先順位) { this.優先順位 = 優先順位; @@ -70,7 +77,8 @@ public class 代替商品 extends 代替商品Key { * This method returns the value of the database column public.代替商品.作成日時 * * @return the value of public.代替商品.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -81,7 +89,8 @@ public class 代替商品 extends 代替商品Key { * This method sets the value of the database column public.代替商品.作成日時 * * @param 作成日時 the value for public.代替商品.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -92,7 +101,8 @@ public class 代替商品 extends 代替商品Key { * This method returns the value of the database column public.代替商品.作成者名 * * @return the value of public.代替商品.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -103,7 +113,8 @@ public class 代替商品 extends 代替商品Key { * This method sets the value of the database column public.代替商品.作成者名 * * @param 作成者名 the value for public.代替商品.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -114,7 +125,8 @@ public class 代替商品 extends 代替商品Key { * This method returns the value of the database column public.代替商品.更新日時 * * @return the value of public.代替商品.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -125,7 +137,8 @@ public class 代替商品 extends 代替商品Key { * This method sets the value of the database column public.代替商品.更新日時 * * @param 更新日時 the value for public.代替商品.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -136,7 +149,8 @@ public class 代替商品 extends 代替商品Key { * This method returns the value of the database column public.代替商品.更新者名 * * @return the value of public.代替商品.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -147,9 +161,10 @@ public class 代替商品 extends 代替商品Key { * This method sets the value of the database column public.代替商品.更新者名 * * @param 更新者名 the value for public.代替商品.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" similarity index 82% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" index b05b5cc9..80b5ab18 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\344\273\243\346\233\277\345\225\206\345\223\201Key.java" @@ -1,19 +1,21 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; public class 代替商品Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.商品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.代替商品.代替商品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 代替商品コード; @@ -22,7 +24,8 @@ public class 代替商品Key { * This method returns the value of the database column public.代替商品.商品コード * * @return the value of public.代替商品.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品コード() { return 商品コード; @@ -33,7 +36,8 @@ public class 代替商品Key { * This method sets the value of the database column public.代替商品.商品コード * * @param 商品コード the value for public.代替商品.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品コード(String 商品コード) { this.商品コード = 商品コード == null ? null : 商品コード.trim(); @@ -44,7 +48,8 @@ public class 代替商品Key { * This method returns the value of the database column public.代替商品.代替商品コード * * @return the value of public.代替商品.代替商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get代替商品コード() { return 代替商品コード; @@ -55,9 +60,10 @@ public class 代替商品Key { * This method sets the value of the database column public.代替商品.代替商品コード * * @param 代替商品コード the value for public.代替商品.代替商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set代替商品コード(String 代替商品コード) { this.代替商品コード = 代替商品コード == null ? null : 代替商品コード.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" similarity index 80% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" index b8960f11..7d8cbe84 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\343\203\236\343\202\271\343\202\277.java" @@ -1,192 +1,204 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; -import java.util.List; public class 商品マスタ { - private List<代替商品> 代替商品; - - public List<代替商品> get代替商品() { - return 代替商品; - } - - private List<部品表> 部品表; - - public List<部品表> get部品表() { - return 部品表; - } - - private List<顧客別販売単価> 顧客別販売単価; - - public List<顧客別販売単価> get顧客別販売単価() { - return 顧客別販売単価; - } /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品正式名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品正式名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品略称 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品略称; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品名カナ * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品名カナ; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.製品型番 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 製品型番; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 販売単価; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.仕入単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 仕入単価; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.売上原価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 売上原価; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.税区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 税区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.商品分類コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品分類コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.雑区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 雑区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.在庫管理対象区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 在庫管理対象区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.在庫引当区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 在庫引当区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.仕入先コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 仕入先コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.仕入先枝番 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 仕入先枝番; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.作成日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.作成者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.更新日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品マスタ.更新者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column public.商品マスタ.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + private Integer version; + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column public.商品マスタ.商品コード * * @return the value of public.商品マスタ.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品コード() { return 商品コード; @@ -197,7 +209,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品コード * * @param 商品コード the value for public.商品マスタ.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品コード(String 商品コード) { this.商品コード = 商品コード == null ? null : 商品コード.trim(); @@ -208,7 +221,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.商品正式名 * * @return the value of public.商品マスタ.商品正式名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品正式名() { return 商品正式名; @@ -219,7 +233,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品正式名 * * @param 商品正式名 the value for public.商品マスタ.商品正式名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品正式名(String 商品正式名) { this.商品正式名 = 商品正式名 == null ? null : 商品正式名.trim(); @@ -230,7 +245,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.商品略称 * * @return the value of public.商品マスタ.商品略称 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品略称() { return 商品略称; @@ -241,7 +257,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品略称 * * @param 商品略称 the value for public.商品マスタ.商品略称 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品略称(String 商品略称) { this.商品略称 = 商品略称 == null ? null : 商品略称.trim(); @@ -252,7 +269,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.商品名カナ * * @return the value of public.商品マスタ.商品名カナ - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品名カナ() { return 商品名カナ; @@ -263,7 +281,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品名カナ * * @param 商品名カナ the value for public.商品マスタ.商品名カナ - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品名カナ(String 商品名カナ) { this.商品名カナ = 商品名カナ == null ? null : 商品名カナ.trim(); @@ -274,7 +293,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.商品区分 * * @return the value of public.商品マスタ.商品区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品区分() { return 商品区分; @@ -285,7 +305,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品区分 * * @param 商品区分 the value for public.商品マスタ.商品区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品区分(String 商品区分) { this.商品区分 = 商品区分 == null ? null : 商品区分.trim(); @@ -296,7 +317,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.製品型番 * * @return the value of public.商品マスタ.製品型番 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get製品型番() { return 製品型番; @@ -307,7 +329,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.製品型番 * * @param 製品型番 the value for public.商品マスタ.製品型番 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set製品型番(String 製品型番) { this.製品型番 = 製品型番 == null ? null : 製品型番.trim(); @@ -318,7 +341,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.販売単価 * * @return the value of public.商品マスタ.販売単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get販売単価() { return 販売単価; @@ -329,7 +353,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.販売単価 * * @param 販売単価 the value for public.商品マスタ.販売単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set販売単価(Integer 販売単価) { this.販売単価 = 販売単価; @@ -340,7 +365,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.仕入単価 * * @return the value of public.商品マスタ.仕入単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get仕入単価() { return 仕入単価; @@ -351,7 +377,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.仕入単価 * * @param 仕入単価 the value for public.商品マスタ.仕入単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set仕入単価(Integer 仕入単価) { this.仕入単価 = 仕入単価; @@ -362,7 +389,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.売上原価 * * @return the value of public.商品マスタ.売上原価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get売上原価() { return 売上原価; @@ -373,7 +401,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.売上原価 * * @param 売上原価 the value for public.商品マスタ.売上原価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set売上原価(Integer 売上原価) { this.売上原価 = 売上原価; @@ -384,7 +413,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.税区分 * * @return the value of public.商品マスタ.税区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get税区分() { return 税区分; @@ -395,7 +425,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.税区分 * * @param 税区分 the value for public.商品マスタ.税区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set税区分(Integer 税区分) { this.税区分 = 税区分; @@ -406,7 +437,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.商品分類コード * * @return the value of public.商品マスタ.商品分類コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品分類コード() { return 商品分類コード; @@ -417,7 +449,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.商品分類コード * * @param 商品分類コード the value for public.商品マスタ.商品分類コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品分類コード(String 商品分類コード) { this.商品分類コード = 商品分類コード == null ? null : 商品分類コード.trim(); @@ -428,7 +461,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.雑区分 * * @return the value of public.商品マスタ.雑区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get雑区分() { return 雑区分; @@ -439,7 +473,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.雑区分 * * @param 雑区分 the value for public.商品マスタ.雑区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set雑区分(Integer 雑区分) { this.雑区分 = 雑区分; @@ -450,7 +485,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.在庫管理対象区分 * * @return the value of public.商品マスタ.在庫管理対象区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get在庫管理対象区分() { return 在庫管理対象区分; @@ -461,7 +497,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.在庫管理対象区分 * * @param 在庫管理対象区分 the value for public.商品マスタ.在庫管理対象区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set在庫管理対象区分(Integer 在庫管理対象区分) { this.在庫管理対象区分 = 在庫管理対象区分; @@ -472,7 +509,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.在庫引当区分 * * @return the value of public.商品マスタ.在庫引当区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get在庫引当区分() { return 在庫引当区分; @@ -483,7 +521,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.在庫引当区分 * * @param 在庫引当区分 the value for public.商品マスタ.在庫引当区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set在庫引当区分(Integer 在庫引当区分) { this.在庫引当区分 = 在庫引当区分; @@ -494,7 +533,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.仕入先コード * * @return the value of public.商品マスタ.仕入先コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get仕入先コード() { return 仕入先コード; @@ -505,7 +545,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.仕入先コード * * @param 仕入先コード the value for public.商品マスタ.仕入先コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set仕入先コード(String 仕入先コード) { this.仕入先コード = 仕入先コード == null ? null : 仕入先コード.trim(); @@ -516,7 +557,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.仕入先枝番 * * @return the value of public.商品マスタ.仕入先枝番 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get仕入先枝番() { return 仕入先枝番; @@ -527,7 +569,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.仕入先枝番 * * @param 仕入先枝番 the value for public.商品マスタ.仕入先枝番 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set仕入先枝番(Integer 仕入先枝番) { this.仕入先枝番 = 仕入先枝番; @@ -538,7 +581,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.作成日時 * * @return the value of public.商品マスタ.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -549,7 +593,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.作成日時 * * @param 作成日時 the value for public.商品マスタ.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -560,7 +605,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.作成者名 * * @return the value of public.商品マスタ.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -571,7 +617,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.作成者名 * * @param 作成者名 the value for public.商品マスタ.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -582,7 +629,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.更新日時 * * @return the value of public.商品マスタ.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -593,7 +641,8 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.更新日時 * * @param 更新日時 the value for public.商品マスタ.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -604,7 +653,8 @@ public class 商品マスタ { * This method returns the value of the database column public.商品マスタ.更新者名 * * @return the value of public.商品マスタ.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -615,9 +665,34 @@ public class 商品マスタ { * This method sets the value of the database column public.商品マスタ.更新者名 * * @param 更新者名 the value for public.商品マスタ.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column public.商品マスタ.version + * + * @return the value of public.商品マスタ.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public Integer getVersion() { + return version; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column public.商品マスタ.version + * + * @param version the value for public.商品マスタ.version + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 + */ + public void setVersion(Integer version) { + this.version = version; + } +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" similarity index 84% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" index c8005ad9..c9aa8ddc 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\345\225\206\345\223\201\345\210\206\351\241\236\343\203\236\343\202\271\343\202\277.java" @@ -1,83 +1,86 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; -import java.util.List; public class 商品分類マスタ { - private List<商品マスタ> 商品マスタ; - - public List<商品マスタ> get商品マスタ() { - return 商品マスタ; - } /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.商品分類コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品分類コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.商品分類名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品分類名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.商品分類階層 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 商品分類階層; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.商品分類パス * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品分類パス; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.最下層区分 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 最下層区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.作成日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.作成者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.更新日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.商品分類マスタ.更新者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; @@ -86,7 +89,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.商品分類コード * * @return the value of public.商品分類マスタ.商品分類コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品分類コード() { return 商品分類コード; @@ -97,7 +101,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.商品分類コード * * @param 商品分類コード the value for public.商品分類マスタ.商品分類コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品分類コード(String 商品分類コード) { this.商品分類コード = 商品分類コード == null ? null : 商品分類コード.trim(); @@ -108,7 +113,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.商品分類名 * * @return the value of public.商品分類マスタ.商品分類名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品分類名() { return 商品分類名; @@ -119,7 +125,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.商品分類名 * * @param 商品分類名 the value for public.商品分類マスタ.商品分類名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品分類名(String 商品分類名) { this.商品分類名 = 商品分類名 == null ? null : 商品分類名.trim(); @@ -130,7 +137,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.商品分類階層 * * @return the value of public.商品分類マスタ.商品分類階層 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get商品分類階層() { return 商品分類階層; @@ -141,7 +149,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.商品分類階層 * * @param 商品分類階層 the value for public.商品分類マスタ.商品分類階層 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品分類階層(Integer 商品分類階層) { this.商品分類階層 = 商品分類階層; @@ -152,7 +161,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.商品分類パス * * @return the value of public.商品分類マスタ.商品分類パス - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品分類パス() { return 商品分類パス; @@ -163,7 +173,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.商品分類パス * * @param 商品分類パス the value for public.商品分類マスタ.商品分類パス - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品分類パス(String 商品分類パス) { this.商品分類パス = 商品分類パス == null ? null : 商品分類パス.trim(); @@ -174,7 +185,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.最下層区分 * * @return the value of public.商品分類マスタ.最下層区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get最下層区分() { return 最下層区分; @@ -185,7 +197,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.最下層区分 * * @param 最下層区分 the value for public.商品分類マスタ.最下層区分 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set最下層区分(Integer 最下層区分) { this.最下層区分 = 最下層区分; @@ -196,7 +209,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.作成日時 * * @return the value of public.商品分類マスタ.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -207,7 +221,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.作成日時 * * @param 作成日時 the value for public.商品分類マスタ.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -218,7 +233,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.作成者名 * * @return the value of public.商品分類マスタ.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -229,7 +245,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.作成者名 * * @param 作成者名 the value for public.商品分類マスタ.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -240,7 +257,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.更新日時 * * @return the value of public.商品分類マスタ.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -251,7 +269,8 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.更新日時 * * @param 更新日時 the value for public.商品分類マスタ.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -262,7 +281,8 @@ public class 商品分類マスタ { * This method returns the value of the database column public.商品分類マスタ.更新者名 * * @return the value of public.商品分類マスタ.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -273,9 +293,10 @@ public class 商品分類マスタ { * This method sets the value of the database column public.商品分類マスタ.更新者名 * * @param 更新者名 the value for public.商品分類マスタ.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" similarity index 81% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" index a892e5b1..fc05392b 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\347\244\276\345\223\241\343\203\236\343\202\271\343\202\277.java" @@ -1,37 +1,14 @@ -package com.example.sms.infrastructure.datasource.master.employee; - -import com.example.sms.infrastructure.datasource.master.department.部門マスタ; -import com.example.sms.infrastructure.datasource.system.user.Usr; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; public class 社員マスタ { - private 部門マスタ 部門; - - public 部門マスタ get部門() { - return 部門; - } - - public void set部門(部門マスタ 部門) { - this.部門 = 部門; - } - - private Usr user; - - public Usr getUser() { - return user; - } - - public void setUser(Usr user) { - this.user = user; - } - /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.社員コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 社員コード; @@ -40,7 +17,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.社員名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 社員名; @@ -49,7 +26,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.社員名カナ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 社員名カナ; @@ -58,7 +35,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.パスワード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String パスワード; @@ -67,16 +44,16 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.電話番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 電話番号; /** * * This field was generated by MyBatis Generator. - * This field corresponds to the database column public.社員マスタ.FAX番号 + * This field corresponds to the database column public.社員マスタ.fax番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String fax番号; @@ -85,7 +62,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.部門コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 部門コード; @@ -94,7 +71,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.開始日 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 開始日; @@ -103,7 +80,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.職種コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 職種コード; @@ -112,7 +89,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.承認権限コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 承認権限コード; @@ -121,7 +98,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.作成日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; @@ -130,7 +107,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.作成者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; @@ -139,7 +116,7 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.更新日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; @@ -148,15 +125,16 @@ public void setUser(Usr user) { * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.更新者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.社員マスタ.user_id * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String userId; @@ -166,7 +144,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.社員コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get社員コード() { return 社員コード; @@ -178,7 +156,7 @@ public void setUser(Usr user) { * * @param 社員コード the value for public.社員マスタ.社員コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set社員コード(String 社員コード) { this.社員コード = 社員コード == null ? null : 社員コード.trim(); @@ -190,7 +168,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.社員名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get社員名() { return 社員名; @@ -202,7 +180,7 @@ public void setUser(Usr user) { * * @param 社員名 the value for public.社員マスタ.社員名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set社員名(String 社員名) { this.社員名 = 社員名 == null ? null : 社員名.trim(); @@ -214,7 +192,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.社員名カナ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get社員名カナ() { return 社員名カナ; @@ -226,7 +204,7 @@ public void setUser(Usr user) { * * @param 社員名カナ the value for public.社員マスタ.社員名カナ * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set社員名カナ(String 社員名カナ) { this.社員名カナ = 社員名カナ == null ? null : 社員名カナ.trim(); @@ -238,7 +216,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.パスワード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getパスワード() { return パスワード; @@ -250,7 +228,7 @@ public void setUser(Usr user) { * * @param パスワード the value for public.社員マスタ.パスワード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setパスワード(String パスワード) { this.パスワード = パスワード == null ? null : パスワード.trim(); @@ -262,7 +240,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.電話番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get電話番号() { return 電話番号; @@ -274,7 +252,7 @@ public void setUser(Usr user) { * * @param 電話番号 the value for public.社員マスタ.電話番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set電話番号(String 電話番号) { this.電話番号 = 電話番号 == null ? null : 電話番号.trim(); @@ -282,11 +260,11 @@ public void setUser(Usr user) { /** * This method was generated by MyBatis Generator. - * This method returns the value of the database column public.社員マスタ.FAX番号 + * This method returns the value of the database column public.社員マスタ.fax番号 * - * @return the value of public.社員マスタ.FAX番号 + * @return the value of public.社員マスタ.fax番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getFax番号() { return fax番号; @@ -294,11 +272,11 @@ public void setUser(Usr user) { /** * This method was generated by MyBatis Generator. - * This method sets the value of the database column public.社員マスタ.FAX番号 + * This method sets the value of the database column public.社員マスタ.fax番号 * - * @param fax番号 the value for public.社員マスタ.FAX番号 + * @param fax番号 the value for public.社員マスタ.fax番号 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setFax番号(String fax番号) { this.fax番号 = fax番号 == null ? null : fax番号.trim(); @@ -310,7 +288,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.部門コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get部門コード() { return 部門コード; @@ -322,7 +300,7 @@ public void setUser(Usr user) { * * @param 部門コード the value for public.社員マスタ.部門コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部門コード(String 部門コード) { this.部門コード = 部門コード == null ? null : 部門コード.trim(); @@ -334,7 +312,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.開始日 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get開始日() { return 開始日; @@ -346,7 +324,7 @@ public void setUser(Usr user) { * * @param 開始日 the value for public.社員マスタ.開始日 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set開始日(LocalDateTime 開始日) { this.開始日 = 開始日; @@ -358,7 +336,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.職種コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get職種コード() { return 職種コード; @@ -370,7 +348,7 @@ public void setUser(Usr user) { * * @param 職種コード the value for public.社員マスタ.職種コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set職種コード(String 職種コード) { this.職種コード = 職種コード == null ? null : 職種コード.trim(); @@ -382,7 +360,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.承認権限コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get承認権限コード() { return 承認権限コード; @@ -394,7 +372,7 @@ public void setUser(Usr user) { * * @param 承認権限コード the value for public.社員マスタ.承認権限コード * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set承認権限コード(String 承認権限コード) { this.承認権限コード = 承認権限コード == null ? null : 承認権限コード.trim(); @@ -406,7 +384,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.作成日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -418,7 +396,7 @@ public void setUser(Usr user) { * * @param 作成日時 the value for public.社員マスタ.作成日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -430,7 +408,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.作成者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -442,7 +420,7 @@ public void setUser(Usr user) { * * @param 作成者名 the value for public.社員マスタ.作成者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -454,7 +432,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.更新日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -466,7 +444,7 @@ public void setUser(Usr user) { * * @param 更新日時 the value for public.社員マスタ.更新日時 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -478,7 +456,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.更新者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -490,7 +468,7 @@ public void setUser(Usr user) { * * @param 更新者名 the value for public.社員マスタ.更新者名 * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); @@ -502,7 +480,7 @@ public void setUser(Usr user) { * * @return the value of public.社員マスタ.user_id * - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String getUserId() { return userId; @@ -513,9 +491,10 @@ public String getUserId() { * This method sets the value of the database column public.社員マスタ.user_id * * @param userId the value for public.社員マスタ.user_id - * @mbg.generated Wed Oct 16 11:37:27 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void setUserId(String userId) { this.userId = userId == null ? null : userId.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250.java" similarity index 82% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250.java" index 941b68b3..e005c6f9 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250.java" @@ -1,45 +1,50 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; public class 部品表 extends 部品表Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.部品数量 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 部品数量; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.作成日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.作成者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.更新日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.更新者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; @@ -48,7 +53,8 @@ public class 部品表 extends 部品表Key { * This method returns the value of the database column public.部品表.部品数量 * * @return the value of public.部品表.部品数量 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get部品数量() { return 部品数量; @@ -59,7 +65,8 @@ public class 部品表 extends 部品表Key { * This method sets the value of the database column public.部品表.部品数量 * * @param 部品数量 the value for public.部品表.部品数量 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部品数量(Integer 部品数量) { this.部品数量 = 部品数量; @@ -70,7 +77,8 @@ public class 部品表 extends 部品表Key { * This method returns the value of the database column public.部品表.作成日時 * * @return the value of public.部品表.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -81,7 +89,8 @@ public class 部品表 extends 部品表Key { * This method sets the value of the database column public.部品表.作成日時 * * @param 作成日時 the value for public.部品表.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -92,7 +101,8 @@ public class 部品表 extends 部品表Key { * This method returns the value of the database column public.部品表.作成者名 * * @return the value of public.部品表.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -103,7 +113,8 @@ public class 部品表 extends 部品表Key { * This method sets the value of the database column public.部品表.作成者名 * * @param 作成者名 the value for public.部品表.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -114,7 +125,8 @@ public class 部品表 extends 部品表Key { * This method returns the value of the database column public.部品表.更新日時 * * @return the value of public.部品表.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -125,7 +137,8 @@ public class 部品表 extends 部品表Key { * This method sets the value of the database column public.部品表.更新日時 * * @param 更新日時 the value for public.部品表.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -136,7 +149,8 @@ public class 部品表 extends 部品表Key { * This method returns the value of the database column public.部品表.更新者名 * * @return the value of public.部品表.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -147,9 +161,10 @@ public class 部品表 extends 部品表Key { * This method sets the value of the database column public.部品表.更新者名 * * @param 更新者名 the value for public.部品表.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Key.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250Key.java" similarity index 81% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Key.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250Key.java" index 70402bc5..98fba041 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\203\250\345\223\201\350\241\250Key.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\345\223\201\350\241\250Key.java" @@ -1,19 +1,21 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; public class 部品表Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.商品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部品表.部品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 部品コード; @@ -22,7 +24,8 @@ public class 部品表Key { * This method returns the value of the database column public.部品表.商品コード * * @return the value of public.部品表.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品コード() { return 商品コード; @@ -33,7 +36,8 @@ public class 部品表Key { * This method sets the value of the database column public.部品表.商品コード * * @param 商品コード the value for public.部品表.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品コード(String 商品コード) { this.商品コード = 商品コード == null ? null : 商品コード.trim(); @@ -44,7 +48,8 @@ public class 部品表Key { * This method returns the value of the database column public.部品表.部品コード * * @return the value of public.部品表.部品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get部品コード() { return 部品コード; @@ -55,9 +60,10 @@ public class 部品表Key { * This method sets the value of the database column public.部品表.部品コード * * @param 部品コード the value for public.部品表.部品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部品コード(String 部品コード) { this.部品コード = 部品コード == null ? null : 部品コード.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" similarity index 82% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" index 6a60b495..e03e70ad 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277.java" @@ -1,98 +1,95 @@ -package com.example.sms.infrastructure.datasource.master.department; - -import com.example.sms.infrastructure.datasource.master.employee.社員マスタ; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; -import java.util.List; public class 部門マスタ extends 部門マスタKey { - private List<社員マスタ> 社員; - - public List<社員マスタ> get社員() { - return 社員; - } - - public void set社員(List<社員マスタ> 社員) { - this.社員 = 社員; - } - /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.終了日 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 終了日; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.部門名 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 部門名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.組織階層 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 組織階層; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.部門パス * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 部門パス; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.最下層区分 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 最下層区分; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.伝票入力可否 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 伝票入力可否; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.作成日時 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.作成者名 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.更新日時 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.更新者名 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; @@ -101,7 +98,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.終了日 * * @return the value of public.部門マスタ.終了日 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get終了日() { return 終了日; @@ -112,7 +110,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.終了日 * * @param 終了日 the value for public.部門マスタ.終了日 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set終了日(LocalDateTime 終了日) { this.終了日 = 終了日; @@ -123,7 +122,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.部門名 * * @return the value of public.部門マスタ.部門名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get部門名() { return 部門名; @@ -134,7 +134,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.部門名 * * @param 部門名 the value for public.部門マスタ.部門名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部門名(String 部門名) { this.部門名 = 部門名 == null ? null : 部門名.trim(); @@ -145,7 +146,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.組織階層 * * @return the value of public.部門マスタ.組織階層 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get組織階層() { return 組織階層; @@ -156,7 +158,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.組織階層 * * @param 組織階層 the value for public.部門マスタ.組織階層 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set組織階層(Integer 組織階層) { this.組織階層 = 組織階層; @@ -167,7 +170,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.部門パス * * @return the value of public.部門マスタ.部門パス - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get部門パス() { return 部門パス; @@ -178,7 +182,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.部門パス * * @param 部門パス the value for public.部門マスタ.部門パス - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部門パス(String 部門パス) { this.部門パス = 部門パス == null ? null : 部門パス.trim(); @@ -189,7 +194,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.最下層区分 * * @return the value of public.部門マスタ.最下層区分 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get最下層区分() { return 最下層区分; @@ -200,7 +206,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.最下層区分 * * @param 最下層区分 the value for public.部門マスタ.最下層区分 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set最下層区分(Integer 最下層区分) { this.最下層区分 = 最下層区分; @@ -211,7 +218,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.伝票入力可否 * * @return the value of public.部門マスタ.伝票入力可否 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get伝票入力可否() { return 伝票入力可否; @@ -222,7 +230,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.伝票入力可否 * * @param 伝票入力可否 the value for public.部門マスタ.伝票入力可否 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set伝票入力可否(Integer 伝票入力可否) { this.伝票入力可否 = 伝票入力可否; @@ -233,7 +242,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.作成日時 * * @return the value of public.部門マスタ.作成日時 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -244,7 +254,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.作成日時 * * @param 作成日時 the value for public.部門マスタ.作成日時 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -255,7 +266,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.作成者名 * * @return the value of public.部門マスタ.作成者名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -266,7 +278,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.作成者名 * * @param 作成者名 the value for public.部門マスタ.作成者名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -277,7 +290,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.更新日時 * * @return the value of public.部門マスタ.更新日時 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -288,7 +302,8 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.更新日時 * * @param 更新日時 the value for public.部門マスタ.更新日時 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -299,7 +314,8 @@ public class 部門マスタ extends 部門マスタKey { * This method returns the value of the database column public.部門マスタ.更新者名 * * @return the value of public.部門マスタ.更新者名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -310,9 +326,10 @@ public class 部門マスタ extends 部門マスタKey { * This method sets the value of the database column public.部門マスタ.更新者名 * * @param 更新者名 the value for public.部門マスタ.更新者名 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" similarity index 81% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" index f2385e7f..4eea46ee 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\203\250\351\226\200\343\203\236\343\202\271\343\202\277Key.java" @@ -1,21 +1,23 @@ -package com.example.sms.infrastructure.datasource.master.department; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; public class 部門マスタKey { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.部門コード * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 部門コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.部門マスタ.開始日 * - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 開始日; @@ -24,7 +26,8 @@ public class 部門マスタKey { * This method returns the value of the database column public.部門マスタ.部門コード * * @return the value of public.部門マスタ.部門コード - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get部門コード() { return 部門コード; @@ -35,7 +38,8 @@ public class 部門マスタKey { * This method sets the value of the database column public.部門マスタ.部門コード * * @param 部門コード the value for public.部門マスタ.部門コード - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set部門コード(String 部門コード) { this.部門コード = 部門コード == null ? null : 部門コード.trim(); @@ -46,7 +50,8 @@ public class 部門マスタKey { * This method returns the value of the database column public.部門マスタ.開始日 * * @return the value of public.部門マスタ.開始日 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get開始日() { return 開始日; @@ -57,9 +62,10 @@ public class 部門マスタKey { * This method sets the value of the database column public.部門マスタ.開始日 * * @param 開始日 the value for public.部門マスタ.開始日 - * @mbg.generated Fri Oct 04 15:48:01 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set開始日(LocalDateTime 開始日) { this.開始日 = 開始日; } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" similarity index 83% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" index 9b8be8fc..94ed096d 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241.java" @@ -1,45 +1,50 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; import java.time.LocalDateTime; public class 顧客別販売単価 extends 顧客別販売単価Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.販売単価 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private Integer 販売単価; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.作成日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 作成日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.作成者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 作成者名; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.更新日時 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private LocalDateTime 更新日時; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.更新者名 * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 更新者名; @@ -48,7 +53,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.販売単価 * * @return the value of public.顧客別販売単価.販売単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public Integer get販売単価() { return 販売単価; @@ -59,7 +65,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.販売単価 * * @param 販売単価 the value for public.顧客別販売単価.販売単価 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set販売単価(Integer 販売単価) { this.販売単価 = 販売単価; @@ -70,7 +77,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.作成日時 * * @return the value of public.顧客別販売単価.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get作成日時() { return 作成日時; @@ -81,7 +89,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.作成日時 * * @param 作成日時 the value for public.顧客別販売単価.作成日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成日時(LocalDateTime 作成日時) { this.作成日時 = 作成日時; @@ -92,7 +101,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.作成者名 * * @return the value of public.顧客別販売単価.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get作成者名() { return 作成者名; @@ -103,7 +113,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.作成者名 * * @param 作成者名 the value for public.顧客別販売単価.作成者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set作成者名(String 作成者名) { this.作成者名 = 作成者名 == null ? null : 作成者名.trim(); @@ -114,7 +125,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.更新日時 * * @return the value of public.顧客別販売単価.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public LocalDateTime get更新日時() { return 更新日時; @@ -125,7 +137,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.更新日時 * * @param 更新日時 the value for public.顧客別販売単価.更新日時 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新日時(LocalDateTime 更新日時) { this.更新日時 = 更新日時; @@ -136,7 +149,8 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.更新者名 * * @return the value of public.顧客別販売単価.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get更新者名() { return 更新者名; @@ -147,9 +161,10 @@ public class 顧客別販売単価 extends 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.更新者名 * * @param 更新者名 the value for public.顧客別販売単価.更新者名 - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set更新者名(String 更新者名) { this.更新者名 = 更新者名 == null ? null : 更新者名.trim(); } -} +} \ No newline at end of file diff --git "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" similarity index 83% rename from "api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" rename to "app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" index 121a62f2..42539d0b 100644 --- "a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" +++ "b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/autogen/model/\351\241\247\345\256\242\345\210\245\350\262\251\345\243\262\345\215\230\344\276\241Key.java" @@ -1,19 +1,21 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.autogen.model; public class 顧客別販売単価Key { /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.商品コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 商品コード; /** + * * This field was generated by MyBatis Generator. * This field corresponds to the database column public.顧客別販売単価.取引先コード * - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ private String 取引先コード; @@ -22,7 +24,8 @@ public class 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.商品コード * * @return the value of public.顧客別販売単価.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get商品コード() { return 商品コード; @@ -33,7 +36,8 @@ public class 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.商品コード * * @param 商品コード the value for public.顧客別販売単価.商品コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set商品コード(String 商品コード) { this.商品コード = 商品コード == null ? null : 商品コード.trim(); @@ -44,7 +48,8 @@ public class 顧客別販売単価Key { * This method returns the value of the database column public.顧客別販売単価.取引先コード * * @return the value of public.顧客別販売単価.取引先コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public String get取引先コード() { return 取引先コード; @@ -55,9 +60,10 @@ public class 顧客別販売単価Key { * This method sets the value of the database column public.顧客別販売単価.取引先コード * * @param 取引先コード the value for public.顧客別販売単価.取引先コード - * @mbg.generated Sat Oct 19 18:42:50 JST 2024 + * + * @mbg.generated Fri Dec 27 09:59:07 JST 2024 */ public void set取引先コード(String 取引先コード) { this.取引先コード = 取引先コード == null ? null : 取引先コード.trim(); } -} +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomEntity.java new file mode 100644 index 00000000..81a68c2a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomEntity.java @@ -0,0 +1,14 @@ +package com.example.sms.infrastructure.datasource.master.department; + +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class DepartmentCustomEntity extends 部門マスタ { + private List<社員マスタ> 社員; +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.java new file mode 100644 index 00000000..828bd2ea --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.java @@ -0,0 +1,23 @@ +package com.example.sms.infrastructure.datasource.master.department; + +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタKey; +import com.example.sms.service.master.department.DepartmentCriteria; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface DepartmentCustomMapper { + DepartmentCustomEntity selectByPrimaryKey(部門マスタKey key); + + @Delete("DELETE FROM 部門マスタ") + void deleteAll(); + + List selectAll(); + + List selectByDepartmentCode(String departmentCode); + + List selectByCriteria(DepartmentCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.xml new file mode 100644 index 00000000..04200f61 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentCustomMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java similarity index 71% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java index bd0a59b8..5a5d914e 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentDataSource.java @@ -4,6 +4,10 @@ import com.example.sms.domain.model.master.department.DepartmentId; import com.example.sms.domain.model.master.department.DepartmentList; import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.autogen.mapper.部門マスタMapper; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタKey; +import com.example.sms.service.master.department.DepartmentCriteria; import com.example.sms.service.master.department.DepartmentRepository; import com.github.pagehelper.PageInfo; import org.springframework.security.core.Authentication; @@ -17,10 +21,12 @@ @Repository public class DepartmentDataSource implements DepartmentRepository { final 部門マスタMapper departmentMapper; + final DepartmentCustomMapper departmentCustomMapper; final DepartmentEntityMapper departmentEntityMapper; - public DepartmentDataSource(部門マスタMapper departmentMapper, DepartmentEntityMapper departmentEntityMapper) { + public DepartmentDataSource(部門マスタMapper departmentMapper, DepartmentCustomMapper departmentCustomMapper, DepartmentEntityMapper departmentEntityMapper) { this.departmentMapper = departmentMapper; + this.departmentCustomMapper = departmentCustomMapper; this.departmentEntityMapper = departmentEntityMapper; } @@ -29,7 +35,7 @@ public Optional findById(DepartmentId departmentId) { 部門マスタKey departmentKey = new 部門マスタKey(); departmentKey.set部門コード(departmentId.getDeptCode().getValue()); departmentKey.set開始日(departmentId.getDepartmentStartDate().getValue()); - 部門マスタ departmentEntity = departmentMapper.selectByPrimaryKey(departmentKey); + DepartmentCustomEntity departmentEntity = departmentCustomMapper.selectByPrimaryKey(departmentKey); if (departmentEntity != null) { return Optional.of(departmentEntityMapper.mapToDomainModel(departmentEntity)); } @@ -38,7 +44,7 @@ public Optional findById(DepartmentId departmentId) { @Override public DepartmentList findByCode(String departmentCode) { - List<部門マスタ> departmentEntities = departmentMapper.selectByDepartmentCode(departmentCode); + List departmentEntities = departmentCustomMapper.selectByDepartmentCode(departmentCode); return new DepartmentList(departmentEntities.stream() .map(departmentEntityMapper::mapToDomainModel) .toList()); @@ -46,7 +52,7 @@ public DepartmentList findByCode(String departmentCode) { @Override public DepartmentList selectAll() { - List<部門マスタ> departmentEntities = departmentMapper.selectAll(); + List departmentEntities = departmentCustomMapper.selectAll(); return new DepartmentList(departmentEntities.stream() .map(departmentEntityMapper::mapToDomainModel) .toList()); @@ -54,8 +60,8 @@ public DepartmentList selectAll() { @Override public PageInfo selectAllWithPageInfo() { - List<部門マスタ> departmentEntities = departmentMapper.selectAll(); - PageInfo<部門マスタ> pageInfo = new PageInfo<>(departmentEntities); + List departmentEntities = departmentCustomMapper.selectAll(); + PageInfo pageInfo = new PageInfo<>(departmentEntities); return PageInfoHelper.of(pageInfo, departmentEntityMapper::mapToDomainModel); } @@ -68,7 +74,7 @@ public void save(Department department) { 部門マスタKey departmentKey = new 部門マスタKey(); departmentKey.set部門コード(department.getDepartmentId().getDeptCode().getValue()); departmentKey.set開始日(department.getDepartmentId().getDepartmentStartDate().getValue()); - Optional<部門マスタ> departmentEntity = Optional.ofNullable(departmentMapper.selectByPrimaryKey(departmentKey)); + Optional departmentEntity = Optional.ofNullable(departmentCustomMapper.selectByPrimaryKey(departmentKey)); if (departmentEntity.isEmpty()) { 部門マスタ newDepartmentEntity = departmentEntityMapper.mapToEntity(department); @@ -97,6 +103,13 @@ public void deleteById(DepartmentId departmentId) { @Override public void deleteAll() { - departmentMapper.deleteAll(); + departmentCustomMapper.deleteAll(); + } + + @Override + public PageInfo searchWithPageInfo(DepartmentCriteria criteria) { + List departmentEntities = departmentCustomMapper.selectByCriteria(criteria); + PageInfo pageInfo = new PageInfo<>(departmentEntities); + return PageInfoHelper.of(pageInfo, departmentEntityMapper::mapToDomainModel); } } diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java similarity index 65% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java index 418460cd..e6b8a8d8 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/DepartmentEntityMapper.java @@ -7,11 +7,13 @@ import com.example.sms.domain.model.master.employee.Employee; import com.example.sms.domain.type.department.DepartmentLowerType; import com.example.sms.domain.type.department.SlitYnType; -import com.example.sms.infrastructure.datasource.master.employee.社員マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import com.example.sms.infrastructure.datasource.system.download.DepartmentDownloadCSV; import org.springframework.stereotype.Component; import java.util.List; -import java.util.stream.Collectors; +import java.util.function.Function; @Component public class DepartmentEntityMapper { @@ -28,10 +30,19 @@ public class DepartmentEntityMapper { return departmentEntity; } - public Department mapToDomainModel(部門マスタ departmentEntity) { + public Department mapToDomainModel(DepartmentCustomEntity departmentEntity) { + Function<社員マスタ, Employee> mapToEmployee = e -> Employee.of( + e.get社員コード(), + e.get社員名(), + e.get社員名カナ(), + e.get電話番号(), + e.getFax番号(), + e.get職種コード() + ); + List employees = departmentEntity.get社員().stream() - .map(this::mapToEmployee) - .collect(Collectors.toList()); + .map(mapToEmployee) + .toList(); return new Department( DepartmentId.of(departmentEntity.get部門コード(), departmentEntity.get開始日()), @@ -55,4 +66,17 @@ private Employee mapToEmployee(社員マスタ employeeEntity) { employeeEntity.get職種コード() ); } + + public DepartmentDownloadCSV mapToCsvModel(Department department) { + return new DepartmentDownloadCSV( + department.getDepartmentId().getDeptCode().getValue(), + department.getDepartmentId().getDepartmentStartDate().getValue(), + department.getEndDate().getValue(), + department.getDepartmentName(), + department.getPath().getValue(), + department.getLowerType().getValue(), + department.getSlitYn().getValue(), + department.getLayer() + ); + } } diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/department/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/department/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomEntity.java new file mode 100644 index 00000000..5ba3e624 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomEntity.java @@ -0,0 +1,15 @@ +package com.example.sms.infrastructure.datasource.master.employee; + +import com.example.sms.infrastructure.datasource.autogen.model.Usr; +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class EmployeeCustomEntity extends 社員マスタ { + private 部門マスタ 部門; + + private Usr user; +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.java new file mode 100644 index 00000000..d89b0aec --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.java @@ -0,0 +1,21 @@ +package com.example.sms.infrastructure.datasource.master.employee; + +import com.example.sms.service.master.employee.EmployeeCriteria; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EmployeeCustomMapper { + EmployeeCustomEntity selectByPrimaryKey(String empCode); + + List selectAll(); + + @Delete("DELETE FROM 社員マスタ") + void deleteAll(); + + List selectByDepartmentCode(String departmentCode); + + List selectByCriteria(EmployeeCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.xml new file mode 100644 index 00000000..07252d01 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeCustomMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java similarity index 72% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java index ced96914..40ddbc87 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeDataSource.java @@ -4,6 +4,9 @@ import com.example.sms.domain.model.master.employee.EmployeeCode; import com.example.sms.domain.model.master.employee.EmployeeList; import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.autogen.mapper.社員マスタMapper; +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; +import com.example.sms.service.master.employee.EmployeeCriteria; import com.example.sms.service.master.employee.EmployeeRepository; import com.github.pagehelper.PageInfo; import org.springframework.security.core.Authentication; @@ -17,16 +20,18 @@ @Repository public class EmployeeDataSource implements EmployeeRepository { final 社員マスタMapper employeeMapper; + final EmployeeCustomMapper employeeCustomMapper; final EmployeeEntityMapper employeeEntityMapper; - public EmployeeDataSource(社員マスタMapper employeeMapper, EmployeeEntityMapper employeeEntityMapper) { + public EmployeeDataSource(社員マスタMapper employeeMapper, EmployeeCustomMapper employeeCustomMapper, EmployeeEntityMapper employeeEntityMapper) { this.employeeMapper = employeeMapper; + this.employeeCustomMapper = employeeCustomMapper; this.employeeEntityMapper = employeeEntityMapper; } @Override public Optional findById(EmployeeCode empCode) { - 社員マスタ employeeEntity = employeeMapper.selectByPrimaryKey(empCode.getValue()); + EmployeeCustomEntity employeeEntity = employeeCustomMapper.selectByPrimaryKey(empCode.getValue()); if (employeeEntity != null) { return Optional.of(employeeEntityMapper.mapToDomainModel(employeeEntity)); } @@ -35,7 +40,7 @@ public Optional findById(EmployeeCode empCode) { @Override public EmployeeList selectAll() { - List<社員マスタ> employeeEntities = employeeMapper.selectAll(); + List employeeEntities = employeeCustomMapper.selectAll(); return new EmployeeList(employeeEntities.stream() .map(employeeEntityMapper::mapToDomainModel) .toList()); @@ -43,8 +48,8 @@ public EmployeeList selectAll() { @Override public PageInfo selectAllWithPageInfo() { - List<社員マスタ> employeeEntities = employeeMapper.selectAll(); - PageInfo<社員マスタ> pageInfo = new PageInfo<>(employeeEntities); + List employeeEntities = employeeCustomMapper.selectAll(); + PageInfo pageInfo = new PageInfo<>(employeeEntities); return PageInfoHelper.of(pageInfo, employeeEntityMapper::mapToDomainModel); } @@ -81,6 +86,14 @@ public void deleteById(EmployeeCode empCode) { @Override public void deleteAll() { - employeeMapper.deleteAll(); + employeeCustomMapper.deleteAll(); + } + + @Override + public PageInfo searchWithPageInfo(EmployeeCriteria criteria) { + List employeeEntities = employeeCustomMapper.selectByCriteria(criteria); + PageInfo pageInfo = new PageInfo<>(employeeEntities); + + return PageInfoHelper.of(pageInfo, employeeEntityMapper::mapToDomainModel); } } diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java similarity index 63% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java index bc2606db..c72fb0ff 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/EmployeeEntityMapper.java @@ -2,13 +2,20 @@ import com.example.sms.domain.model.master.department.Department; import com.example.sms.domain.model.master.department.DepartmentId; +import com.example.sms.domain.model.master.department.DepartmentCode; +import com.example.sms.domain.model.master.department.DepartmentStartDate; import com.example.sms.domain.model.master.employee.Employee; import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.model.system.user.UserId; import com.example.sms.domain.type.user.RoleName; -import com.example.sms.infrastructure.datasource.master.department.部門マスタ; -import com.example.sms.infrastructure.datasource.system.user.Usr; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; +import com.example.sms.infrastructure.datasource.autogen.model.社員マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部門マスタ; +import com.example.sms.infrastructure.datasource.system.download.EmployeeDownloadCSV; import org.springframework.stereotype.Component; +import java.util.Optional; + @Component public class EmployeeEntityMapper { public 社員マスタ mapToEntity(Employee employee) { @@ -37,7 +44,7 @@ public class EmployeeEntityMapper { return employeeEntity; } - public Employee mapToDomainModel(社員マスタ employeeEntity) { + public Employee mapToDomainModel(EmployeeCustomEntity employeeEntity) { Department department = mapToDepartment(employeeEntity.get部門()); User user = mapToUser(employeeEntity.getUser()); @@ -80,4 +87,34 @@ private User mapToUser(Usr userEntity) { RoleName.valueOf(userEntity.getRoleName()) ); } -} + + public EmployeeDownloadCSV mapToCsvModel(Employee employee) { + return new EmployeeDownloadCSV( + employee.getEmpCode().getValue(), + employee.getEmpName().Name(), + employee.getEmpName().NameKana(), + employee.getLoginPassword(), + employee.getTel().getValue(), + employee.getFax().getValue(), + employee.getOccuCode().getValue(), + employee.getApprovalCode(), + Optional.ofNullable(employee) + .map(Employee::getDepartment) + .map(Department::getDepartmentId) + .map(DepartmentId::getDeptCode) + .map(DepartmentCode::getValue) + .orElse(null), + Optional.ofNullable(employee) + .map(Employee::getDepartment) + .map(Department::getDepartmentId) + .map(DepartmentId::getDepartmentStartDate) + .map(DepartmentStartDate::getValue) + .orElse(null), + Optional.ofNullable(employee) + .map(Employee::getUser) + .map(User::getUserId) + .map(UserId::getValue) + .orElse(null) + ); + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/employee/package-info.java diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomEntity.java new file mode 100644 index 00000000..c5ee1076 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomEntity.java @@ -0,0 +1,20 @@ +package com.example.sms.infrastructure.datasource.master.product; + +import com.example.sms.infrastructure.datasource.autogen.model.顧客別販売単価; +import com.example.sms.infrastructure.datasource.autogen.model.部品表; +import com.example.sms.infrastructure.datasource.autogen.model.代替商品; +import com.example.sms.infrastructure.datasource.autogen.model.商品マスタ; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class ProductCustomEntity extends 商品マスタ { + private List<代替商品> 代替商品; + + private List<部品表> 部品表; + + private List<顧客別販売単価> 顧客別販売単価; +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.java new file mode 100644 index 00000000..a74fc59a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.java @@ -0,0 +1,23 @@ +package com.example.sms.infrastructure.datasource.master.product; + +import com.example.sms.service.master.product.ProductCriteria; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface ProductCustomMapper { + ProductCustomEntity selectByPrimaryKey(String productCode); + + List selectAll(); + + @Delete("DELETE FROM public.商品マスタ") + void deleteAll(); + + List selectByProductCategoryCode(String productCategoryCode); + + List selectAllBoms(List boms); + + List selectByCriteria(ProductCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.xml new file mode 100644 index 00000000..ec2bd292 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCustomMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java new file mode 100644 index 00000000..e491b61a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductDataSource.java @@ -0,0 +1,256 @@ +package com.example.sms.infrastructure.datasource.master.product; + +import com.example.sms.domain.model.master.product.Product; +import com.example.sms.domain.model.master.product.ProductList; +import com.example.sms.domain.type.product.ProductType; +import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.ObjectOptimisticLockingFailureException; +import com.example.sms.infrastructure.datasource.autogen.mapper.代替商品Mapper; +import com.example.sms.infrastructure.datasource.autogen.mapper.商品マスタMapper; +import com.example.sms.infrastructure.datasource.autogen.mapper.部品表Mapper; +import com.example.sms.infrastructure.datasource.autogen.mapper.顧客別販売単価Mapper; +import com.example.sms.infrastructure.datasource.autogen.model.*; +import com.example.sms.infrastructure.datasource.master.product.bom.BomCustomMapper; +import com.example.sms.infrastructure.datasource.master.product.customer_specific_price.CustomerSpecificSellingPriceCustomMapper; +import com.example.sms.infrastructure.datasource.master.product.substitute.SubstituteProductCustomMapper; +import com.example.sms.service.master.product.ProductCriteria; +import com.example.sms.service.master.product.ProductRepository; +import com.github.pagehelper.PageInfo; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Repository; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; + +@Repository +public class ProductDataSource implements ProductRepository { + final 商品マスタMapper productMapper; + final ProductCustomMapper productCustomMapper; + final 代替商品Mapper substituteProductMapper; + final SubstituteProductCustomMapper substituteProductCustomMapper; + final 部品表Mapper bomMapper; + final BomCustomMapper bomCustomMapper; + final 顧客別販売単価Mapper customerSellingPriceMapper; + final CustomerSpecificSellingPriceCustomMapper customerSpecificSellingPriceCustomMapper; + final ProductEntityMapper productEntityMapper; + + public ProductDataSource(商品マスタMapper productMapper, ProductCustomMapper productCustomMapper, 代替商品Mapper substituteProductMapper, SubstituteProductCustomMapper substituteProductCustomMapper, 部品表Mapper bomMapper, BomCustomMapper bomCustomMapper, 顧客別販売単価Mapper customerSellingPriceMapper, CustomerSpecificSellingPriceCustomMapper customerSpecificSellingPriceCustomMapper, ProductEntityMapper productEntityMapper) { + this.productMapper = productMapper; + this.productCustomMapper = productCustomMapper; + this.substituteProductMapper = substituteProductMapper; + this.substituteProductCustomMapper = substituteProductCustomMapper; + this.bomMapper = bomMapper; + this.bomCustomMapper = bomCustomMapper; + this.customerSellingPriceMapper = customerSellingPriceMapper; + this.customerSpecificSellingPriceCustomMapper = customerSpecificSellingPriceCustomMapper; + this.productEntityMapper = productEntityMapper; + } + + @Override + public void deleteAll() { + customerSpecificSellingPriceCustomMapper.deleteAll(); + bomCustomMapper.deleteAll(); + substituteProductCustomMapper.deleteAll(); + productCustomMapper.deleteAll(); + } + + @Override + public void save(Product product) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + String username = authentication != null && authentication.getName() != null ? authentication.getName() : "system"; + + Optional productEntity = Optional.ofNullable(productCustomMapper.selectByPrimaryKey(product.getProductCode().getValue())); + if (productEntity.isEmpty()) { + createProduct(product, username); + } else { + updateProduct(product, productEntity, username); + } + } + + private void updateProduct(Product product, Optional productEntity, String username) { + 商品マスタ updateProductEntity = productEntityMapper.mapToEntity(product); + if (productEntity.isPresent()) { + updateProductEntity.set作成日時(productEntity.get().get作成日時()); + updateProductEntity.set作成者名(productEntity.get().get作成者名()); + updateProductEntity.set更新日時(LocalDateTime.now()); + updateProductEntity.set更新者名(username); + updateProductEntity.setVersion(productEntity.get().getVersion()); + } + int updateCount = productMapper.updateByPrimaryKey(updateProductEntity); + if (updateCount == 0) { + throw new ObjectOptimisticLockingFailureException(商品マスタ.class, product.getProductCode().getValue()); + } + + if (product.getSubstituteProduct() != null) { + substituteProductCustomMapper.deleteByProductCode(product.getProductCode().getValue()); + + product.getSubstituteProduct().forEach(substituteProduct -> { + 代替商品Key key = new 代替商品Key(); + key.set代替商品コード(substituteProduct.getSubstituteProductCode().getValue()); + key.set商品コード(substituteProduct.getProductCode().getValue()); + substituteProductMapper.deleteByPrimaryKey(key); + + 代替商品 substituteProductEntity = productEntityMapper.mapToEntity(substituteProduct); + substituteProductEntity.set作成日時(LocalDateTime.now()); + substituteProductEntity.set作成者名(username); + substituteProductEntity.set更新日時(LocalDateTime.now()); + substituteProductEntity.set更新者名(username); + substituteProductMapper.insert(substituteProductEntity); + }); + } + + if (product.getBoms() != null) { + bomCustomMapper.deleteByProductCode(product.getProductCode().getValue()); + + product.getBoms().forEach(bom -> { + 部品表Key key = new 部品表Key(); + key.set商品コード(bom.getProductCode().getValue()); + key.set部品コード(bom.getComponentCode().getValue()); + bomMapper.deleteByPrimaryKey(key); + + 部品表 bomEntity = productEntityMapper.mapToEntity(bom); + bomEntity.set作成日時(LocalDateTime.now()); + bomEntity.set作成者名(username); + bomEntity.set更新日時(LocalDateTime.now()); + bomEntity.set更新者名(username); + bomMapper.insert(bomEntity); + }); + } + + if (product.getCustomerSpecificSellingPrices() != null) { + customerSpecificSellingPriceCustomMapper.deleteByProductCode(product.getProductCode().getValue()); + + product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { + 顧客別販売単価Key key = new 顧客別販売単価Key(); + key.set商品コード(customerSpecificSellingPrice.getProductCode().getValue()); + key.set取引先コード(customerSpecificSellingPrice.getCustomerCode()); + customerSellingPriceMapper.deleteByPrimaryKey(key); + + 顧客別販売単価 customerSellingPriceEntity = productEntityMapper.mapToEntity(customerSpecificSellingPrice); + customerSellingPriceEntity.set作成日時(LocalDateTime.now()); + customerSellingPriceEntity.set作成者名(username); + customerSellingPriceEntity.set更新日時(LocalDateTime.now()); + customerSellingPriceEntity.set更新者名(username); + customerSellingPriceMapper.insert(customerSellingPriceEntity); + }); + } + } + + private void createProduct(Product product, String username) { + 商品マスタ newProductEntity = productEntityMapper.mapToEntity(product); + newProductEntity.set作成日時(LocalDateTime.now()); + newProductEntity.set作成者名(username); + newProductEntity.set更新日時(LocalDateTime.now()); + newProductEntity.set更新者名(username); + productMapper.insert(newProductEntity); + + if (product.getSubstituteProduct() != null) { + product.getSubstituteProduct().forEach(substituteProduct -> { + 代替商品 substituteProductEntity = productEntityMapper.mapToEntity(substituteProduct); + substituteProductEntity.set作成日時(LocalDateTime.now()); + substituteProductEntity.set作成者名(username); + substituteProductEntity.set更新日時(LocalDateTime.now()); + substituteProductEntity.set更新者名(username); + substituteProductMapper.insert(substituteProductEntity); + }); + } + + if (product.getBoms() != null) { + product.getBoms().forEach(bom -> { + 部品表 bomEntity = productEntityMapper.mapToEntity(bom); + bomEntity.set作成日時(LocalDateTime.now()); + bomEntity.set作成者名(username); + bomEntity.set更新日時(LocalDateTime.now()); + bomEntity.set更新者名(username); + bomMapper.insert(bomEntity); + }); + } + + if (product.getCustomerSpecificSellingPrices() != null) { + product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { + 顧客別販売単価 customerSellingPriceEntity = productEntityMapper.mapToEntity(customerSpecificSellingPrice); + customerSellingPriceEntity.set作成日時(LocalDateTime.now()); + customerSellingPriceEntity.set作成者名(username); + customerSellingPriceEntity.set更新日時(LocalDateTime.now()); + customerSellingPriceEntity.set更新者名(username); + customerSellingPriceMapper.insert(customerSellingPriceEntity); + }); + } + } + + @Override + public ProductList selectAll() { + List productEntities = productCustomMapper.selectAll(); + + return new ProductList(productEntities.stream() + .map(productEntityMapper::mapToDomainModel) + .toList()); + } + + @Override + public PageInfo selectAllWithPageInfo() { + List productEntities = productCustomMapper.selectAll(); + PageInfo pageInfo = new PageInfo<>(productEntities); + + return PageInfoHelper.of(pageInfo, productEntityMapper::mapToDomainModel); + } + + @Override + public PageInfo selectAllBoms() { + List productEntities = productCustomMapper.selectAllBoms(List.of(ProductType.製品.getCode(), ProductType.部品.getCode(), ProductType.包材.getCode())); + PageInfo pageInfo = new PageInfo<>(productEntities); + + return PageInfoHelper.of(pageInfo, productEntityMapper::mapToDomainModel); + } + + @Override + public PageInfo searchWithPageInfo(ProductCriteria criteria) { + List productEntities = productCustomMapper.selectByCriteria(criteria); + PageInfo pageInfo = new PageInfo<>(productEntities); + + return PageInfoHelper.of(pageInfo, productEntityMapper::mapToDomainModel); + } + + @Override + public Optional findById(String productCode) { + ProductCustomEntity productEntity = productCustomMapper.selectByPrimaryKey(productCode); + if (productEntity != null) { + return Optional.of(productEntityMapper.mapToDomainModel(productEntity)); + } + return Optional.empty(); + } + + @Override + public void deleteById(Product product) { + if (!product.getSubstituteProduct().isEmpty()) { + product.getSubstituteProduct().forEach(substituteProduct -> { + 代替商品Key key = new 代替商品Key(); + key.set商品コード(substituteProduct.getProductCode().getValue()); + key.set代替商品コード(substituteProduct.getSubstituteProductCode().getValue()); + substituteProductMapper.deleteByPrimaryKey(key); + }); + } + + if (!product.getBoms().isEmpty()) { + product.getBoms().forEach(bom -> { + 部品表Key key = new 部品表Key(); + key.set商品コード(bom.getProductCode().getValue()); + key.set部品コード(bom.getComponentCode().getValue()); + bomMapper.deleteByPrimaryKey(key); + }); + } + + if (!product.getCustomerSpecificSellingPrices().isEmpty()) { + product.getCustomerSpecificSellingPrices().forEach(customerSpecificSellingPrice -> { + 顧客別販売単価Key key = new 顧客別販売単価Key(); + key.set商品コード(customerSpecificSellingPrice.getProductCode().getValue()); + key.set取引先コード(customerSpecificSellingPrice.getCustomerCode()); + customerSellingPriceMapper.deleteByPrimaryKey(key); + }); + } + + productMapper.deleteByPrimaryKey(product.getProductCode().getValue()); + } +} diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java similarity index 65% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java index d5634b77..f5595ac6 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductEntityMapper.java @@ -5,10 +5,17 @@ import com.example.sms.domain.model.master.product.Product; import com.example.sms.domain.model.master.product.SubstituteProduct; import com.example.sms.domain.type.product.*; +import com.example.sms.infrastructure.datasource.system.download.ProductDownloadCSV; +import com.example.sms.infrastructure.datasource.autogen.model.代替商品; +import com.example.sms.infrastructure.datasource.autogen.model.商品マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.部品表; +import com.example.sms.infrastructure.datasource.autogen.model.顧客別販売単価; import org.springframework.stereotype.Component; import java.util.List; +import java.util.function.Function; +//TODO:製品型番追加 @Component public class ProductEntityMapper { public 商品マスタ mapToEntity(Product product) { @@ -59,7 +66,31 @@ public class ProductEntityMapper { return customerSellingPriceEntity; } - public Product mapToDomainModel(商品マスタ productEntity) { + public Product mapToDomainModel(ProductCustomEntity productEntity) { + Function<代替商品, SubstituteProduct> mapToSubstituteProduct = s -> ( + SubstituteProduct.of( + s.get商品コード(), + s.get代替商品コード(), + s.get優先順位() + ) + ); + + Function<部品表, Bom> mapToBom = b -> ( + Bom.of( + b.get商品コード(), + b.get部品コード(), + b.get部品数量() + ) + ); + + Function<顧客別販売単価, CustomerSpecificSellingPrice> mapToCustomerSpecificSellingPrice = c -> ( + CustomerSpecificSellingPrice.of( + c.get商品コード(), + c.get取引先コード(), + c.get販売単価() + ) + ); + Product product = Product.of( productEntity.get商品コード(), productEntity.get商品正式名(), @@ -79,41 +110,37 @@ public Product mapToDomainModel(商品マスタ productEntity) { ); List substituteProducts = productEntity.get代替商品().stream() - .map(this::mapToSubstituteProduct) + .map(mapToSubstituteProduct) .toList(); List boms = productEntity.get部品表().stream() - .map(this::mapToBom) + .map(mapToBom) .toList(); List customerSpecificSellingPrices = productEntity.get顧客別販売単価().stream() - .map(this::mapToCustomerSpecificSellingPrice) + .map(mapToCustomerSpecificSellingPrice) .toList(); product = Product.of(product, substituteProducts, boms, customerSpecificSellingPrices); return product; } - - private SubstituteProduct mapToSubstituteProduct(代替商品 substituteProductEntity) { - return SubstituteProduct.of( - substituteProductEntity.get商品コード(), - substituteProductEntity.get代替商品コード(), - substituteProductEntity.get優先順位() - ); - } - - private Bom mapToBom(部品表 bomEntity) { - return Bom.of( - bomEntity.get商品コード(), - bomEntity.get部品コード(), - bomEntity.get部品数量() - ); - } - - private CustomerSpecificSellingPrice mapToCustomerSpecificSellingPrice(顧客別販売単価 顧客別販売単価) { - return CustomerSpecificSellingPrice.of( - 顧客別販売単価.get商品コード(), - 顧客別販売単価.get取引先コード(), - 顧客別販売単価.get販売単価() + public ProductDownloadCSV mapToCsvModel(Product product) { + return new ProductDownloadCSV( + product.getProductCode().getValue(), + product.getProductName().getProductFormalName(), + product.getProductName().getProductAbbreviation(), + product.getProductName().getProductNameKana(), + product.getProductType().getCode(), + "", + product.getSellingPrice().getAmount(), + product.getPurchasePrice().getAmount(), + product.getCostOfSales().getAmount(), + product.getTaxType().getCode(), + product.getProductCategoryCode().getValue(), + product.getMiscellaneousType().getCode(), + product.getStockManagementTargetType().getCode(), + product.getStockAllocationType().getCode(), + product.getSupplierCode().getValue(), + product.getSupplierCode().getBranchNumber() ); } } diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomEntity.java new file mode 100644 index 00000000..64600840 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomEntity.java @@ -0,0 +1,10 @@ +package com.example.sms.infrastructure.datasource.master.product.bom; + +import com.example.sms.infrastructure.datasource.autogen.model.部品表; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class BomCustomEntity extends 部品表 { +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.java new file mode 100644 index 00000000..6c48a15b --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.java @@ -0,0 +1,18 @@ +package com.example.sms.infrastructure.datasource.master.product.bom; + +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface BomCustomMapper { + @Delete("DELETE FROM public.部品表") + void deleteAll(); + + List selectAll(); + + BomCustomEntity selectByProductCode(String productCode); + + void deleteByProductCode(String value); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.xml new file mode 100644 index 00000000..cdd6c68d --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/bom/BomCustomMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + delete + from public.部品表 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomEntity.java new file mode 100644 index 00000000..006cd28a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomEntity.java @@ -0,0 +1,10 @@ +package com.example.sms.infrastructure.datasource.master.product.customer_specific_price; + +import com.example.sms.infrastructure.datasource.autogen.model.顧客別販売単価; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CustomerSpecificSellingPriceCustomEntity extends 顧客別販売単価 { +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.java new file mode 100644 index 00000000..4888f42c --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.java @@ -0,0 +1,18 @@ +package com.example.sms.infrastructure.datasource.master.product.customer_specific_price; + +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface CustomerSpecificSellingPriceCustomMapper { + @Delete("DELETE FROM public.顧客別販売単価") + void deleteAll(); + + List selectAll(); + + List selectByProductCode(String productCode); + + void deleteByProductCode(String value); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.xml new file mode 100644 index 00000000..e75bc2a6 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/customer_specific_price/CustomerSpecificSellingPriceCustomMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + delete + from public.顧客別販売単価 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/product/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomEntity.java new file mode 100644 index 00000000..47366590 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomEntity.java @@ -0,0 +1,10 @@ +package com.example.sms.infrastructure.datasource.master.product.substitute; + +import com.example.sms.infrastructure.datasource.autogen.model.代替商品; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class SubstituteProductCustomEntity extends 代替商品 { +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.java new file mode 100644 index 00000000..694b2242 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.java @@ -0,0 +1,18 @@ +package com.example.sms.infrastructure.datasource.master.product.substitute; + +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface SubstituteProductCustomMapper { + @Delete("DELETE FROM 代替商品") + void deleteAll(); + + List selectAll(); + + SubstituteProductCustomEntity selectByProductCode(String productCode); + + void deleteByProductCode(String value); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.xml new file mode 100644 index 00000000..a21ff35b --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/substitute/SubstituteProductCustomMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + delete + from public.代替商品 + where 商品コード = #{商品コード,jdbcType=VARCHAR} + + diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomEntity.java new file mode 100644 index 00000000..bb327d2b --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomEntity.java @@ -0,0 +1,14 @@ +package com.example.sms.infrastructure.datasource.master.product_category; + +import com.example.sms.infrastructure.datasource.autogen.model.商品マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.商品分類マスタ; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class ProductCategoryCustomEntity extends 商品分類マスタ { + private List<商品マスタ> 商品マスタ; +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.java new file mode 100644 index 00000000..610cb5a2 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.java @@ -0,0 +1,19 @@ +package com.example.sms.infrastructure.datasource.master.product_category; + +import com.example.sms.service.master.product.ProductCategoryCriteria; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface ProductCategoryCustomMapper { + ProductCategoryCustomEntity selectByPrimaryKey(String productCategoryCode); + + @Delete("DELETE FROM public.商品分類マスタ") + void deleteAll(); + + List selectAll(); + + List selectByCriteria(ProductCategoryCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.xml new file mode 100644 index 00000000..dae56668 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryCustomMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryDataSource.java similarity index 66% rename from api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryDataSource.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryDataSource.java index ff290a13..b3e4bd43 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/master/product/ProductCategoryDataSource.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryDataSource.java @@ -1,8 +1,11 @@ -package com.example.sms.infrastructure.datasource.master.product; +package com.example.sms.infrastructure.datasource.master.product_category; import com.example.sms.domain.model.master.product.ProductCategory; import com.example.sms.domain.model.master.product.ProductCategoryList; import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.autogen.mapper.商品分類マスタMapper; +import com.example.sms.infrastructure.datasource.autogen.model.商品分類マスタ; +import com.example.sms.service.master.product.ProductCategoryCriteria; import com.example.sms.service.master.product.ProductCategoryRepository; import com.github.pagehelper.PageInfo; import org.springframework.security.core.Authentication; @@ -16,16 +19,18 @@ @Repository public class ProductCategoryDataSource implements ProductCategoryRepository { final 商品分類マスタMapper productCategoryMapper; + final ProductCategoryCustomMapper productCategoryCustomMapper; final ProductCategoryEntityMapper productCategoryEntityMapper; - public ProductCategoryDataSource(商品分類マスタMapper productCategoryMapper, ProductCategoryEntityMapper productCategoryEntityMapper) { + public ProductCategoryDataSource(商品分類マスタMapper productCategoryMapper, ProductCategoryCustomMapper productCategoryCustomMapper, ProductCategoryEntityMapper productCategoryEntityMapper) { this.productCategoryMapper = productCategoryMapper; + this.productCategoryCustomMapper = productCategoryCustomMapper; this.productCategoryEntityMapper = productCategoryEntityMapper; } @Override public void deleteAll() { - productCategoryMapper.deleteAll(); + productCategoryCustomMapper.deleteAll(); } @Override @@ -33,7 +38,7 @@ public void save(ProductCategory product) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String username = authentication != null && authentication.getName() != null ? authentication.getName() : "system"; - Optional<商品分類マスタ> productCategoryEntity = Optional.ofNullable(productCategoryMapper.selectByPrimaryKey(product.getProductCategoryCode().getValue())); + Optional productCategoryEntity = Optional.ofNullable(productCategoryCustomMapper.selectByPrimaryKey(product.getProductCategoryCode().getValue())); 商品分類マスタ newProductCategoryEntity = productCategoryEntityMapper.mapToEntity(product); if (productCategoryEntity.isEmpty()) { newProductCategoryEntity.set作成日時(LocalDateTime.now()); @@ -52,7 +57,7 @@ public void save(ProductCategory product) { @Override public ProductCategoryList selectAll() { - List<商品分類マスタ> productCategoryEntities = productCategoryMapper.selectAll(); + List productCategoryEntities = productCategoryCustomMapper.selectAll(); return new ProductCategoryList(productCategoryEntities.stream() .map(productCategoryEntityMapper::mapToDomainModel) @@ -61,15 +66,23 @@ public ProductCategoryList selectAll() { @Override public PageInfo selectAllWithPageInfo() { - List<商品分類マスタ> productEntities = productCategoryMapper.selectAll(); - PageInfo<商品分類マスタ> pageInfo = new PageInfo<>(productEntities); + List productEntities = productCategoryCustomMapper.selectAll(); + PageInfo pageInfo = new PageInfo<>(productEntities); + + return PageInfoHelper.of(pageInfo, productCategoryEntityMapper::mapToDomainModel); + } + + @Override + public PageInfo searchWithPageInfo(ProductCategoryCriteria criteria) { + List productEntities = productCategoryCustomMapper.selectByCriteria(criteria); + PageInfo pageInfo = new PageInfo<>(productEntities); return PageInfoHelper.of(pageInfo, productCategoryEntityMapper::mapToDomainModel); } @Override public Optional findById(String productCategoryCode) { - 商品分類マスタ productCategoryEntity = productCategoryMapper.selectByPrimaryKey(productCategoryCode); + ProductCategoryCustomEntity productCategoryEntity = productCategoryCustomMapper.selectByPrimaryKey(productCategoryCode); if (productCategoryEntity != null) { return Optional.of(productCategoryEntityMapper.mapToDomainModel(productCategoryEntity)); } diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryEntityMapper.java new file mode 100644 index 00000000..a4961821 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/master/product_category/ProductCategoryEntityMapper.java @@ -0,0 +1,73 @@ +package com.example.sms.infrastructure.datasource.master.product_category; + +import com.example.sms.domain.model.master.product.Product; +import com.example.sms.domain.model.master.product.ProductCategory; +import com.example.sms.domain.type.product.*; +import com.example.sms.infrastructure.datasource.system.download.ProductCategoryDownloadCSV; +import com.example.sms.infrastructure.datasource.autogen.model.商品マスタ; +import com.example.sms.infrastructure.datasource.autogen.model.商品分類マスタ; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.function.Function; + +@Component +public class ProductCategoryEntityMapper { + + public ProductCategory mapToDomainModel(ProductCategoryCustomEntity productCategoryEntity) { + Function<商品マスタ, Product> mapToProduct = p -> ( + Product.of( + p.get商品コード(), + p.get商品正式名(), + p.get商品略称(), + p.get商品名カナ(), + ProductType.fromCode(p.get商品区分()), + p.get販売単価(), + p.get仕入単価(), + p.get売上原価(), + TaxType.fromCode(p.get税区分()), + p.get商品分類コード(), + MiscellaneousType.fromCode(p.get雑区分()), + StockManagementTargetType.fromCode(p.get在庫管理対象区分()), + StockAllocationType.fromCode(p.get在庫引当区分()), + p.get仕入先コード(), + p.get仕入先枝番() + ) + ); + + ProductCategory productCategory = ProductCategory.of( + productCategoryEntity.get商品分類コード(), + productCategoryEntity.get商品分類名(), + productCategoryEntity.get商品分類階層(), + productCategoryEntity.get商品分類パス(), + productCategoryEntity.get最下層区分() + ); + + List products = productCategoryEntity.get商品マスタ().stream() + .map(mapToProduct) + .toList(); + + return ProductCategory.of(productCategory, products); + } + + public 商品分類マスタ mapToEntity(ProductCategory product) { + 商品分類マスタ productCategoryEntity = new 商品分類マスタ(); + productCategoryEntity.set商品分類コード(product.getProductCategoryCode().getValue()); + productCategoryEntity.set商品分類名(product.getProductCategoryName()); + productCategoryEntity.set商品分類階層(product.getProductCategoryHierarchy()); + productCategoryEntity.set商品分類パス(product.getProductCategoryPath()); + productCategoryEntity.set最下層区分(product.getLowestLevelDivision()); + + return productCategoryEntity; + } + + public ProductCategoryDownloadCSV mapToCsvModel(ProductCategory productCategory) { + return new ProductCategoryDownloadCSV( + productCategory.getProductCategoryCode().getValue(), + productCategory.getProductCategoryName(), + productCategory.getProductCategoryHierarchy(), + productCategory.getProductCategoryPath(), + productCategory.getLowestLevelDivision() + ); + } +} diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomEntity.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomEntity.java new file mode 100644 index 00000000..6dcef17d --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomEntity.java @@ -0,0 +1,12 @@ +package com.example.sms.infrastructure.datasource.system.audit; + +import com.example.sms.infrastructure.datasource.autogen.model.ApplicationExecutionHistory; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ApplicationExecutionHistoryCustomEntity extends ApplicationExecutionHistory { + private Usr user; +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.java new file mode 100644 index 00000000..c8f3d760 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.java @@ -0,0 +1,34 @@ +package com.example.sms.infrastructure.datasource.system.audit; + +import com.example.sms.service.system.audit.AuditCriteria; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Options; + +import java.util.List; + +@Mapper +public interface ApplicationExecutionHistoryCustomMapper { + ApplicationExecutionHistoryCustomEntity selectByPrimaryKey(Integer id); + + @Delete("DELETE FROM system.application_execution_history") + void deleteAll(); + + List selectAll(); + + @Insert({ + "insert into system.application_execution_history (process_name, process_code,", + "process_type, process_start, process_end,", + "process_flag, process_details, version,", + "user_id)", + "values (#{processName,jdbcType=VARCHAR}, #{processCode,jdbcType=VARCHAR},", + "#{processType,jdbcType=VARCHAR}, #{processStart,jdbcType=TIMESTAMP}, #{processEnd,jdbcType=TIMESTAMP},", + "#{processFlag,jdbcType=INTEGER}, #{processDetails,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER},", + "#{userId,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys = true, keyProperty = "id") + void insertForStart(ApplicationExecutionHistoryCustomEntity record); + + List selectByCriteria(AuditCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.xml new file mode 100644 index 00000000..de734f3a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryCustomMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryDataSource.java new file mode 100644 index 00000000..f3aad5f9 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryDataSource.java @@ -0,0 +1,91 @@ +package com.example.sms.infrastructure.datasource.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistoryList; +import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.ObjectOptimisticLockingFailureException; +import com.example.sms.infrastructure.datasource.autogen.mapper.ApplicationExecutionHistoryMapper; +import com.example.sms.service.system.audit.AuditRepository; +import com.example.sms.service.system.audit.AuditCriteria; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Optional; + +@Repository +public class ApplicationExecutionHistoryDataSource implements AuditRepository { + final ApplicationExecutionHistoryMapper applicationExecutionHistoryMapper; + final ApplicationExecutionHistoryCustomMapper applicationExecutionHistoryCustomMapper; + final ApplicationExecutionHistoryEntityMapper applicationExecutionHistoryEntityMapper; + + public ApplicationExecutionHistoryDataSource(ApplicationExecutionHistoryMapper applicationExecutionHistoryMapper, ApplicationExecutionHistoryCustomMapper applicationExecutionHistoryCustomMapper, ApplicationExecutionHistoryEntityMapper applicationExecutionHistoryEntityMapper) { + this.applicationExecutionHistoryMapper = applicationExecutionHistoryMapper; + this.applicationExecutionHistoryCustomMapper = applicationExecutionHistoryCustomMapper; + this.applicationExecutionHistoryEntityMapper = applicationExecutionHistoryEntityMapper; + } + + @Override + public void deleteAll() { + applicationExecutionHistoryCustomMapper.deleteAll(); + } + + @Override + public void save(ApplicationExecutionHistory history) { + Optional historyEntity = Optional.ofNullable(applicationExecutionHistoryCustomMapper.selectByPrimaryKey(history.getId())); + if (historyEntity.isEmpty()) { + ApplicationExecutionHistoryCustomEntity newHistoryEntity = applicationExecutionHistoryEntityMapper.mapToEntity(history); + if (newHistoryEntity.getId() != null) { + applicationExecutionHistoryMapper.insert(newHistoryEntity); + } else { + applicationExecutionHistoryMapper.insertSelective(newHistoryEntity); + } + } else { + ApplicationExecutionHistoryCustomEntity historyEntityToUpdate = applicationExecutionHistoryEntityMapper.mapToEntity(history); + int updateCount = applicationExecutionHistoryMapper.updateByPrimaryKey(historyEntityToUpdate); + if (updateCount == 0) { + throw new ObjectOptimisticLockingFailureException(ApplicationExecutionHistoryCustomEntity.class, history.getId()); + } + } + } + + @Override + public ApplicationExecutionHistoryList selectAll() { + List applicationExecutionHistories = applicationExecutionHistoryCustomMapper.selectAll(); + return new ApplicationExecutionHistoryList(applicationExecutionHistories.stream() + .map(applicationExecutionHistoryEntityMapper::mapToDomainModel) + .toList()); + } + + @Override + public Optional findById(Integer id) { + Optional applicationExecutionHistoryEntity = Optional.ofNullable(applicationExecutionHistoryCustomMapper.selectByPrimaryKey(id)); + return applicationExecutionHistoryEntity.map(applicationExecutionHistoryEntityMapper::mapToDomainModel); + } + + @Override + public void deleteById(Integer id) { + applicationExecutionHistoryMapper.deleteByPrimaryKey(id); + } + + @Override + public PageInfo selectAllWithPageInfo() { + List applicationExecutionHistories = applicationExecutionHistoryCustomMapper.selectAll(); + PageInfo pageInfo = new PageInfo<>(applicationExecutionHistories); + return PageInfoHelper.of(pageInfo, applicationExecutionHistoryEntityMapper::mapToDomainModel); + } + + @Override + public ApplicationExecutionHistory start(ApplicationExecutionHistory history) { + ApplicationExecutionHistoryCustomEntity newHistoryEntity = applicationExecutionHistoryEntityMapper.mapToEntity(history); + applicationExecutionHistoryCustomMapper.insertForStart(newHistoryEntity); + return applicationExecutionHistoryEntityMapper.mapToDomainModel(newHistoryEntity); + } + + @Override + public PageInfo searchWithPageInfo(AuditCriteria criteria) { + List applicationExecutionHistories = applicationExecutionHistoryCustomMapper.selectByCriteria(criteria); + PageInfo pageInfo = new PageInfo<>(applicationExecutionHistories); + return PageInfoHelper.of(pageInfo, applicationExecutionHistoryEntityMapper::mapToDomainModel); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryEntityMapper.java new file mode 100644 index 00000000..9bc35e70 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/audit/ApplicationExecutionHistoryEntityMapper.java @@ -0,0 +1,56 @@ +package com.example.sms.infrastructure.datasource.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import com.example.sms.domain.type.user.RoleName; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; +import org.springframework.stereotype.Component; + +import java.util.function.Function; + +@Component +public class ApplicationExecutionHistoryEntityMapper { + public ApplicationExecutionHistory mapToDomainModel(ApplicationExecutionHistoryCustomEntity applicationExecutionHistoryEntity) { + Function user = (ApplicationExecutionHistoryCustomEntity applicationExecutionHistory) -> { + if (applicationExecutionHistory.getUser() == null) { + return null; + } + Usr userEntity = applicationExecutionHistory.getUser(); + return User.of( + userEntity.getUserId(), + userEntity.getPassword(), + userEntity.getFirstName(), + userEntity.getLastName(), + RoleName.valueOf(userEntity.getRoleName()) + ); + }; + + return com.example.sms.domain.model.system.audit.ApplicationExecutionHistory.of( + applicationExecutionHistoryEntity.getId(), + applicationExecutionHistoryEntity.getProcessName(), + applicationExecutionHistoryEntity.getProcessCode(), + ApplicationExecutionHistoryType.valueOf(applicationExecutionHistoryEntity.getProcessType()), + applicationExecutionHistoryEntity.getProcessStart(), + applicationExecutionHistoryEntity.getProcessEnd(), + ApplicationExecutionProcessFlag.fromValue(applicationExecutionHistoryEntity.getProcessFlag()), + applicationExecutionHistoryEntity.getProcessDetails(), + user.apply(applicationExecutionHistoryEntity) + ); + } + + public ApplicationExecutionHistoryCustomEntity mapToEntity(ApplicationExecutionHistory applicationExecutionHistory) { + ApplicationExecutionHistoryCustomEntity applicationExecutionHistoryEntity = new ApplicationExecutionHistoryCustomEntity(); + applicationExecutionHistoryEntity.setId(applicationExecutionHistory.getId()); + applicationExecutionHistoryEntity.setProcessName(applicationExecutionHistory.getProcess().getProcessType().getName()); + applicationExecutionHistoryEntity.setProcessCode(applicationExecutionHistory.getProcess().getProcessType().getCode()); + applicationExecutionHistoryEntity.setProcessType(applicationExecutionHistory.getType().name()); + applicationExecutionHistoryEntity.setProcessStart(applicationExecutionHistory.getProcessStart()); + applicationExecutionHistoryEntity.setProcessEnd(applicationExecutionHistory.getProcessEnd()); + applicationExecutionHistoryEntity.setProcessFlag(applicationExecutionHistory.getProcessFlag().getValue()); + applicationExecutionHistoryEntity.setProcessDetails(applicationExecutionHistory.getProcessDetails()); + applicationExecutionHistoryEntity.setUserId(applicationExecutionHistory.getUser().getUserId().getValue()); + return applicationExecutionHistoryEntity; + } +} diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java similarity index 86% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java index b6f28ab7..e1007e2e 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtDataSource.java @@ -1,9 +1,9 @@ package com.example.sms.infrastructure.datasource.system.auth; import com.example.sms.domain.model.system.user.User; +import com.example.sms.infrastructure.datasource.autogen.mapper.UsrMapper; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; import com.example.sms.infrastructure.datasource.system.user.UserEntityMapper; -import com.example.sms.infrastructure.datasource.system.user.Usr; -import com.example.sms.infrastructure.datasource.system.user.UsrMapper; import com.example.sms.service.system.auth.AuthRepository; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Repository; @@ -25,7 +25,7 @@ public JwtDataSource(UsrMapper userMapper, UserEntityMapper userEntityMapper, Jw @Override public Optional findById(String userId) { Optional userEntity = Optional.ofNullable(userMapper.selectByPrimaryKey(userId)); - return userEntity.map(userEntityMapper::mapToDomainModel); + return userEntity.map(userEntityMapper::mapToDomainEntity); } @Override diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtUtils.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtUtils.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtUtils.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/auth/JwtUtils.java diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentCSVDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentCSVDataSource.java new file mode 100644 index 00000000..492dbb2b --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentCSVDataSource.java @@ -0,0 +1,49 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.example.sms.domain.model.master.department.DepartmentList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.autogen.mapper.部門マスタMapper; +import com.example.sms.infrastructure.datasource.master.department.DepartmentCustomEntity; +import com.example.sms.infrastructure.datasource.master.department.DepartmentCustomMapper; +import com.example.sms.infrastructure.datasource.master.department.DepartmentEntityMapper; +import com.example.sms.service.system.download.DepartmentCSVRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class DepartmentCSVDataSource implements DepartmentCSVRepository { + final 部門マスタMapper departmentMapper; + final DepartmentCustomMapper departmentCustomMapper; + final DepartmentEntityMapper departmentEntityMapper; + + public DepartmentCSVDataSource(部門マスタMapper departmentMapper, DepartmentCustomMapper departmentCustomMapper, DepartmentEntityMapper departmentEntityMapper) { + this.departmentMapper = departmentMapper; + this.departmentCustomMapper = departmentCustomMapper; + this.departmentEntityMapper = departmentEntityMapper; + } + + @Override + public List convert(DepartmentList departmentList) { + if (departmentList != null) { + return departmentList.asList().stream() + .map(departmentEntityMapper::mapToCsvModel) + .toList(); + } + return List.of(); + } + + @Override + public int countBy(DownloadCriteria condition) { + List departmentEntities = departmentCustomMapper.selectAll(); + return departmentEntities.size(); + } + + @Override + public DepartmentList selectBy(DownloadCriteria condition) { + List departmentEntities = departmentCustomMapper.selectAll(); + return new DepartmentList(departmentEntities.stream() + .map(departmentEntityMapper::mapToDomainModel) + .toList()); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentDownloadCSV.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentDownloadCSV.java new file mode 100644 index 00000000..6ef55f2c --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/DepartmentDownloadCSV.java @@ -0,0 +1,52 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.opencsv.bean.CsvBindByName; +import com.opencsv.bean.CsvBindByPosition; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.time.LocalDateTime; + +@Data +public class DepartmentDownloadCSV { + @CsvBindByPosition(position = 0) + @CsvBindByName(column = "部門コード", required = true) + private String departmentCode; + @CsvBindByPosition(position = 1) + @CsvBindByName(column = "部門名", required = true) + private LocalDateTime departmentStartDate; + @CsvBindByPosition(position = 2) + @CsvBindByName(column = "開始日", required = true) + private LocalDateTime departmentEndDate; + @CsvBindByPosition(position = 3) + @CsvBindByName(column = "部門名", required = true) + private String departmentName; + @CsvBindByPosition(position = 4) + @CsvBindByName(column = "組織階層", required = true) + private Integer layer; + @CsvBindByPosition(position = 5) + @CsvBindByName(column = "部門パス", required = true) + private String path; + @CsvBindByPosition(position = 6) + @CsvBindByName(column = "最下層区分", required = true) + private Integer lowerType; + @CsvBindByPosition(position = 7) + @CsvBindByName(column = "伝票入力可否", required = true) + private Integer slitYn; + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public DepartmentDownloadCSV(String departmentCode, LocalDateTime departmentStartDate, LocalDateTime departmentEndDate, String departmentName, String path, int layer, int slitYn, int lowerType) { + this.departmentCode = departmentCode; + this.departmentStartDate = departmentStartDate; + this.departmentEndDate = departmentEndDate; + this.departmentName = departmentName; + this.path = path; + this.layer = layer; + this.slitYn = slitYn; + this.lowerType = lowerType; + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeCSVDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeCSVDataSource.java new file mode 100644 index 00000000..b95dc6ac --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeCSVDataSource.java @@ -0,0 +1,45 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.example.sms.domain.model.master.employee.EmployeeList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.master.employee.EmployeeCustomEntity; +import com.example.sms.infrastructure.datasource.master.employee.EmployeeCustomMapper; +import com.example.sms.infrastructure.datasource.master.employee.EmployeeEntityMapper; +import com.example.sms.service.system.download.EmployeeCSVRepository; +import org.springframework.stereotype.Repository; +import java.util.List; + +@Repository +public class EmployeeCSVDataSource implements EmployeeCSVRepository { + private final EmployeeCustomMapper employeeCustomMapper; + private final EmployeeEntityMapper employeeEntityMapper; + + public EmployeeCSVDataSource(EmployeeCustomMapper employeeCustomMapper, EmployeeEntityMapper employeeEntityMapper) { + this.employeeCustomMapper = employeeCustomMapper; + this.employeeEntityMapper = employeeEntityMapper; + } + + @Override + public List convert(EmployeeList employeeList) { + if (employeeList != null) { + return employeeList.asList().stream() + .map(employeeEntityMapper::mapToCsvModel) + .toList(); + } + return List.of(); + } + + @Override + public int countBy(DownloadCriteria condition) { + List employeeEntities = employeeCustomMapper.selectAll(); + return employeeEntities.size(); + } + + @Override + public EmployeeList selectBy(DownloadCriteria condition) { + List employeeEntities = employeeCustomMapper.selectAll(); + return new EmployeeList(employeeEntities.stream() + .map(employeeEntityMapper::mapToDomainModel) + .toList()); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeDownloadCSV.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeDownloadCSV.java new file mode 100644 index 00000000..0e53b148 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/EmployeeDownloadCSV.java @@ -0,0 +1,75 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.opencsv.bean.CsvBindByName; +import com.opencsv.bean.CsvBindByPosition; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.time.LocalDateTime; + +@Data +public class EmployeeDownloadCSV { + + @CsvBindByPosition(position = 0) + @CsvBindByName(column = "社員コード", required = true) + private String employeeCode; + + @CsvBindByPosition(position = 1) + @CsvBindByName(column = "社員名", required = true) + private String employeeName; + + @CsvBindByPosition(position = 2) + @CsvBindByName(column = "社員名カナ", required = false) + private String employeeNameKana; + + @CsvBindByPosition(position = 3) + @CsvBindByName(column = "パスワード", required = false) + private String password; + + @CsvBindByPosition(position = 4) + @CsvBindByName(column = "電話番号", required = false) + private String phoneNumber; + + @CsvBindByPosition(position = 5) + @CsvBindByName(column = "FAX番号", required = false) + private String faxNumber; + + @CsvBindByPosition(position = 6) + @CsvBindByName(column = "部門コード", required = false) + private String departmentCode; + + @CsvBindByPosition(position = 7) + @CsvBindByName(column = "開始日", required = false) + private LocalDateTime startDate; + + @CsvBindByPosition(position = 8) + @CsvBindByName(column = "職種コード", required = true) + private String occuCode; + + @CsvBindByPosition(position = 9) + @CsvBindByName(column = "承認権限コード", required = false) + private String approvalCode; + + @CsvBindByPosition(position = 10) + @CsvBindByName(column = "ユーザーID", required = true) + private String userId; + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public EmployeeDownloadCSV(String employeeCode, String employeeName, String employeeNameKana, String loginPassword, String phoneNumber, String faxNumber, String occuCode, String approvalCode, String departmentCode, LocalDateTime startDate, String userId) { + this.employeeCode = employeeCode; + this.employeeName = employeeName; + this.employeeNameKana = employeeNameKana; + this.password = loginPassword; + this.phoneNumber = phoneNumber; + this.faxNumber = faxNumber; + this.occuCode = occuCode; + this.approvalCode = approvalCode; + this.departmentCode = departmentCode; + this.startDate = startDate; + this.userId = userId; + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCSVDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCSVDataSource.java new file mode 100644 index 00000000..2c745488 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCSVDataSource.java @@ -0,0 +1,45 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.example.sms.domain.model.master.product.ProductList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.master.product.ProductCustomEntity; +import com.example.sms.infrastructure.datasource.master.product.ProductCustomMapper; +import com.example.sms.infrastructure.datasource.master.product.ProductEntityMapper; +import com.example.sms.service.system.download.ProductCSVRepository; +import org.springframework.stereotype.Repository; +import java.util.List; + +@Repository +public class ProductCSVDataSource implements ProductCSVRepository { + private final ProductCustomMapper productCustomMapper; + private final ProductEntityMapper productEntityMapper; + + public ProductCSVDataSource(ProductCustomMapper productCustomMapper, ProductEntityMapper productEntityMapper) { + this.productCustomMapper = productCustomMapper; + this.productEntityMapper = productEntityMapper; + } + + @Override + public List convert(ProductList productList) { + if (productList != null) { + return productList.asList().stream() + .map(productEntityMapper::mapToCsvModel) + .toList(); + } + return List.of(); + } + + @Override + public int countBy(DownloadCriteria condition) { + List productEntities = productCustomMapper.selectAll(); + return productEntities.size(); + } + + @Override + public ProductList selectBy(DownloadCriteria condition) { + List productEntities = productCustomMapper.selectAll(); + return new ProductList(productEntities.stream() + .map(productEntityMapper::mapToDomainModel) + .toList()); + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryCSVDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryCSVDataSource.java new file mode 100644 index 00000000..d466a7f7 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryCSVDataSource.java @@ -0,0 +1,47 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.example.sms.domain.model.master.product.ProductCategoryList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.master.product_category.ProductCategoryCustomEntity; +import com.example.sms.infrastructure.datasource.master.product_category.ProductCategoryCustomMapper; +import com.example.sms.infrastructure.datasource.master.product_category.ProductCategoryEntityMapper; +import com.example.sms.service.system.download.ProductCategoryCSVRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class ProductCategoryCSVDataSource implements ProductCategoryCSVRepository { + private final ProductCategoryCustomMapper productCategoryCustomMapper; + private final ProductCategoryEntityMapper productCategoryEntityMapper; + + public ProductCategoryCSVDataSource(ProductCategoryCustomMapper productCategoryCustomMapper, ProductCategoryEntityMapper productCategoryEntityMapper) { + this.productCategoryCustomMapper = productCategoryCustomMapper; + this.productCategoryEntityMapper = productCategoryEntityMapper; + } + + + @Override + public List convert(ProductCategoryList productCategoryList) { + if (productCategoryList != null) { + return productCategoryList.asList().stream() + .map(productCategoryEntityMapper::mapToCsvModel) + .toList(); + } + return List.of(); + } + + @Override + public int countBy(DownloadCriteria condition) { + List productCategoryEntities = productCategoryCustomMapper.selectAll(); + return productCategoryEntities.size(); + } + + @Override + public ProductCategoryList selectBy(DownloadCriteria condition) { + List productCategoryEntities = productCategoryCustomMapper.selectAll(); + return new ProductCategoryList(productCategoryEntities.stream() + .map(productCategoryEntityMapper::mapToDomainModel) + .toList()); + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryDownloadCSV.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryDownloadCSV.java new file mode 100644 index 00000000..21bca4c0 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductCategoryDownloadCSV.java @@ -0,0 +1,43 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.opencsv.bean.CsvBindByName; +import com.opencsv.bean.CsvBindByPosition; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@Data +public class ProductCategoryDownloadCSV { + + @CsvBindByPosition(position = 0) + @CsvBindByName(column = "商品分類コード", required = true) + private String productCategoryCode; + + @CsvBindByPosition(position = 1) + @CsvBindByName(column = "商品分類名", required = true) + private String productCategoryName; + + @CsvBindByPosition(position = 2) + @CsvBindByName(column = "商品分類階層", required = false) + private Integer productCategoryLevel; + + @CsvBindByPosition(position = 3) + @CsvBindByName(column = "商品分類パス", required = false) + private String productCategoryPath; + + @CsvBindByPosition(position = 4) + @CsvBindByName(column = "最下層区分", required = false) + private Integer isBottomLayer; + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public ProductCategoryDownloadCSV(String productCategoryCode, String productCategoryName, Integer productCategoryLevel, String productCategoryPath, Integer isBottomLayer) { + this.productCategoryCode = productCategoryCode; + this.productCategoryName = productCategoryName; + this.productCategoryLevel = productCategoryLevel; + this.productCategoryPath = productCategoryPath; + this.isBottomLayer = isBottomLayer; + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductDownloadCSV.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductDownloadCSV.java new file mode 100644 index 00000000..dca355d4 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/download/ProductDownloadCSV.java @@ -0,0 +1,102 @@ +package com.example.sms.infrastructure.datasource.system.download; + +import com.opencsv.bean.CsvBindByPosition; +import com.opencsv.bean.CsvBindByName; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@Data +public class ProductDownloadCSV { + + @CsvBindByPosition(position = 0) + @CsvBindByName(column = "商品コード", required = true) + private String productCode; + + @CsvBindByPosition(position = 1) + @CsvBindByName(column = "商品正式名", required = true) + private String productFormalName; + + @CsvBindByPosition(position = 2) + @CsvBindByName(column = "商品略称", required = false) + private String productAbbreviation; + + @CsvBindByPosition(position = 3) + @CsvBindByName(column = "商品名カナ", required = false) + private String productNameKana; + + @CsvBindByPosition(position = 4) + @CsvBindByName(column = "商品区分", required = false) + private String productCategory; + + @CsvBindByPosition(position = 5) + @CsvBindByName(column = "製品型番", required = false) + private String productModelNumber; + + @CsvBindByPosition(position = 6) + @CsvBindByName(column = "販売単価", required = false) + private Integer salesPrice; + + @CsvBindByPosition(position = 7) + @CsvBindByName(column = "仕入単価", required = false) + private Integer purchasePrice; + + @CsvBindByPosition(position = 8) + @CsvBindByName(column = "売上原価", required = false) + private Integer costOfGoodsSold; + + @CsvBindByPosition(position = 9) + @CsvBindByName(column = "税区分", required = false) + private Integer taxCategory; + + @CsvBindByPosition(position = 10) + @CsvBindByName(column = "商品分類コード", required = false) + private String productCategoryCode; + + @CsvBindByPosition(position = 11) + @CsvBindByName(column = "雑区分", required = false) + private Integer miscellaneousCategory; + + @CsvBindByPosition(position = 12) + @CsvBindByName(column = "在庫管理対象区分", required = false) + private Integer inventoryManagementCategory; + + @CsvBindByPosition(position = 13) + @CsvBindByName(column = "在庫引当区分", required = false) + private Integer inventoryAllocationCategory; + + @CsvBindByPosition(position = 14) + @CsvBindByName(column = "仕入先コード", required = false) + private String supplierCode; + + @CsvBindByPosition(position = 15) + @CsvBindByName(column = "仕入先枝番", required = false) + private Integer supplierBranchNumber; + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public ProductDownloadCSV(String productCode, String productFormalName, String productAbbreviation, String productNameKana, + String productCategory, String productModelNumber, Integer salesPrice, Integer purchasePrice, + Integer costOfGoodsSold, Integer taxCategory, String productCategoryCode, + Integer miscellaneousCategory, Integer inventoryManagementCategory, Integer inventoryAllocationCategory, + String supplierCode, Integer supplierBranchNumber) { + this.productCode = productCode; + this.productFormalName = productFormalName; + this.productAbbreviation = productAbbreviation; + this.productNameKana = productNameKana; + this.productCategory = productCategory; + this.productModelNumber = productModelNumber; + this.salesPrice = salesPrice; + this.purchasePrice = purchasePrice; + this.costOfGoodsSold = costOfGoodsSold; + this.taxCategory = taxCategory; + this.productCategoryCode = productCategoryCode; + this.miscellaneousCategory = miscellaneousCategory; + this.inventoryManagementCategory = inventoryManagementCategory; + this.inventoryAllocationCategory = inventoryAllocationCategory; + this.supplierCode = supplierCode; + this.supplierBranchNumber = supplierBranchNumber; + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/package-info.java diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java similarity index 71% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java index be2bc7f3..23ee4b7f 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserDataSource.java @@ -3,6 +3,8 @@ import com.example.sms.domain.model.system.user.User; import com.example.sms.domain.model.system.user.UserList; import com.example.sms.infrastructure.PageInfoHelper; +import com.example.sms.infrastructure.datasource.autogen.mapper.UsrMapper; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; import com.example.sms.service.system.user.UserRepository; import com.github.pagehelper.PageInfo; import org.springframework.stereotype.Repository; @@ -13,35 +15,38 @@ @Repository public class UserDataSource implements UserRepository { final UsrMapper userMapper; + final UsrCustomMapper userCustomMapper; final UserEntityMapper userEntityMapper; - public UserDataSource(UsrMapper userMapper, UserEntityMapper userEntityMapper) { + public UserDataSource(UsrMapper userMapper, UsrCustomMapper userCustomMapper, UserEntityMapper userEntityMapper) { this.userMapper = userMapper; + this.userCustomMapper = userCustomMapper; this.userEntityMapper = userEntityMapper; } @Override public Optional findById(String userId) { Optional userEntity = Optional.ofNullable(userMapper.selectByPrimaryKey(userId)); - return userEntity.map(userEntityMapper::mapToDomainModel); + return userEntity.map(userEntityMapper::mapToDomainEntity); } @Override public UserList selectAll() { - List userEntities = userMapper.selectAll(); + List userEntities = userCustomMapper.selectAll(); return new UserList(userEntities.stream() - .map(userEntityMapper::mapToDomainModel) + .map(userEntityMapper::mapToDomainEntity) .toList()); } @Override public PageInfo selectAllWithPageInfo() { - List userEntities = userMapper.selectAll(); + List userEntities = userCustomMapper.selectAll(); PageInfo pageInfo = new PageInfo<>(userEntities); - return PageInfoHelper.of(pageInfo, userEntityMapper::mapToDomainModel); + return PageInfoHelper.of(pageInfo, userEntityMapper::mapToDomainEntity); } + @Override public void save(User user) { Usr userEntity = userEntityMapper.mapToEntity(user); @@ -59,6 +64,6 @@ public void deleteById(String userId) { @Override public void deleteAll() { - userMapper.deleteAll(); + userCustomMapper.deleteAll(); } } diff --git a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java similarity index 87% rename from api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java index 6908728c..41d68e26 100644 --- a/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UserEntityMapper.java @@ -2,11 +2,12 @@ import com.example.sms.domain.model.system.user.User; import com.example.sms.domain.type.user.RoleName; +import com.example.sms.infrastructure.datasource.autogen.model.Usr; import org.springframework.stereotype.Component; @Component public class UserEntityMapper { - public User mapToDomainModel(Usr userEntity) { + public User mapToDomainEntity(Usr userEntity) { return User.of( userEntity.getUserId(), userEntity.getPassword(), diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.java new file mode 100644 index 00000000..56210b9c --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.java @@ -0,0 +1,15 @@ +package com.example.sms.infrastructure.datasource.system.user; + +import com.example.sms.infrastructure.datasource.autogen.model.Usr; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +@Mapper +public interface UsrCustomMapper { + List selectAll(); + + @Select("DELETE FROM system.usr") + void deleteAll(); +} diff --git a/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.xml b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.xml new file mode 100644 index 00000000..27e60bb0 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/infrastructure/datasource/system/user/UsrCustomMapper.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/api/src/main/java/com/example/sms/infrastructure/package-info.java b/app/backend/api/src/main/java/com/example/sms/infrastructure/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/infrastructure/package-info.java rename to app/backend/api/src/main/java/com/example/sms/infrastructure/package-info.java diff --git a/api/src/main/java/com/example/sms/presentation/Message.java b/app/backend/api/src/main/java/com/example/sms/presentation/Message.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/Message.java rename to app/backend/api/src/main/java/com/example/sms/presentation/Message.java diff --git a/api/src/main/java/com/example/sms/presentation/PageNation.java b/app/backend/api/src/main/java/com/example/sms/presentation/PageNation.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/PageNation.java rename to app/backend/api/src/main/java/com/example/sms/presentation/PageNation.java diff --git a/api/src/main/java/com/example/sms/presentation/api/TestController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/TestController.java similarity index 96% rename from api/src/main/java/com/example/sms/presentation/api/TestController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/TestController.java index be1ac2ed..a0710e6b 100644 --- a/api/src/main/java/com/example/sms/presentation/api/TestController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/TestController.java @@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/test") @Tag(name = "JWTTest", description = "JWT認証テスト") diff --git a/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java similarity index 81% rename from api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java index 04b3bd2e..3439d237 100644 --- a/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentApiController.java @@ -4,11 +4,15 @@ import com.example.sms.domain.model.master.department.DepartmentId; import com.example.sms.domain.model.master.department.DepartmentList; import com.example.sms.domain.model.master.employee.Employee; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; import com.example.sms.presentation.Message; import com.example.sms.presentation.PageNation; import com.example.sms.presentation.api.master.employee.EmployeeResource; import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.master.department.DepartmentCriteria; import com.example.sms.service.master.department.DepartmentService; +import com.example.sms.service.system.audit.AuditAnnotation; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -26,7 +30,6 @@ /** * 部門API */ -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/departments") @Tag(name = "Department", description = "部門") @@ -70,6 +73,7 @@ public ResponseEntity find(@PathVariable String departmentCode, @PathVariable @Operation(summary = "部門を登録する", description = "部門を登録する") @PostMapping + @AuditAnnotation(process = ApplicationExecutionProcessType.部門登録, type = ApplicationExecutionHistoryType.同期) public ResponseEntity create(@RequestBody @Validated DepartmentResource resource) { try { DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; @@ -95,6 +99,7 @@ public ResponseEntity create(@RequestBody @Validated DepartmentResource resou @Operation(summary = "部門を更新する", description = "部門を更新する") @PutMapping("/{departmentCode}/{departmentStartDate}") + @AuditAnnotation(process = ApplicationExecutionProcessType.部門更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity update(@PathVariable String departmentCode, @PathVariable String departmentStartDate, @RequestBody DepartmentResource departmentResource) { try { DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; @@ -120,6 +125,7 @@ public ResponseEntity update(@PathVariable String departmentCode, @PathVariab @Operation(summary = "部門を削除する", description = "部門を削除する") @DeleteMapping("/{departmentCode}/{departmentStartDate}") + @AuditAnnotation(process = ApplicationExecutionProcessType.部門削除, type = ApplicationExecutionHistoryType.同期) public ResponseEntity delete(@PathVariable String departmentCode, @PathVariable String departmentStartDate) { try { DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; @@ -135,6 +141,28 @@ public ResponseEntity delete(@PathVariable String departmentCode, @PathVariab } } + @Operation(summary = "部門を検索する", description = "部門を検索する") + @PostMapping("/search") + public ResponseEntity search( + @RequestBody DepartmentCriteriaResource resource, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; + PageNation.startPage(page, pageSize); + DepartmentCriteria criteria = DepartmentCriteria.builder() + .departmentCode(resource.getDepartmentCode()) + .departmentName(resource.getDepartmentName()) + .startDate(resource.getStartDate() != null ? LocalDateTime.parse(resource.getStartDate(), formatter) : null) + .endDate(resource.getEndDate() != null ? LocalDateTime.parse(resource.getEndDate(), formatter) : null) + .build(); + PageInfo result = departmentManagementService.searchWithPageInfo(criteria); + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + private static List getAddFilteredEmployees(DepartmentResource departmentResource) { return departmentResource.getEmployees() == null ? Collections.emptyList() : departmentResource.getEmployees().stream() @@ -147,7 +175,7 @@ private static List getAddFilteredEmployees(DepartmentResource departm employeeResource.getFax(), employeeResource.getOccuCode() )) - .collect(Collectors.toList()); + .toList(); } private static List getDeleteFilteredEmployees(DepartmentResource departmentResource) { @@ -162,7 +190,7 @@ private static List getDeleteFilteredEmployees(DepartmentResource depa employeeResource.getFax(), employeeResource.getOccuCode() )) - .collect(Collectors.toList()); + .toList(); } } diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentCriteriaResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentCriteriaResource.java new file mode 100644 index 00000000..b55884e4 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentCriteriaResource.java @@ -0,0 +1,21 @@ +package com.example.sms.presentation.api.master.department; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Setter +@Getter +@Schema(description = "部門検索条件") +public class DepartmentCriteriaResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + private String departmentName; + private String departmentCode; + private String startDate; + private String endDate; +} diff --git a/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentResource.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentResource.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/department/DepartmentResource.java diff --git a/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java similarity index 79% rename from api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java index 9af6ffb6..4e582cb2 100644 --- a/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeApiController.java @@ -6,11 +6,15 @@ import com.example.sms.domain.model.master.employee.EmployeeCode; import com.example.sms.domain.model.system.user.User; import com.example.sms.domain.model.system.user.UserId; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; import com.example.sms.presentation.Message; import com.example.sms.presentation.PageNation; import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; import com.example.sms.service.master.department.DepartmentService; +import com.example.sms.service.master.employee.EmployeeCriteria; import com.example.sms.service.master.employee.EmployeeService; +import com.example.sms.service.system.audit.AuditAnnotation; import com.example.sms.service.system.user.UserManagementService; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; @@ -27,7 +31,6 @@ /** * 社員API */ -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/employees") @Tag(name = "Employee", description = "社員") @@ -74,6 +77,7 @@ public ResponseEntity find(@PathVariable String employeeCode) { @Operation(summary = "社員を登録する", description = "社員を登録する") @PostMapping + @AuditAnnotation(process = ApplicationExecutionProcessType.社員更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity create(@RequestBody @Validated EmployeeResource resource) { try { DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; @@ -94,6 +98,7 @@ public ResponseEntity create(@RequestBody @Validated EmployeeResource resourc @Operation(summary = "社員を更新する", description = "社員を更新する") @PutMapping("/{employeeCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.社員更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity update(@PathVariable String employeeCode, @RequestBody EmployeeResource resource) { try { DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; @@ -111,6 +116,7 @@ public ResponseEntity update(@PathVariable String employeeCode, @RequestBody @Operation(summary = "社員を削除する", description = "社員を削除する") @DeleteMapping("/{employeeCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.社員削除, type = ApplicationExecutionHistoryType.同期) public ResponseEntity delete(@PathVariable String employeeCode) { try { EmployeeCode code = EmployeeCode.of(employeeCode); @@ -125,6 +131,31 @@ public ResponseEntity delete(@PathVariable String employeeCode) { } } + @Operation(summary = "社員を検索する", description = "社員を検索する") + @PostMapping("/search") + public ResponseEntity search( + @RequestBody EmployeeCriteriaResource resource, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + PageNation.startPage(page, pageSize); + EmployeeCriteria criteria = EmployeeCriteria.builder() + .employeeCode(resource.getEmployeeCode()) + .employeeFirstName(resource.getEmployeeFirstName()) + .employeeLastName(resource.getEmployeeLastName()) + .employeeFirstNameKana(resource.getEmployeeFirstNameKana()) + .employeeLastNameKana(resource.getEmployeeLastNameKana()) + .phoneNumber(resource.getPhoneNumber()) + .faxNumber(resource.getFaxNumber()) + .departmentCode(resource.getDepartmentCode()) + .build(); + PageInfo result = employeeManagementService.searchWithPageInfo(criteria); + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + private Employee createEmployee(EmployeeResource resource) { return createEmployee(resource.getEmpCode(), resource); } diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeCriteriaResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeCriteriaResource.java new file mode 100644 index 00000000..40b93971 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeCriteriaResource.java @@ -0,0 +1,25 @@ +package com.example.sms.presentation.api.master.employee; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Setter +@Getter +@Schema(description = "社員検索条件") +public class EmployeeCriteriaResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + private String employeeCode; + private String employeeFirstName; + private String employeeLastName; + private String employeeFirstNameKana; + private String employeeLastNameKana; + private String phoneNumber; + private String faxNumber; + private String departmentCode; +} diff --git a/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeResource.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeResource.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/employee/EmployeeResource.java diff --git a/api/src/main/java/com/example/sms/presentation/api/master/package-info.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/master/package-info.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/package-info.java diff --git a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java similarity index 68% rename from api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java index 12812430..0cab57be 100644 --- a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductApiController.java @@ -1,21 +1,28 @@ package com.example.sms.presentation.api.master.product; import com.example.sms.domain.model.master.product.Product; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import com.example.sms.domain.type.product.*; import com.example.sms.presentation.Message; import com.example.sms.presentation.PageNation; import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.master.product.ProductCriteria; import com.example.sms.service.master.product.ProductService; +import com.example.sms.service.system.audit.AuditAnnotation; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.persistence.criteria.CriteriaBuilder; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.util.function.Function; + /** * 商品API */ -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/products") @Tag(name = "Product", description = "商品") @@ -71,6 +78,7 @@ public ResponseEntity select(@PathVariable String productCode) { @Operation(summary = "商品を登録する") @PostMapping + @AuditAnnotation(process = ApplicationExecutionProcessType.商品登録, type = ApplicationExecutionHistoryType.同期) public ResponseEntity create(@RequestBody ProductResource productResource) { try { Product product = createProduct(productResource.getProductCode(), productResource); @@ -86,6 +94,7 @@ public ResponseEntity create(@RequestBody ProductResource productResource) { @Operation(summary = "商品を更新する") @PutMapping("/{productCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.商品更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity update(@PathVariable String productCode, @RequestBody ProductResource productResource) { try { Product product = createProduct(productCode, productResource); @@ -101,6 +110,7 @@ public ResponseEntity update(@PathVariable String productCode, @RequestBody P @Operation(summary = "商品を削除する") @DeleteMapping("/{productCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.商品削除, type = ApplicationExecutionHistoryType.同期) public ResponseEntity delete(@PathVariable String productCode) { try { Product product = productService.find(productCode); @@ -114,6 +124,44 @@ public ResponseEntity delete(@PathVariable String productCode) { } } + @Operation(summary = "商品を検索する") + @PostMapping("/search") + public ResponseEntity search( + @RequestBody ProductCriteriaResource resource, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + PageNation.startPage(page, pageSize); + + ProductCriteria criteria = convertToCriteria(resource); + PageInfo result = productService.searchProductWithPageInfo(criteria); + + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + + private ProductCriteria convertToCriteria(ProductCriteriaResource resource) { + return ProductCriteria.builder() + .productCode(resource.getProductCode()) + .productNameFormal(resource.getProductNameFormal()) + .productNameAbbreviation(resource.getProductNameAbbreviation()) + .productNameKana(resource.getProductNameKana()) + .productCategoryCode(resource.getProductCategoryCode()) + .supplierCode(resource.getSupplierCode()) + .productType(mapStringToCode(resource.getProductType(), ProductType::getCodeByName)) + .taxType(mapStringToCode(resource.getTaxType(), TaxType::getCodeByName)) + .miscellaneousType(mapStringToCode(resource.getMiscellaneousType(), MiscellaneousType::getCodeByName)) + .stockManagementTargetType(mapStringToCode(resource.getStockManagementTargetType(), StockManagementTargetType::getCodeByName)) + .stockAllocationType(mapStringToCode(resource.getStockAllocationType(), StockAllocationType::getCodeByName)) + .build(); + } + + private T mapStringToCode(String value, Function mapper) { + return value != null ? mapper.apply(value) : null; + } + private static Product createProduct(String productResource, ProductResource productResource1) { Product product = Product.of( productResource, diff --git a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java similarity index 82% rename from api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java index eddf9754..c3669db3 100644 --- a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryApiController.java @@ -2,10 +2,14 @@ import com.example.sms.domain.model.master.product.Product; import com.example.sms.domain.model.master.product.ProductCategory; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; import com.example.sms.presentation.Message; import com.example.sms.presentation.PageNation; import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.master.product.ProductCategoryCriteria; import com.example.sms.service.master.product.ProductService; +import com.example.sms.service.system.audit.AuditAnnotation; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -15,12 +19,10 @@ import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; /** * 商品分類API */ -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/product/categories") @Tag(name = "ProductCategory", description = "商品分類") @@ -62,6 +64,7 @@ public ResponseEntity select(@PathVariable String productCategoryCode) { @Operation(summary = "商品分類を登録する") @PostMapping + @AuditAnnotation(process = ApplicationExecutionProcessType.商品分類登録, type = ApplicationExecutionHistoryType.同期) public ResponseEntity create(@RequestBody ProductCategoryResource productCategoryResource) { try { ProductCategory productCategory = ProductCategory.of(productCategoryResource.getProductCategoryCode(), productCategoryResource.getProductCategoryName(), productCategoryResource.getProductCategoryHierarchy(), productCategoryResource.getProductCategoryPath(), productCategoryResource.getLowestLevelDivision()); @@ -77,6 +80,7 @@ public ResponseEntity create(@RequestBody ProductCategoryResource productCate @Operation(summary = "商品分類を更新する") @PutMapping("/{productCategoryCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.商品分類更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity update(@PathVariable String productCategoryCode, @RequestBody ProductCategoryResource productCategoryResource) { try { ProductCategory productCategory = ProductCategory.of(productCategoryCode, productCategoryResource.getProductCategoryName(), productCategoryResource.getProductCategoryHierarchy(), productCategoryResource.getProductCategoryPath(), productCategoryResource.getLowestLevelDivision()); @@ -94,6 +98,7 @@ public ResponseEntity update(@PathVariable String productCategoryCode, @Reque @Operation(summary = "商品分類を削除する") @DeleteMapping("/{productCategoryCode}") + @AuditAnnotation(process = ApplicationExecutionProcessType.商品分類削除, type = ApplicationExecutionHistoryType.同期) public ResponseEntity delete(@PathVariable String productCategoryCode) { try { ProductCategory productCategory = productService.findCategory(productCategoryCode); @@ -107,6 +112,25 @@ public ResponseEntity delete(@PathVariable String productCategoryCode) { } } + @Operation(summary = "商品分類を検索する") + @PostMapping("/search") + public ResponseEntity search( + @RequestBody ProductCategoryCriteriaResource resource, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder() + .productCategoryCode(resource.getProductCategoryCode()) + .productCategoryName(resource.getProductCategoryName()) + .productCategoryPath(resource.getProductCategoryPath()) + .build(); + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + private static List getAddFilteredProducts(ProductCategoryResource productCategoryResource) { return productCategoryResource.getProducts() == null ? Collections.emptyList() : productCategoryResource.getProducts().stream() @@ -128,7 +152,7 @@ private static List getAddFilteredProducts(ProductCategoryResource prod resource.getSupplierCode(), resource.getSupplierBranchNumber() )) - .collect(Collectors.toList()); + .toList(); } private static List getDeleteFilteredProducts(ProductCategoryResource productCategoryResource) { @@ -152,7 +176,7 @@ private static List getDeleteFilteredProducts(ProductCategoryResource p resource.getSupplierCode(), resource.getSupplierBranchNumber() )) - .collect(Collectors.toList()); + .toList(); } } diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryCriteriaResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryCriteriaResource.java new file mode 100644 index 00000000..b6c31af3 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryCriteriaResource.java @@ -0,0 +1,20 @@ +package com.example.sms.presentation.api.master.product; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Setter +@Getter +@Schema(description = "商品分類検索条件") +public class ProductCategoryCriteriaResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + String productCategoryCode; + String productCategoryName; + String productCategoryPath; +} diff --git a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryResource.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryResource.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCategoryResource.java diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCriteriaResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCriteriaResource.java new file mode 100644 index 00000000..60e5ec39 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductCriteriaResource.java @@ -0,0 +1,28 @@ +package com.example.sms.presentation.api.master.product; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Setter +@Getter +@Schema(description = "商品検索条件") +public class ProductCriteriaResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + String productCode; + String productNameFormal; + String productNameAbbreviation; + String productNameKana; + String productCategoryCode; + String supplierCode; + String productType; + String taxType; + String miscellaneousType; + String stockManagementTargetType; + String stockAllocationType; +} diff --git a/api/src/main/java/com/example/sms/presentation/api/master/product/ProductResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductResource.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/master/product/ProductResource.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/master/product/ProductResource.java diff --git a/api/src/main/java/com/example/sms/presentation/api/package-info.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/package-info.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditApiController.java new file mode 100644 index 00000000..1bc6aa91 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditApiController.java @@ -0,0 +1,86 @@ +package com.example.sms.presentation.api.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.presentation.Message; +import com.example.sms.presentation.PageNation; +import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.system.audit.AuditCriteria; +import com.example.sms.service.system.audit.AuditService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +/** + * 監査API + */ +@RestController +@RequestMapping("/api/audits") +@Tag(name = "Audit", description = "監査") +public class AuditApiController { + final AuditService auditService; + + final Message message; + + public AuditApiController(AuditService auditService, Message message) { + this.auditService = auditService; + this.message = message; + } + + @Operation(summary = "アプリケーション実行履歴一覧を取得する", description = "アプリケーション実行履歴一覧を取得する") + @GetMapping + public ResponseEntity select( + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + PageNation.startPage(page, pageSize); + PageInfo result = auditService.selectAllWithPageInfo(); + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + + @PreAuthorize("hasRole('ADMIN')") + @Operation(summary = "アプリケーション実行履歴を取得する", description = "アプリケーション実行履歴を取得する") + @GetMapping("/{id}") + public ResponseEntity find(@PathVariable String id) { + try { + ApplicationExecutionHistory applicationExecutionHistory = auditService.find(id); + return ResponseEntity.ok(applicationExecutionHistory); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + + @PreAuthorize("hasRole('ADMIN')") + @Operation(summary = "アプリケーション実行履歴を削除する", description = "アプリケーション実行履歴を削除する") + @DeleteMapping("/{id}") + public ResponseEntity delete(@PathVariable String id) { + try { + auditService.delete(Integer.valueOf(id)); + return ResponseEntity.ok(new MessageResponse(message.getMessage("success.audit.history.deleted"))); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + + @Operation(summary = "アプリケーション実行履歴を検索する", description = "アプリケーション実行履歴を検索する") + @PostMapping("/search") + public ResponseEntity search( + @RequestBody AuditCriteriaResource resource, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, + @RequestParam(value = "page", defaultValue = "1") int... page) { + try { + PageNation.startPage(page, pageSize); + AuditCriteria criteria = AuditCriteria.of(resource.getProcess().getProcessType(), resource.getType(), resource.getProcessFlag()); + PageInfo result = auditService.searchWithPageInfo(criteria); + return ResponseEntity.ok(result); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } +} + diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditCriteriaResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditCriteriaResource.java new file mode 100644 index 00000000..713c8285 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditCriteriaResource.java @@ -0,0 +1,23 @@ +package com.example.sms.presentation.api.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionProcess; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Setter +@Getter +@Schema(description = "監査検索条件") +public class AuditCriteriaResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + ApplicationExecutionProcess process; + ApplicationExecutionHistoryType type; + ApplicationExecutionProcessFlag processFlag; +} diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditResource.java new file mode 100644 index 00000000..3fbde6d8 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/audit/AuditResource.java @@ -0,0 +1,28 @@ +package com.example.sms.presentation.api.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionProcess; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Setter +@Getter +@Schema(description = "監査") +public class AuditResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + Integer id; + ApplicationExecutionProcess process; + ApplicationExecutionHistoryType type; + LocalDateTime processStart; + LocalDateTime processEnd; + ApplicationExecutionProcessFlag processFlag; + String processDetails; +} diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java similarity index 98% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java index 388048f6..599e612d 100644 --- a/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthApiController.java @@ -20,6 +20,7 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.csrf.CsrfToken; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -27,7 +28,6 @@ /** * 認証API */ -@CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/auth") @Tag(name = "JWTAuth", description = "JWT認証") diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthEntryPointJwt.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthEntryPointJwt.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/AuthEntryPointJwt.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthEntryPointJwt.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthTokenFilter.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthTokenFilter.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/AuthTokenFilter.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/AuthTokenFilter.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/LoginRequest.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/LoginRequest.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/LoginRequest.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/LoginRequest.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/SignupRequest.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/SignupRequest.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/SignupRequest.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/request/SignupRequest.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/JwtResponse.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/JwtResponse.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/JwtResponse.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/JwtResponse.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/MessageResponse.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/MessageResponse.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/MessageResponse.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/auth/payload/response/MessageResponse.java diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadApiController.java new file mode 100644 index 00000000..426a3974 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadApiController.java @@ -0,0 +1,59 @@ +package com.example.sms.presentation.api.system.download; + +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.system.audit.AuditAnnotation; +import com.example.sms.service.system.download.DownloadService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.MessageSource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.io.OutputStreamWriter; + +/** + * データダウンロードAPI + */ +@Slf4j +@RestController +@RequestMapping("/api/downloads") +@Tag(name = "Download", description = "データダウンロード") +public class DownloadApiController { + final DownloadService downloadService; + final MessageSource messageSource; + + public DownloadApiController(DownloadService downloadService, MessageSource messageSource) { + this.downloadService = downloadService; + this.messageSource = messageSource; + } + + @Operation(summary = "ダウンロード件数", description = "ダウンロード件数を取得する") + @PostMapping("/count") + public ResponseEntity count(@RequestBody DownloadConditionResource resource) { + try { + DownloadCriteria condition = DownloadConditionResource.of(resource.getTarget()); + return ResponseEntity.ok(downloadService.count(condition)); + } catch (Exception e) { + return ResponseEntity.badRequest().body(new MessageResponse(e.getMessage())); + } + } + + @Operation(summary = "ダウンロード", description = "ダウンロードする") + @PostMapping("/download") + @AuditAnnotation(process = ApplicationExecutionProcessType.データダウンロード, type = ApplicationExecutionHistoryType.同期) + public void download(@RequestBody DownloadConditionResource resource, HttpServletResponse response) { + DownloadCriteria condition = DownloadConditionResource.of(resource.getTarget()); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + condition.getFileName()); + try (OutputStreamWriter streamWriter = new OutputStreamWriter(response.getOutputStream(), "Windows-31J")) { + downloadService.download(streamWriter, condition); + } catch (Exception e) { + log.error("ダウンロードエラー", e); + } + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadConditionResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadConditionResource.java new file mode 100644 index 00000000..a07accbe --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/download/DownloadConditionResource.java @@ -0,0 +1,32 @@ +package com.example.sms.presentation.api.system.download; + +import com.example.sms.domain.model.system.download.*; +import com.example.sms.domain.type.download.DownloadTarget; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serial; +import java.io.Serializable; + +@Getter +@Setter +@Schema(description = "ダウンロード条件") +public class DownloadConditionResource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + @NotNull + private DownloadTarget target; + private String fileName; + + public static DownloadCriteria of(DownloadTarget target) { + return switch (target) { + case 部門 -> Department.of(); + case 社員 -> Employee.of(); + case 商品分類 -> ProductCategory.of(); + case 商品 -> Product.of(); + }; + } +} diff --git a/api/src/main/java/com/example/sms/presentation/api/system/package-info.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/package-info.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/package-info.java diff --git a/api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java similarity index 86% rename from api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java index 081ed82c..b082e138 100644 --- a/api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java +++ b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/user/UserApiController.java @@ -2,13 +2,18 @@ import com.example.sms.domain.model.system.user.User; import com.example.sms.domain.model.system.user.UserId; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; import com.example.sms.presentation.Message; import com.example.sms.presentation.PageNation; import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.service.system.audit.AuditAnnotation; +import com.example.sms.service.system.audit.AuditService; import com.example.sms.service.system.user.UserManagementService; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.crypto.password.PasswordEncoder; @@ -18,7 +23,7 @@ /** * ユーザーAPI */ -@CrossOrigin(origins = "*", maxAge = 3600) +@Slf4j @RestController @RequestMapping("/api/users") @Tag(name = "User", description = "ユーザー") @@ -28,11 +33,15 @@ public class UserApiController { final UserManagementService userManagementService; + final AuditService auditService; + final Message message; - public UserApiController(PasswordEncoder passwordEncoder, UserManagementService userManagementService, Message message) { + + public UserApiController(PasswordEncoder passwordEncoder, UserManagementService userManagementService, AuditService auditService, Message message) { this.passwordEncoder = passwordEncoder; this.userManagementService = userManagementService; + this.auditService = auditService; this.message = message; } @Operation(summary = "ユーザー一覧を取得する", description = "ユーザー一覧を取得する") @@ -62,6 +71,7 @@ public ResponseEntity find(@PathVariable String userId) { @Operation(summary = "ユーザーを登録する", description = "ユーザーを登録する") @PostMapping + @AuditAnnotation(process = ApplicationExecutionProcessType.ユーザー登録, type = ApplicationExecutionHistoryType.同期) public ResponseEntity create(@RequestBody @Validated UserResource resource) { try { UserId userId = new UserId(resource.getUserId()); @@ -80,6 +90,7 @@ public ResponseEntity create(@RequestBody @Validated UserResource resource) { @Operation(summary = "ユーザーを更新する", description = "ユーザーを更新する") @PutMapping("/{userId}") + @AuditAnnotation(process = ApplicationExecutionProcessType.ユーザー更新, type = ApplicationExecutionHistoryType.同期) public ResponseEntity update(@PathVariable String userId, @RequestBody @Validated UserResource resource) { try { User userOptional = userManagementService.find(new UserId(userId)); @@ -100,6 +111,7 @@ public ResponseEntity update(@PathVariable String userId, @RequestBody @Valid @Operation(summary = "ユーザーを削除する", description = "ユーザーを削除する") @DeleteMapping("/{userId}") + @AuditAnnotation(process = ApplicationExecutionProcessType.ユーザー削除, type = ApplicationExecutionHistoryType.同期) public ResponseEntity delete(@PathVariable String userId) { try { User userOptional = userManagementService.find(new UserId(userId)); diff --git a/api/src/main/java/com/example/sms/presentation/api/system/user/UserResource.java b/app/backend/api/src/main/java/com/example/sms/presentation/api/system/user/UserResource.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/api/system/user/UserResource.java rename to app/backend/api/src/main/java/com/example/sms/presentation/api/system/user/UserResource.java diff --git a/api/src/main/java/com/example/sms/presentation/package-info.java b/app/backend/api/src/main/java/com/example/sms/presentation/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/presentation/package-info.java rename to app/backend/api/src/main/java/com/example/sms/presentation/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentCriteria.java b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentCriteria.java new file mode 100644 index 00000000..07e00315 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentCriteria.java @@ -0,0 +1,39 @@ +package com.example.sms.service.master.department; + +import lombok.Builder; +import lombok.Value; +import lombok.extern.slf4j.Slf4j; + +import java.time.LocalDateTime; + +/** + * 部門検索条件 + */ +@Value +@Builder(builderClassName = "DepartmentCriteriaBuilder") +@Slf4j +public class DepartmentCriteria { + + String departmentName; + String departmentCode; + LocalDateTime startDate; + LocalDateTime endDate; + + private DepartmentCriteria(String departmentName, String departmentCode, LocalDateTime startDate, LocalDateTime endDate) { + if (startDate != null && endDate != null && endDate.isBefore(startDate)) { + String errorMessage = "終了日は開始日より後の日付でなければなりません。"; + log.error(errorMessage); + throw new IllegalArgumentException(errorMessage); + } + this.departmentName = departmentName; + this.departmentCode = departmentCode; + this.startDate = startDate; + this.endDate = endDate; + } + + public static class DepartmentCriteriaBuilder { + public DepartmentCriteria build() { + return new DepartmentCriteria(departmentName, departmentCode, startDate, endDate); + } + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java similarity index 90% rename from api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java index d0ef2f48..d75cf30b 100644 --- a/api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentRepository.java @@ -22,4 +22,5 @@ public interface DepartmentRepository { void deleteAll(); + PageInfo searchWithPageInfo(DepartmentCriteria criteria); } diff --git a/api/src/main/java/com/example/sms/service/master/department/DepartmentService.java b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentService.java similarity index 94% rename from api/src/main/java/com/example/sms/service/master/department/DepartmentService.java rename to app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentService.java index 72f36dd9..1191a50b 100644 --- a/api/src/main/java/com/example/sms/service/master/department/DepartmentService.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/department/DepartmentService.java @@ -94,4 +94,10 @@ public DepartmentList findByCode(DepartmentId departmentId) { return departmentRepository.findByCode(departmentId.getDeptCode().getValue()); } + /** + * 部門検索 + */ + public PageInfo searchWithPageInfo(DepartmentCriteria criteria) { + return departmentRepository.searchWithPageInfo(criteria); + } } diff --git a/api/src/main/java/com/example/sms/service/master/department/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/master/department/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/master/department/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/master/department/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeCriteria.java b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeCriteria.java new file mode 100644 index 00000000..a098d284 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeCriteria.java @@ -0,0 +1,20 @@ +package com.example.sms.service.master.employee; + +import lombok.Builder; +import lombok.Value; + +/** + * 社員検索条件 + */ +@Value +@Builder +public class EmployeeCriteria { + String employeeCode; + String employeeFirstName; + String employeeLastName; + String employeeFirstNameKana; + String employeeLastNameKana; + String phoneNumber; + String faxNumber; + String departmentCode; +} diff --git a/api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java similarity index 89% rename from api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java index 6e3ba56e..452efb4c 100644 --- a/api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeRepository.java @@ -19,4 +19,6 @@ public interface EmployeeRepository { void deleteById(EmployeeCode empCode); void deleteAll(); + + PageInfo searchWithPageInfo(EmployeeCriteria criteria); } diff --git a/api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java similarity index 88% rename from api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java rename to app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java index b51dd88b..139ff317 100644 --- a/api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/employee/EmployeeService.java @@ -60,4 +60,10 @@ public Employee find(EmployeeCode empCode) { return employeeRepository.findById(empCode).orElse(null); } + /** + * 社員検索(ページング) + */ + public PageInfo searchWithPageInfo(EmployeeCriteria criteria) { + return employeeRepository.searchWithPageInfo(criteria); + } } diff --git a/api/src/main/java/com/example/sms/service/master/employee/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/master/employee/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/master/employee/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/master/employee/package-info.java diff --git a/api/src/main/java/com/example/sms/service/master/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/master/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/master/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/master/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryCriteria.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryCriteria.java new file mode 100644 index 00000000..63b2bd50 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryCriteria.java @@ -0,0 +1,15 @@ +package com.example.sms.service.master.product; + +import lombok.Builder; +import lombok.Value; + +/** + * 商品分類検索条件 + */ +@Value +@Builder +public class ProductCategoryCriteria { + String productCategoryCode; + String productCategoryName; + String productCategoryPath; +} diff --git a/api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java similarity index 87% rename from api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java index 218c3ccf..f5daf88e 100644 --- a/api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCategoryRepository.java @@ -18,4 +18,6 @@ public interface ProductCategoryRepository { void deleteById(ProductCategory productCategory); PageInfo selectAllWithPageInfo(); + + PageInfo searchWithPageInfo(ProductCategoryCriteria criteria); } diff --git a/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCriteria.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCriteria.java new file mode 100644 index 00000000..ffce0ebc --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductCriteria.java @@ -0,0 +1,24 @@ +package com.example.sms.service.master.product; + +import com.example.sms.domain.type.product.*; +import lombok.Builder; +import lombok.Value; + +/** + * 商品検索条件 + */ +@Value +@Builder +public class ProductCriteria { + String productCode; + String productNameFormal; + String productNameAbbreviation; + String productNameKana; + String productCategoryCode; + String supplierCode; + String productType; + Integer taxType; + Integer miscellaneousType; + Integer stockManagementTargetType; + Integer stockAllocationType; +} diff --git a/api/src/main/java/com/example/sms/service/master/product/ProductRepository.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductRepository.java similarity index 88% rename from api/src/main/java/com/example/sms/service/master/product/ProductRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/master/product/ProductRepository.java index ca55f53d..6dc28b45 100644 --- a/api/src/main/java/com/example/sms/service/master/product/ProductRepository.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductRepository.java @@ -20,4 +20,6 @@ public interface ProductRepository { PageInfo selectAllWithPageInfo(); PageInfo selectAllBoms(); + + PageInfo searchWithPageInfo(ProductCriteria criteria); } diff --git a/api/src/main/java/com/example/sms/service/master/product/ProductService.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductService.java similarity index 90% rename from api/src/main/java/com/example/sms/service/master/product/ProductService.java rename to app/backend/api/src/main/java/com/example/sms/service/master/product/ProductService.java index 534222ea..b97fe15d 100644 --- a/api/src/main/java/com/example/sms/service/master/product/ProductService.java +++ b/app/backend/api/src/main/java/com/example/sms/service/master/product/ProductService.java @@ -144,4 +144,17 @@ public void deleteCategory(ProductCategory productCategory) { productCategoryRepository.deleteById(productCategory); } + /** + * 商品分類検索(ページング) + */ + public PageInfo searchProductCategoryWithPageInfo(ProductCategoryCriteria criteria) { + return productCategoryRepository.searchWithPageInfo(criteria); + } + + /** + * 商品検索 (ページング) + */ + public PageInfo searchProductWithPageInfo(ProductCriteria criteria) { + return productRepository.searchWithPageInfo(criteria); + } } diff --git a/api/src/main/java/com/example/sms/service/master/product/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/master/product/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/master/product/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/master/product/package-info.java diff --git a/api/src/main/java/com/example/sms/service/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/package-info.java diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditAnnotation.java b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditAnnotation.java new file mode 100644 index 00000000..ed5e83be --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditAnnotation.java @@ -0,0 +1,16 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface AuditAnnotation { + ApplicationExecutionProcessType process(); + ApplicationExecutionHistoryType type(); +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditCriteria.java b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditCriteria.java new file mode 100644 index 00000000..be084cfa --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditCriteria.java @@ -0,0 +1,28 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import lombok.Builder; +import lombok.Value; + +/** + * 監査検索条件 + */ +@Value +@Builder +public class AuditCriteria { + String processName; + String processCode; + String processType; + Integer processFlag; + + public static AuditCriteria of(ApplicationExecutionProcessType process, ApplicationExecutionHistoryType type, ApplicationExecutionProcessFlag processFlag) { + return AuditCriteria.builder() + .processName(process != null ? process.getName() : null) + .processCode(process != null ? process.getCode() : null) + .processType(type != null ? type.getName() : null) + .processFlag(processFlag != null ? processFlag.getValue() : null) + .build(); + } +} \ No newline at end of file diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditRepository.java new file mode 100644 index 00000000..53fb42b3 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditRepository.java @@ -0,0 +1,28 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistoryList; +import com.github.pagehelper.PageInfo; + +import java.util.Optional; + +/** + * 監査リポジトリ + */ +public interface AuditRepository { + void deleteAll(); + + void save(ApplicationExecutionHistory history); + + ApplicationExecutionHistoryList selectAll(); + + Optional findById(Integer id); + + void deleteById(Integer id); + + PageInfo selectAllWithPageInfo(); + + ApplicationExecutionHistory start(ApplicationExecutionHistory history); + + PageInfo searchWithPageInfo(AuditCriteria criteria); +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditService.java b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditService.java new file mode 100644 index 00000000..b7837c6f --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditService.java @@ -0,0 +1,108 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistoryList; +import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.model.system.user.UserId; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import com.example.sms.service.system.auth.AuthApiService; +import com.example.sms.service.system.user.UserRepository; +import com.github.pagehelper.PageInfo; +import jakarta.transaction.Transactional; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +/** + * 監査サービス + */ +@Service +@Transactional +public class AuditService { + final AuditRepository auditRepository; + final UserRepository userRepository; + + public AuditService(AuditRepository auditRepository, UserRepository userRepository) { + this.auditRepository = auditRepository; + this.userRepository = userRepository; + } + + /** + * アプリケーション実行履歴一覧 + */ + public ApplicationExecutionHistoryList selectAll() { + return auditRepository.selectAll(); + } + + /** + * アプリケーション実行履歴一覧(ページング) + */ + public PageInfo selectAllWithPageInfo() { + return auditRepository.selectAllWithPageInfo(); + } + + /** + * アプリケーション実行履歴新規登録 + */ + public void register(ApplicationExecutionHistory applicationExecutionHistory, UserId userId) { + User user = userRepository.findById(userId.Value()).orElse(null); + ApplicationExecutionHistory newApplicationExecutionHistory = ApplicationExecutionHistory.of(applicationExecutionHistory.getId(), applicationExecutionHistory.getProcess().getName(), applicationExecutionHistory.getProcess().getCode(), applicationExecutionHistory.getType(), applicationExecutionHistory.getProcessStart(), applicationExecutionHistory.getProcessEnd(), applicationExecutionHistory.getProcessFlag(), applicationExecutionHistory.getProcessDetails(), user); + auditRepository.save(newApplicationExecutionHistory); + } + + /** + * アプリケーション実行履歴削除 + */ + public void delete(Integer id) { + auditRepository.deleteById(id); + } + + /** + * アプリケーション実行履歴取得 + */ + public ApplicationExecutionHistory find(String applicationExecutionHistoryId) { + return auditRepository.findById(Integer.valueOf(applicationExecutionHistoryId)).orElse(null); + } + + /** + * アプリケーション実行履歴開始 + */ + public ApplicationExecutionHistory start(ApplicationExecutionProcessType process, ApplicationExecutionHistoryType type) { + String userId = AuthApiService.getCurrentUserId().Value(); + User user = userRepository.findById(userId).orElse(null); + LocalDateTime processStart = LocalDateTime.now(); + ApplicationExecutionHistory history = ApplicationExecutionHistory.of(null, process.getName(), process.getCode(), type, processStart, null, ApplicationExecutionProcessFlag.実行中, null, user); + return auditRepository.start(history); + } + + /** + * アプリケーション実行履歴終了 + */ + public ApplicationExecutionHistory end(ApplicationExecutionHistory history) { + LocalDateTime processEnd = LocalDateTime.now(); + ApplicationExecutionHistory startHistory = find(String.valueOf(history.getId())); + ApplicationExecutionHistory endHistory = ApplicationExecutionHistory.of(history.getId(), startHistory.getProcess().getName(), startHistory.getProcess().getCode(), startHistory.getType(), startHistory.getProcessStart(), processEnd, ApplicationExecutionProcessFlag.実行済, startHistory.getProcessDetails(), startHistory.getUser()); + auditRepository.save(endHistory); + return endHistory; + } + + /** + * アプリケーション実行履歴エラー + */ + public ApplicationExecutionHistory error(ApplicationExecutionHistory history, String message) { + LocalDateTime processEnd = LocalDateTime.now(); + ApplicationExecutionHistory startHistory = find(String.valueOf(history.getId())); + ApplicationExecutionHistory endHistory = ApplicationExecutionHistory.of(history.getId(), startHistory.getProcess().getName(), startHistory.getProcess().getCode(), startHistory.getType(), startHistory.getProcessStart(), processEnd, ApplicationExecutionProcessFlag.エラー, message, startHistory.getUser()); + auditRepository.save(endHistory); + return endHistory; + } + + /** + * アプリケーション実行履歴検索 + */ + public PageInfo searchWithPageInfo(AuditCriteria criteria) { + return auditRepository.searchWithPageInfo(criteria); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditServiceAspect.java b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditServiceAspect.java new file mode 100644 index 00000000..21b4cb8c --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/audit/AuditServiceAspect.java @@ -0,0 +1,41 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@Aspect +@Component +public class AuditServiceAspect { + private final AuditService auditService; + + @Autowired + public AuditServiceAspect(AuditService auditService) { + this.auditService = auditService; + } + + @Around("@annotation(auditAnnotation)") + public Object handleAuditAspect(ProceedingJoinPoint joinPoint, AuditAnnotation auditAnnotation) throws Throwable { + ApplicationExecutionProcessType process = ApplicationExecutionProcessType.fromNameAndCode(auditAnnotation.process().getName(), auditAnnotation.process().getCode()); + ApplicationExecutionHistoryType type = ApplicationExecutionHistoryType.fromName(auditAnnotation.type().getName()); + ApplicationExecutionHistory audit = auditService.start(process, type); + log.info("{}:{}を開始しました", audit.getProcessStart(), process.getName()); + try { + Object result = joinPoint.proceed(); + audit = auditService.end(audit); + log.info("{}:{}を終了しました", audit.getProcessEnd(), process.getName()); + return result; + } catch (Throwable e) { + auditService.error(audit, e.getMessage()); + log.error("{}:{}でエラーが発生しました", audit.getProcessEnd(), process.getName()); + throw e; + } + } +} diff --git a/api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java b/app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java similarity index 79% rename from api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java rename to app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java index 7efa4f97..514fb100 100644 --- a/api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java +++ b/app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthApiService.java @@ -2,6 +2,7 @@ import com.example.sms.domain.model.system.auth.AuthUserDetails; import com.example.sms.domain.model.system.user.UserId; +import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -67,4 +68,18 @@ public static UserId getCurrentUserId() { throw new UsernameNotFoundException("User details not found"); } } + + /** + * 権限チェック + */ + public static void checkPermission(String requiredRole) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + boolean hasPermission = authentication.getAuthorities().stream() + .anyMatch(authority -> authority.getAuthority().equals(requiredRole)); + + if (!hasPermission) { + throw new AccessDeniedException("権限がありません"); + } + } } diff --git a/api/src/main/java/com/example/sms/service/system/auth/AuthRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthRepository.java similarity index 100% rename from api/src/main/java/com/example/sms/service/system/auth/AuthRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthRepository.java diff --git a/api/src/main/java/com/example/sms/service/system/auth/AuthService.java b/app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthService.java similarity index 100% rename from api/src/main/java/com/example/sms/service/system/auth/AuthService.java rename to app/backend/api/src/main/java/com/example/sms/service/system/auth/AuthService.java diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/download/DepartmentCSVRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/download/DepartmentCSVRepository.java new file mode 100644 index 00000000..bffd3b70 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/download/DepartmentCSVRepository.java @@ -0,0 +1,15 @@ +package com.example.sms.service.system.download; + +import com.example.sms.domain.model.master.department.DepartmentList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.system.download.DepartmentDownloadCSV; + +import java.util.List; + +public interface DepartmentCSVRepository { + List convert(DepartmentList departmentList); + + int countBy(DownloadCriteria condition); + + DepartmentList selectBy(DownloadCriteria condition); +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/download/DownloadService.java b/app/backend/api/src/main/java/com/example/sms/service/system/download/DownloadService.java new file mode 100644 index 00000000..f1988635 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/download/DownloadService.java @@ -0,0 +1,144 @@ +package com.example.sms.service.system.download; + +import com.example.sms.domain.model.master.department.DepartmentList; +import com.example.sms.domain.model.master.employee.EmployeeList; +import com.example.sms.domain.model.master.product.ProductCategoryList; +import com.example.sms.domain.model.master.product.ProductList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.system.download.DepartmentDownloadCSV; +import com.example.sms.infrastructure.datasource.system.download.EmployeeDownloadCSV; +import com.example.sms.infrastructure.datasource.system.download.ProductCategoryDownloadCSV; +import com.example.sms.infrastructure.datasource.system.download.ProductDownloadCSV; +import org.springframework.stereotype.Service; + +import java.io.OutputStreamWriter; +import java.util.List; + +import static com.example.sms.infrastructure.Pattern2WriteCSVUtil.writeCsv; +import static com.example.sms.service.system.auth.AuthApiService.checkPermission; + +/** + * データダウンロードサービス + */ +@Service +public class DownloadService { + private final DepartmentCSVRepository departmentCSVRepository; + private final EmployeeCSVRepository employeeCSVRepository; + private final ProductCategoryCSVRepository productCategoryCSVRepository; + private final ProductCSVRepository productCSVRepository; + + public DownloadService(DepartmentCSVRepository departmentCSVRepository, EmployeeCSVRepository employeeCSVRepository, ProductCategoryCSVRepository productCategoryCSVRepository, ProductCSVRepository productCSVRepository) { + this.departmentCSVRepository = departmentCSVRepository; + this.employeeCSVRepository = employeeCSVRepository; + this.productCategoryCSVRepository = productCategoryCSVRepository; + this.productCSVRepository = productCSVRepository; + } + + /** + * ダウンロード件数取得 + */ + public int count(DownloadCriteria condition) { + return switch (condition.getTarget()) { + case 部門 -> { + checkPermission("ROLE_ADMIN"); + yield countDepartments(condition); + } + case 社員 -> { + checkPermission("ROLE_ADMIN"); + yield countEmployees(condition); + } + case 商品分類 -> { + checkPermission("ROLE_ADMIN"); + yield countProductCategories(condition); + } + case 商品 -> { + checkPermission("ROLE_ADMIN"); + yield countProducts(condition); + } + }; + } + + /** + * ダウンロード + */ + public void download(OutputStreamWriter streamWriter, DownloadCriteria condition) throws Exception { + switch (condition.getTarget()) { + case 部門 -> writeCsv(DepartmentDownloadCSV.class).accept(streamWriter, convert(condition)); + case 社員 -> writeCsv(EmployeeDownloadCSV.class).accept(streamWriter, convert(condition)); + case 商品分類 -> writeCsv(ProductCategoryDownloadCSV.class).accept(streamWriter, convert(condition)); + case 商品 -> writeCsv(ProductDownloadCSV.class).accept(streamWriter, convert(condition)); + } + } + + /** + * CSV変換 + */ + public List convert(DownloadCriteria condition) { + return switch (condition.getTarget()) { + case 部門 -> (List) convertDepartments(condition); + case 社員 -> (List) convertEmployees(condition); + case 商品分類 -> (List) convertProductCategories(condition); + case 商品 -> (List) convertProducts(condition); + }; + } + + /** + * 部門ダウンロード件数取得 + */ + private int countDepartments(DownloadCriteria condition) { + return departmentCSVRepository.countBy(condition); + } + + /** + * 社員ダウンロード件数取得 + */ + private int countEmployees(DownloadCriteria condition) { + return employeeCSVRepository.countBy(condition); + } + + /** + * 商品カテゴリダウンロード件数取得 + */ + private int countProductCategories(DownloadCriteria condition) { + return productCategoryCSVRepository.countBy(condition); + } + + /** + * 商品ダウンロード件数取得 + */ + private int countProducts(DownloadCriteria condition) { + return productCSVRepository.countBy(condition); + } + + /** + * 部門CSV変換 + */ + private List convertDepartments(DownloadCriteria condition) { + DepartmentList departmentList = departmentCSVRepository.selectBy(condition); + return departmentCSVRepository.convert(departmentList); + } + + /** + * 社員CSV変換 + */ + private List convertEmployees(DownloadCriteria condition) { + EmployeeList employeeList = employeeCSVRepository.selectBy(condition); + return employeeCSVRepository.convert(employeeList); + } + + /** + * 商品分類CSV変換 + */ + private List convertProductCategories(DownloadCriteria condition) { + ProductCategoryList productCategoryList = productCategoryCSVRepository.selectBy(condition); + return productCategoryCSVRepository.convert(productCategoryList); + } + + /** + * 商品CSV変換 + */ + private List convertProducts(DownloadCriteria condition) { + ProductList productList = productCSVRepository.selectBy(condition); + return productCSVRepository.convert(productList); + } +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/download/EmployeeCSVRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/download/EmployeeCSVRepository.java new file mode 100644 index 00000000..3d7c66b7 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/download/EmployeeCSVRepository.java @@ -0,0 +1,15 @@ +package com.example.sms.service.system.download; + +import com.example.sms.domain.model.master.employee.EmployeeList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.system.download.EmployeeDownloadCSV; + +import java.util.List; + +public interface EmployeeCSVRepository { + List convert(EmployeeList employeeList); + + int countBy(DownloadCriteria condition); + + EmployeeList selectBy(DownloadCriteria condition); +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCSVRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCSVRepository.java new file mode 100644 index 00000000..0a756f3a --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCSVRepository.java @@ -0,0 +1,15 @@ +package com.example.sms.service.system.download; + +import com.example.sms.domain.model.master.product.ProductList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.system.download.ProductDownloadCSV; + +import java.util.List; + +public interface ProductCSVRepository { + List convert(ProductList productList); + + int countBy(DownloadCriteria condition); + + ProductList selectBy(DownloadCriteria condition); +} diff --git a/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCategoryCSVRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCategoryCSVRepository.java new file mode 100644 index 00000000..bebc4c39 --- /dev/null +++ b/app/backend/api/src/main/java/com/example/sms/service/system/download/ProductCategoryCSVRepository.java @@ -0,0 +1,15 @@ +package com.example.sms.service.system.download; + +import com.example.sms.domain.model.master.product.ProductCategoryList; +import com.example.sms.domain.model.system.download.DownloadCriteria; +import com.example.sms.infrastructure.datasource.system.download.ProductCategoryDownloadCSV; + +import java.util.List; + +public interface ProductCategoryCSVRepository { + List convert(ProductCategoryList productCategoryList); + + int countBy(DownloadCriteria condition); + + ProductCategoryList selectBy(DownloadCriteria condition); +} diff --git a/api/src/main/java/com/example/sms/service/system/package-info.java b/app/backend/api/src/main/java/com/example/sms/service/system/package-info.java similarity index 100% rename from api/src/main/java/com/example/sms/service/system/package-info.java rename to app/backend/api/src/main/java/com/example/sms/service/system/package-info.java diff --git a/api/src/main/java/com/example/sms/service/system/user/UserManagementService.java b/app/backend/api/src/main/java/com/example/sms/service/system/user/UserManagementService.java similarity index 100% rename from api/src/main/java/com/example/sms/service/system/user/UserManagementService.java rename to app/backend/api/src/main/java/com/example/sms/service/system/user/UserManagementService.java diff --git a/api/src/main/java/com/example/sms/service/system/user/UserRepository.java b/app/backend/api/src/main/java/com/example/sms/service/system/user/UserRepository.java similarity index 100% rename from api/src/main/java/com/example/sms/service/system/user/UserRepository.java rename to app/backend/api/src/main/java/com/example/sms/service/system/user/UserRepository.java diff --git a/api/src/main/resources/application-postgresql.properties b/app/backend/api/src/main/resources/application-postgresql.properties similarity index 100% rename from api/src/main/resources/application-postgresql.properties rename to app/backend/api/src/main/resources/application-postgresql.properties diff --git a/api/src/test/resources/application.properties b/app/backend/api/src/main/resources/application.properties similarity index 84% rename from api/src/test/resources/application.properties rename to app/backend/api/src/main/resources/application.properties index 8662a48b..a1749a40 100644 --- a/api/src/test/resources/application.properties +++ b/app/backend/api/src/main/resources/application.properties @@ -17,10 +17,9 @@ springdoc.paths-to-match=/api/** # App Properties sms.jwtSecret=raukSSizGSvoHnsj7Q2HbH8OhBMRJd+DB/mVtc3qA8k= sms.jwtExpirationMs=86400000 -logging.level.org.mybatis=DEBUG -logging.level.java.sql.PreparedStatement=TRACE -logging.level.com.example.sms.infrastructure.datasource=TRACE +# logging.level.org.mybatis=DEBUG +# logging.level.java.sql.PreparedStatement=TRACE +# logging.level.com.example.sms.infrastructure.datasource=TRACE # Jackson spring.jackson.date-format=yyyy-MM-dd'T'HH:mm:ss spring.jackson.time-zone=Asia/Tokyo -server.port=8079 diff --git a/api/src/main/resources/autogen/generatorConfig.xml b/app/backend/api/src/main/resources/autogen/generatorConfig.xml similarity index 84% rename from api/src/main/resources/autogen/generatorConfig.xml rename to app/backend/api/src/main/resources/autogen/generatorConfig.xml index 7565a63d..dd2da77a 100644 --- a/api/src/main/resources/autogen/generatorConfig.xml +++ b/app/backend/api/src/main/resources/autogen/generatorConfig.xml @@ -10,6 +10,7 @@ connectionURL="${jdbcUrl}" userId="${jdbcUsername}" password="${jdbcPassword}"> + @@ -19,15 +20,15 @@ - + - + - + @@ -36,14 +37,16 @@ enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" - enableCountByExample="false"> + enableCountByExample="false" + > + enableCountByExample="false" + >
diff --git a/api/src/main/resources/db/migration/h2/V1.00__schema_startup.sql b/app/backend/api/src/main/resources/db/migration/h2/V1.00__schema_startup.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V1.00__schema_startup.sql rename to app/backend/api/src/main/resources/db/migration/h2/V1.00__schema_startup.sql diff --git a/api/src/main/resources/db/migration/h2/V1.01__data_startup.sql b/app/backend/api/src/main/resources/db/migration/h2/V1.01__data_startup.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V1.01__data_startup.sql rename to app/backend/api/src/main/resources/db/migration/h2/V1.01__data_startup.sql diff --git a/api/src/main/resources/db/migration/h2/V2.00__usr.sql b/app/backend/api/src/main/resources/db/migration/h2/V2.00__usr.sql similarity index 78% rename from api/src/main/resources/db/migration/h2/V2.00__usr.sql rename to app/backend/api/src/main/resources/db/migration/h2/V2.00__usr.sql index c80ab4c9..51d021f6 100644 --- a/api/src/main/resources/db/migration/h2/V2.00__usr.sql +++ b/app/backend/api/src/main/resources/db/migration/h2/V2.00__usr.sql @@ -12,6 +12,13 @@ CREATE TABLE system.usr PRIMARY KEY (user_id) ); +comment on table system.usr is 'ユーザー'; +comment on column system.usr.user_id is 'ユーザーID'; +comment on column system.usr.first_name is '姓'; +comment on column system.usr.last_name is '名'; +comment on column system.usr.password is 'パスワード'; +comment on column system.usr.role_name is 'ロール名'; + -- ダミーユーザー(password = demo) INSERT INTO system.usr (user_id, first_name, last_name, role_name, password) VALUES ('taro-yamada', '太郎', '山田', 'USER', '$2a$10$oxSJl.keBwxmsMLkcT9lPeAIxfNTPNQxpeywMrF7A3kVszwUTqfTK'); diff --git a/api/src/main/resources/db/migration/h2/V2.01__usr.sql b/app/backend/api/src/main/resources/db/migration/h2/V2.01__usr.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V2.01__usr.sql rename to app/backend/api/src/main/resources/db/migration/h2/V2.01__usr.sql diff --git a/api/src/main/resources/db/migration/h2/V2.10__employee.sql b/app/backend/api/src/main/resources/db/migration/h2/V2.10__employee.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V2.10__employee.sql rename to app/backend/api/src/main/resources/db/migration/h2/V2.10__employee.sql diff --git a/api/src/main/resources/db/migration/h2/V2.11__employee_data.sql b/app/backend/api/src/main/resources/db/migration/h2/V2.11__employee_data.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V2.11__employee_data.sql rename to app/backend/api/src/main/resources/db/migration/h2/V2.11__employee_data.sql diff --git a/api/src/main/resources/db/migration/h2/V2.20__product_data.sql b/app/backend/api/src/main/resources/db/migration/h2/V2.20__product_data.sql similarity index 100% rename from api/src/main/resources/db/migration/h2/V2.20__product_data.sql rename to app/backend/api/src/main/resources/db/migration/h2/V2.20__product_data.sql diff --git a/app/backend/api/src/main/resources/db/migration/h2/V3.10__product.sql b/app/backend/api/src/main/resources/db/migration/h2/V3.10__product.sql new file mode 100644 index 00000000..03a2d4a7 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/h2/V3.10__product.sql @@ -0,0 +1,84 @@ +-- versionカラムを追加 +drop table if exists 顧客別販売単価; +drop table if exists 代替商品; +drop table if exists 部品表; + +drop table if exists 商品マスタ; +create table if not exists 商品マスタ +( + 商品コード varchar(16) not null + constraint pk_products + primary key, + 商品正式名 varchar(40) not null, + 商品略称 varchar(10) not null, + 商品名カナ varchar(20) not null, + 商品区分 varchar(1), + 製品型番 varchar(40), + 販売単価 integer default 0 not null, + 仕入単価 integer default 0, + 売上原価 integer default 0 not null, + 税区分 integer default 1 not null, + 商品分類コード varchar(8), + 雑区分 integer, + 在庫管理対象区分 integer default 1, + 在庫引当区分 integer, + 仕入先コード varchar(8) not null, + 仕入先枝番 integer, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + version integer default 0 + ); + +comment on column 商品マスタ.商品区分 is '1:商品 2:製品 3:原材料 4:間接材'; + +comment on column 商品マスタ.在庫管理対象区分 is '0:対象外 1:在庫管理対象'; + +comment on column 商品マスタ.在庫引当区分 is '0:対象外 1:即時 2:まとめ 3:手配品'; + +create table if not exists 顧客別販売単価 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 取引先コード varchar(8) not null, + 販売単価 integer default 0 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_pricebycustomer + primary key (商品コード, 取引先コード) + ); + +create table if not exists 代替商品 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 代替商品コード varchar(16) not null, + 優先順位 integer default 1, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_alternate_products + primary key (商品コード, 代替商品コード) + ); + +create table if not exists 部品表 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 部品コード varchar(16) not null, + 部品数量 integer default 1 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_bom + primary key (商品コード, 部品コード) + ); + diff --git a/app/backend/api/src/main/resources/db/migration/h2/V3.11__product_data.sql b/app/backend/api/src/main/resources/db/migration/h2/V3.11__product_data.sql new file mode 100644 index 00000000..b7b3179e --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/h2/V3.11__product_data.sql @@ -0,0 +1,93 @@ +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10101001', '牛ひれ', '牛ひれ', '牛ひれ', '1', '1234567890', 1000, 900, 500, 1, '00101001', 1, 1, 1, '001', 0, + '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10101002', '牛ロース', '牛ロース', '牛ロース', '1', '1234567890', 1000, 900, 500, 1, '00101001', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10102001', '豚ひれ', '豚ひれ', '豚ひれ', '1', '1234567890', 1000, 900, 500, 1, '00101002', 1, 1, 1, '001', 0, + '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10102002', '豚ロース', '豚ロース', '豚ロース', '1', '1234567890', 1000, 900, 500, 1, '00101002', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10203001', 'まぐろトロ', 'まぐろトロ', 'まぐろトロ', '1', '1234567890', 1000, 900, 500, 1, '00102001', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10203002', 'まぐろ赤身', 'まぐろ赤身', 'まぐろ赤身', '1', '1234567890', 1000, 900, 500, 1, '00102001', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10204002', 'ブラックタイガー', 'ブラックタイガー', 'ブラックタイガー', '1', '1234567890', 1000, 900, 500, 1, + '00102002', 1, 1, 1, '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('10204003', '大正えび', '大正えび', '大正えび', '1', '1234567890', 1000, 900, 500, 1, '00102002', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('001', 'いちご蒸缶', 'いちご蒸缶', 'いちご蒸缶', '2', '1234567890', 1000, 900, 500, 1, '00102002', 1, 1, 1, + '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('002', 'いちご蒸缶セット', 'いちご蒸缶セット', 'いちご蒸缶セット', '2', '1234567890', 1000, 900, 500, 1, + '00102002', 1, 1, 1, '001', 0, '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('X01', '生ウニ', '生ウニ', '生ウニ', '3', '1234567890', 1000, 900, 500, 1, '00102002', 1, 1, 1, '001', 0, + '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('X02', '大アワビ', '大アワビ', '大アワビ', '3', '1234567890', 1000, 900, 500, 1, '00102002', 1, 1, 1, '001', 0, + '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."商品マスタ" ("商品コード", "商品正式名", "商品略称", "商品名カナ", "商品区分", "製品型番", + "販売単価", "仕入単価", "売上原価", "税区分", "商品分類コード", "雑区分", + "在庫管理対象区分", "在庫引当区分", "仕入先コード", "仕入先枝番", "作成日時", + "作成者名", "更新日時", "更新者名") +VALUES ('Z01', '缶', '缶', '缶', '4', '1234567890', 1000, 900, 500, 1, '00102002', 1, 1, 1, '001', 0, + '2022-04-20 00:00:00.000000', 'admin', '2022-04-20 00:00:00.000000', 'admin'); +INSERT INTO public."代替商品" ("商品コード", "代替商品コード", "優先順位", "作成日時", "作成者名", "更新日時", "更新者名") + +VALUES ('10101001', 'P0000001', 1, '2023-04-24 23:56:06.001000', 'admin', '2023-04-24 23:56:06.001000', 'admin'); + +INSERT INTO public."部品表" ("商品コード", "部品コード", "部品数量", "作成日時", "作成者名", "更新日時", "更新者名") +VALUES ('002', '001', 2, '2023-05-05 16:26:47.267000', 'admin', '2023-05-05 16:26:47.267000', 'admin'); +INSERT INTO public."部品表" ("商品コード", "部品コード", "部品数量", "作成日時", "作成者名", "更新日時", "更新者名") +VALUES ('001', 'X01', 2, '2023-05-05 16:26:47.267000', 'admin', '2023-05-05 16:26:47.267000', 'admin'); +INSERT INTO public."部品表" ("商品コード", "部品コード", "部品数量", "作成日時", "作成者名", "更新日時", "更新者名") +VALUES ('001', 'X02', 1, '2023-05-05 16:26:47.267000', 'admin', '2023-05-05 16:26:47.267000', 'admin'); +INSERT INTO public."部品表" ("商品コード", "部品コード", "部品数量", "作成日時", "作成者名", "更新日時", "更新者名") +VALUES ('001', 'Z01', 1, '2023-05-05 16:26:47.267000', 'admin', '2023-05-05 16:26:47.267000', 'admin'); + +INSERT INTO public."顧客別販売単価" ("商品コード", "取引先コード", "販売単価", "作成日時", "作成者名", "更新日時", "更新者名") +VALUES ('10101001', '001', 800, '2022-04-19 15:00:00.000000', 'admin', '2022-04-19 15:00:00.000000', 'admin'); diff --git a/app/backend/api/src/main/resources/db/migration/h2/V3.20__application_execution_history.sql b/app/backend/api/src/main/resources/db/migration/h2/V3.20__application_execution_history.sql new file mode 100644 index 00000000..7072d0b2 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/h2/V3.20__application_execution_history.sql @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS system.application_execution_history; + +CREATE TABLE system.application_execution_history ( + id SERIAL PRIMARY KEY, + process_name VARCHAR(255) NOT NULL, + process_code VARCHAR(40) NOT NULL, + process_type VARCHAR(10) NOT NULL, + process_start TIMESTAMP NOT NULL, + process_end TIMESTAMP, + process_flag INTEGER DEFAULT 0, + process_details TEXT, + version INTEGER DEFAULT 0, + user_id varchar(255) references system.usr(user_id) on delete set null +); + +COMMENT ON TABLE system.application_execution_history IS 'アプリケーション実行履歴'; +COMMENT ON COLUMN system.application_execution_history.process_name IS 'プロセス名'; +COMMENT ON COLUMN system.application_execution_history.process_code IS 'プロセスコード'; +COMMENT ON COLUMN system.application_execution_history.process_type IS 'プロセスタイプ'; +COMMENT ON COLUMN system.application_execution_history.process_start IS 'プロセス開始日時'; +COMMENT ON COLUMN system.application_execution_history.process_end IS 'プロセス終了日時'; +COMMENT ON COLUMN system.application_execution_history.process_flag IS 'プロセスフラグ'; +COMMENT ON COLUMN system.application_execution_history.process_details IS 'プロセス詳細'; \ No newline at end of file diff --git a/app/backend/api/src/main/resources/db/migration/h2/V3.21__employee.sql b/app/backend/api/src/main/resources/db/migration/h2/V3.21__employee.sql new file mode 100644 index 00000000..24f299c8 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/h2/V3.21__employee.sql @@ -0,0 +1,23 @@ +-- user_idカラムを追加 +drop table if exists 社員マスタ; +create table if not exists 社員マスタ +( + 社員コード varchar(10) not null + constraint pk_employee + primary key, + 社員名 varchar(20), + 社員名カナ varchar(40), + パスワード varchar(8), + 電話番号 varchar(13), + fax番号 varchar(13), + 部門コード varchar(6) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 職種コード varchar(2) not null, + 承認権限コード varchar(2) not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + user_id varchar(255) + ); + diff --git a/app/backend/api/src/main/resources/db/migration/h2/V3.22__employee_data.sql b/app/backend/api/src/main/resources/db/migration/h2/V3.22__employee_data.sql new file mode 100644 index 00000000..e361f54c --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/h2/V3.22__employee_data.sql @@ -0,0 +1,217 @@ +-- 社員マスタ +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP001', '山田 太郎', 'ヤマダ タロウ', 'password', '090-1234-5678', '03-1234-5678', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP002', '佐藤 花子', 'サトウ ハナコ', 'password', '090-2345-6789', '03-2345-6789', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP003', '鈴木 一郎', 'スズキ イチロウ', 'password', '090-3456-7890', '03-3456-7890', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP004', '田中 久美子', 'タナカ クミコ', 'password', '090-4567-8901', '03-4567-8901', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP005', '渡辺 健太', 'ワタナベ ケンタ', 'password', '090-5678-9012', '03-5678-9012', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP006', '小林 美香', 'コバヤシ ミカ', 'password', '090-6789-0123', '03-6789-0123', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP007', '山本 健一郎', 'ヤマモト ケンイチロウ', 'password', '090-7890-1234', '03-7890-1234', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP008', '中村 さやか', 'ナカムラ サヤカ', 'password', '090-8901-2345', '03-8901-2345', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP009', '加藤 純一', 'カトウ ジュンイチ', 'password', '090-9012-3456', '03-9012-3456', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP010', '吉田 由美子', 'ヨシダ ユミコ', 'password', '090-0123-4567', '03-0123-4567', '11101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP011', '山田 太郎', 'ヤマダ タロウ', 'password', '090-1234-5678', '03-1234-5678', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP012', '佐藤 一郎', 'サトウ イチロウ', 'password', '090-2345-6789', '03-2345-6789', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP013', '田中 次郎', 'タナカ ジロウ', 'password', '090-3456-7890', '03-3456-7890', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP014', '鈴木 三郎', 'スズキ サブロウ', 'password', '090-4567-8901', '03-4567-8901', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP015', '高橋 四郎', 'タカハシ シロウ', 'password', '090-5678-9012', '03-5678-9012', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP016', '伊藤 五郎', 'イトウ ゴロウ', 'password', '090-6789-0123', '03-6789-0123', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP017', '渡辺 六郎', 'ワタナベ ロクロウ', 'password', '090-7890-1234', '03-7890-1234', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP018', '木村 七郎', 'キムラ シチロウ', 'password', '090-8901-2345', '03-8901-2345', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP019', '山本 八郎', 'ヤマモト ハチロウ', 'password', '090-9012-3456', '03-9012-3456', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP020', '中村 九郎', 'ナカムラ クロウ', 'password', '090-0123-4567', '03-0123-4567', '11102', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP021', '山田 太郎', 'やまだ たろう', 'password', '090-1234-5678', '03-1234-5678', '11203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP022', '佐藤 花子', 'さとう はなこ', 'password', '090-2345-6789', '03-2345-6789', '11203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP023', '田中 一郎', 'たなか いちろう', 'password', '090-3456-7890', '03-3456-7890', '11203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP024', '鈴木 朋子', 'すずき ともこ', 'password', '090-4567-8901', '03-4567-8901', '11203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP025', '高橋 勇介', 'たかはし ゆうすけ', 'password', '090-5678-9012', '03-5678-9012', '11203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP026', '山田 太郎', 'ヤマダ タロウ', 'password', '090-1234-5678', '03-1234-5678', '11204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP027', '佐藤 一郎', 'サトウ イチロウ', 'password', '080-9876-5432', '03-1111-2222', '11204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP028', '田中 二郎', 'タナカ ジロウ', 'password', '090-1111-2222', '03-4444-5555', '11204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP029', '鈴木 三郎', 'スズキ サブロウ', 'password', '080-2222-3333', '03-6666-7777', '11204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP030', '高橋 四郎', 'タカハシ シロウ', 'password', '090-3333-4444', '03-8888-9999', '11204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP031', '山田 太郎', 'ヤマダ タロウ', 'password', '090-1234-5678', '03-1234-5678', '12101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP032', '鈴木 一郎', 'スズキ イチロウ', 'password', '090-2345-6789', '03-2345-6789', '12101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP033', '佐藤 花子', 'サトウ ハナコ', 'password', '090-3456-7890', '03-3456-7890', '12101', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP035', '山田 太郎', 'ヤマダ タロウ', 'password', '090-1234-5678', '03-1234-5678', '12203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP036', '佐藤 花子', 'サトウ ハナコ', 'password', '090-2345-6789', '03-2345-6789', '12203', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); +INSERT INTO public."社員マスタ" ("社員コード", "社員名", "社員名カナ", "パスワード", "電話番号", "FAX番号", + "部門コード", "開始日", "職種コード", "承認権限コード", "作成日時", "作成者名", + "更新日時", "更新者名") +VALUES ('EMP037', '田中 太郎', 'タナカ タロウ', 'password', '090-1234-5678', '03-1234-5678', '12204', + '2021-01-01 00:00:00.000000', '', '', '2023-04-20 00:00:00.000000', 'admin', '2023-04-20 00:00:00.000000', + 'admin'); diff --git a/app/backend/api/src/main/resources/db/migration/postgresql/V1.00__schema_startup.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V1.00__schema_startup.sql new file mode 100644 index 00000000..fa5080a3 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/postgresql/V1.00__schema_startup.sql @@ -0,0 +1,760 @@ +create table if not exists 部門マスタ +( + 部門コード varchar(6) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 終了日 timestamp(6) default '2100-12-31 00:00:00'::timestamp without time zone, + 部門名 varchar(40), + 組織階層 integer default 0 not null, + 部門パス varchar(100) not null, + 最下層区分 integer default 0 not null, + 伝票入力可否 integer default 1 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_department + primary key (部門コード, 開始日) +); + +comment on column 部門マスタ.伝票入力可否 is '0:不可 1:可能'; + +create table if not exists 社員マスタ +( + 社員コード varchar(10) not null + constraint pk_employee + primary key, + 社員名 varchar(20), + 社員名カナ varchar(40), + パスワード varchar(8), + 電話番号 varchar(13), + "FAX番号" varchar(13), + 部門コード varchar(6) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 職種コード varchar(2) not null, + 承認権限コード varchar(2) not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 商品分類マスタ +( + 商品分類コード varchar(8) not null + constraint pk_product_category + primary key, + 商品分類名 varchar(30), + 商品分類階層 integer default 0 not null, + 商品分類パス varchar(100), + 最下層区分 integer default 0, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 商品マスタ +( + 商品コード varchar(16) not null + constraint pk_products + primary key, + 商品正式名 varchar(40) not null, + 商品略称 varchar(10) not null, + 商品名カナ varchar(20) not null, + 商品区分 varchar(1), + 製品型番 varchar(40), + 販売単価 integer default 0 not null, + 仕入単価 integer default 0, + 売上原価 integer default 0 not null, + 税区分 integer default 1 not null, + 商品分類コード varchar(8), + 雑区分 integer, + 在庫管理対象区分 integer default 1, + 在庫引当区分 integer, + 仕入先コード varchar(8) not null, + 仕入先枝番 integer, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +comment on column 商品マスタ.商品区分 is '1:商品 2:製品 3:原材料 4:間接材'; + +comment on column 商品マスタ.在庫管理対象区分 is '0:対象外 1:在庫管理対象'; + +comment on column 商品マスタ.在庫引当区分 is '0:対象外 1:即時 2:まとめ 3:手配品'; + +create table if not exists 顧客別販売単価 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 取引先コード varchar(8) not null, + 販売単価 integer default 0 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_pricebycustomer + primary key (商品コード, 取引先コード) +); + +create table if not exists 代替商品 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 代替商品コード varchar(16) not null, + 優先順位 integer default 1, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_alternate_products + primary key (商品コード, 代替商品コード) +); + +create table if not exists 取引先マスタ +( + 取引先コード varchar(8) not null + constraint pk_companys_mst + primary key, + 取引先名 varchar(40) not null, + 取引先名カナ varchar(40), + 仕入先区分 integer default 0, + 郵便番号 char(8), + 都道府県 varchar(4), + 住所1 varchar(40), + 住所2 varchar(40), + 取引禁止フラグ integer default 0, + 雑区分 integer default 0, + 取引先グループコード varchar(4) not null, + 与信限度額 integer default 0, + 与信一時増加枠 integer default 0, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 顧客マスタ +( + 顧客コード varchar(8) not null + references 取引先マスタ + on update cascade on delete restrict, + 顧客枝番 integer not null, + 顧客区分 integer default 0, + 請求先コード varchar(8) not null, + 請求先枝番 integer, + 回収先コード varchar(8) not null, + 回収先枝番 integer, + 顧客名 varchar(40) not null, + 顧客名カナ varchar(40), + 自社担当者コード varchar(10) not null, + 顧客担当者名 varchar(20), + 顧客部門名 varchar(40), + 顧客郵便番号 char(8), + 顧客都道府県 varchar(4), + 顧客住所1 varchar(40), + 顧客住所2 varchar(40), + 顧客電話番号 varchar(13), + "顧客FAX番号" varchar(13), + 顧客メールアドレス varchar(100), + 顧客請求区分 integer default 0, + 顧客締日1 integer not null, + 顧客支払月1 integer default 1, + 顧客支払日1 integer, + 顧客支払方法1 integer default 1, + 顧客締日2 integer not null, + 顧客支払月2 integer default 1, + 顧客支払日2 integer, + 顧客支払方法2 integer default 1, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_customer + primary key (顧客コード, 顧客枝番) +); + +comment on column 顧客マスタ.顧客請求区分 is '1:都度請求 2:締請求'; + +comment on column 顧客マスタ.顧客締日1 is '15:15日締め'; + +comment on column 顧客マスタ.顧客支払月1 is '0:当月 1:翌月 2:翌々月'; + +comment on column 顧客マスタ.顧客支払日1 is '10:10日払い 99:末日'; + +comment on column 顧客マスタ.顧客支払方法1 is '1:振込 2:手形'; + +comment on column 顧客マスタ.顧客締日2 is '15:15日締め'; + +comment on column 顧客マスタ.顧客支払月2 is '0:当月 1:翌月 2:翌々月'; + +comment on column 顧客マスタ.顧客支払日2 is '10:10日払い 99:末日'; + +comment on column 顧客マスタ.顧客支払方法2 is '1:振込 2:手形'; + +create table if not exists 仕入先マスタ +( + 仕入先コード varchar(8) not null + references 取引先マスタ + on update cascade on delete restrict, + 仕入先枝番 integer not null, + 仕入先名 varchar(40) not null, + 仕入先名カナ varchar(40), + 仕入先担当者名 varchar(20), + 仕入先部門名 varchar(40), + 仕入先郵便番号 char(8), + 仕入先都道府県 varchar(4), + 仕入先住所1 varchar(40), + 仕入先住所2 varchar(40), + 仕入先電話番号 varchar(13), + "仕入先FAX番号" varchar(13), + 仕入先メールアドレス varchar(100), + 仕入先締日 integer not null, + 仕入先支払月 integer default 1, + 仕入先支払日 integer, + 仕入先支払方法 integer default 1, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_supplier + primary key (仕入先コード, 仕入先枝番) +); + +comment on column 仕入先マスタ.仕入先締日 is '15:15日締め'; + +comment on column 仕入先マスタ.仕入先支払月 is '0:当月 1:翌月 2:翌々月'; + +comment on column 仕入先マスタ.仕入先支払日 is '10:10日払い 99:末日'; + +comment on column 仕入先マスタ.仕入先支払方法 is '1:振込 2:手形'; + +create table if not exists 個人客マスタ +( + 個人客コード varchar(16) not null + constraint customer_pk + primary key, + 姓 varchar(20) not null, + 名 varchar(20) not null, + 姓カナ varchar(40) not null, + 名カナ varchar(40) not null, + "ログインID" varchar(256) not null, + メールアドレス varchar(256) not null, + パスワード varchar(16) not null, + 生年月日 timestamp(6) not null, + 性別 integer not null, + ログイン日時 timestamp(6), + ポイント残高 integer, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + 退会日 timestamp(6) +); + +create table if not exists 取引先グループマスタ +( + 取引先グループコード varchar(4) not null + constraint pk_company_group_mst + primary key, + 取引先グループ名 varchar(40), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 取引先分類種別マスタ +( + 取引先分類種別コード varchar(2) not null + constraint pk_category_type + primary key, + 取引先分類種別名 varchar(20), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 取引先分類マスタ +( + 取引先分類種別コード varchar(2) not null + references 取引先分類種別マスタ + on update cascade on delete restrict, + 取引先分類コード varchar(8) not null, + 取引先分類名 varchar(30), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_company_category + primary key (取引先分類種別コード, 取引先分類コード) +); + +create table if not exists 取引先分類所属マスタ +( + 取引先分類種別コード varchar(2) not null, + 取引先分類コード varchar(8) not null, + 取引先コード varchar(8) not null + references 取引先マスタ(取引先コード) + on update cascade on delete restrict, + 作成日時 timestamp(6) default CURRENT_TIMESTAMP not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_TIMESTAMP not null, + 更新者名 varchar(12), + constraint pk_company_category_group + primary key (取引先分類種別コード, 取引先コード, 取引先分類コード), + constraint 取引先分類所属マスタ_取引先分類コード__fkey + foreign key (取引先分類コード, 取引先分類種別コード) references 取引先分類マスタ(取引先分類コード, 取引先分類種別コード) + on update cascade on delete restrict +); + +create table if not exists 受注データ +( + 受注番号 varchar(10) not null + constraint pk_orders + primary key, + 受注日 timestamp(6) default CURRENT_DATE not null, + 部門コード varchar(6) not null, + 部門開始日 timestamp(6) default CURRENT_DATE not null, + 顧客コード varchar(8) not null, + 顧客枝番 integer, + 社員コード varchar(10) not null, + 希望納期 timestamp(6), + 客先注文番号 varchar(20), + 倉庫コード varchar(3) not null, + 受注金額合計 integer default 0 not null, + 消費税合計 integer default 0 not null, + 備考 varchar(1000), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 受注データ明細 +( + 受注番号 varchar(10) not null + references 受注データ + on update cascade on delete restrict, + 受注行番号 integer not null, + 商品コード varchar(16) not null, + 商品名 varchar(10) not null, + 販売単価 integer default 0 not null, + 受注数量 integer default 1 not null, + 消費税率 integer default 0, + 引当数量 integer default 0, + 出荷指示数量 integer default 0, + 出荷済数量 integer default 0, + 完了フラグ integer default 0 not null, + 値引金額 integer default 0 not null, + 納期 timestamp(6), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + primary key (受注番号, 受注行番号) +); + +comment on column 受注データ明細.完了フラグ is '0:未完了, 1:完了'; + +create table if not exists 売上データ +( + 売上番号 varchar(10) not null + constraint pk_sales + primary key, + 受注番号 varchar(10) not null, + 売上日 timestamp(6) default CURRENT_DATE not null, + 売上区分 integer default 1, + 部門コード varchar(6) not null, + 部門開始日 timestamp(6) default CURRENT_DATE not null, + 取引先コード varchar(8) not null, + 社員コード varchar(10) not null, + 売上金額合計 integer default 0 not null, + 消費税合計 integer default 0 not null, + 備考 varchar(1000), + 赤黒伝票番号 integer, + 元伝票番号 varchar(10), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 売上データ明細 +( + 売上番号 varchar(10) not null + references 売上データ + on update cascade on delete restrict, + 売上行番号 integer not null, + 商品コード varchar(16) not null, + 商品名 varchar(10) not null, + 販売単価 integer default 0 not null, + 出荷数量 integer default 0, + 売上数量 integer default 1 not null, + 値引金額 integer default 0 not null, + 請求日 timestamp(6), + 請求番号 varchar(10), + 請求遅延区分 integer, + 自動仕訳日 timestamp(6), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_sales_details + primary key (売上番号, 売上行番号) +); + +create table if not exists 出荷先マスタ +( + 顧客コード varchar(8) not null, + 顧客枝番 integer not null, + 出荷先番号 integer not null, + 出荷先名 varchar(40) not null, + 地域コード varchar(10) not null, + 出荷先郵便番号 char(8), + 出荷先住所1 varchar(40), + 出荷先住所2 varchar(40), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_destinations + primary key (顧客コード, 出荷先番号, 顧客枝番), + foreign key (顧客コード, 顧客枝番) references 顧客マスタ + on update cascade on delete restrict +); + +create table if not exists 地域マスタ +( + 地域コード varchar(10) not null + constraint pk_area + primary key, + 地域名 varchar(20), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 請求データ +( + 請求番号 varchar(10) not null + constraint pk_invoice + primary key, + 請求日 timestamp(6), + 取引先コード varchar(8) not null, + 顧客枝番 integer default 0, + 前回入金額 integer default 0, + 当月売上額 integer default 0, + 当月入金額 integer default 0, + 当月請求額 integer default 0, + 消費税金額 integer default 0 not null, + 請求消込金額 integer default 0, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 請求データ明細 +( + 請求番号 varchar(10) not null + references 請求データ + on update cascade on delete restrict, + 売上番号 varchar(10) not null, + 売上行番号 integer not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_invoice_details + primary key (請求番号, 売上番号, 売上行番号), + foreign key (売上番号, 売上行番号) references 売上データ明細 + on update cascade on delete restrict +); + +create table if not exists 入金口座マスタ +( + 入金口座コード varchar(8) not null + constraint pk_bank_acut_mst + primary key, + 入金口座名 varchar(30), + 適用開始日 timestamp(6) default CURRENT_DATE not null, + 適用終了日 timestamp(6) default '2100-12-31 00:00:00'::timestamp without time zone, + 適用開始後入金口座名 varchar(30), + 入金口座区分 varchar(1), + 入金口座番号 varchar(12), + 銀行口座種別 varchar(1), + 口座名義人 varchar(20), + 部門コード varchar(6) not null, + 部門開始日 timestamp(6) default CURRENT_DATE not null, + 全銀協銀行コード varchar(4), + 全銀協支店コード varchar(3), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + プログラム更新日時 timestamp(6) default CURRENT_DATE, + 更新プログラム名 varchar(50) +); + +comment on column 入金口座マスタ.入金口座区分 is 'B:銀行, P:郵便局'; + +comment on column 入金口座マスタ.入金口座番号 is '銀行:7桁 郵便局:12桁'; + +comment on column 入金口座マスタ.銀行口座種別 is 'O:普通 C:当座'; + +create table if not exists 入金データ +( + 入金番号 varchar(10) not null + constraint pk_credit + primary key, + 入金日 timestamp(6), + 部門コード varchar(6) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 顧客コード varchar(8) not null, + 顧客枝番 integer default 0, + 支払方法区分 integer default 1, + 入金口座コード varchar(8), + 入金金額 integer default 0, + 消込金額 integer default 0, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + プログラム更新日時 timestamp(6) default CURRENT_DATE, + 更新プログラム名 varchar(50) +); + +comment on column 入金データ.支払方法区分 is '1:振込 2:手形'; + +create table if not exists 部品表 +( + 商品コード varchar(16) not null + references 商品マスタ + on update cascade on delete restrict, + 部品コード varchar(16) not null, + 部品数量 integer default 1 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_bom + primary key (商品コード, 部品コード) +); + +create table if not exists 発注データ +( + 発注番号 varchar(10) not null + constraint pk_purchase_orders + primary key, + 発注日 timestamp(6), + 受注番号 varchar(10) not null, + 仕入先コード varchar(8) not null, + 仕入先枝番 integer default 0, + 発注担当者コード varchar(10) not null, + 指定納期 timestamp(6), + 倉庫コード varchar(3) not null, + 発注金額合計 integer default 0, + 消費税合計 integer default 0 not null, + 備考 varchar(1000), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 発注データ明細 +( + 発注番号 varchar(10) not null + references 発注データ + on update cascade on delete restrict, + 発注行番号 integer not null, + 発注行表示番号 integer not null, + 受注番号 varchar(10) not null, + 受注行番号 integer not null, + 商品コード varchar(16) not null, + 商品名 varchar(10) not null, + 発注単価 integer default 0, + 発注数量 integer default 1 not null, + 入荷数量 integer default 1 not null, + 完了フラグ integer default 0 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_purchase_order_details + primary key (発注行番号, 発注番号) +); + +comment on column 発注データ明細.完了フラグ is '0:未完了 1:完了'; + +create table if not exists 倉庫マスタ +( + 倉庫コード varchar(3) not null + constraint pk_wh_mst + primary key, + 倉庫名 varchar(20), + 倉庫区分 varchar(1) default 'N'::character varying, + 郵便番号 char(8), + 都道府県 varchar(4), + 住所1 varchar(40), + 住所2 varchar(40), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +comment on column 倉庫マスタ.倉庫区分 is 'N:通常倉庫, C:得意先, S:仕入先, D:部門倉庫, P:製品倉庫, M:原材料倉庫'; + +create table if not exists 倉庫部門マスタ +( + 倉庫コード varchar(3) not null + references 倉庫マスタ + on update cascade on delete restrict, + 部門コード varchar(6) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_wh_dept_mst + primary key (倉庫コード, 部門コード, 開始日), + foreign key (部門コード, 開始日) references 部門マスタ + on update cascade on delete restrict +); + +create table if not exists 在庫データ +( + 倉庫コード varchar(3) not null + references 倉庫マスタ + on update cascade on delete restrict, + 商品コード varchar(16) not null, + ロット番号 varchar(20) not null, + 在庫区分 varchar(1) default '1'::character varying not null, + 良品区分 varchar(1) default 'G'::character varying not null, + 実在庫数 integer default 1 not null, + 有効在庫数 integer default 1 not null, + 最終出荷日 timestamp(6), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_stock + primary key (倉庫コード, 商品コード, ロット番号, 在庫区分, 良品区分) +); + +comment on column 在庫データ.在庫区分 is '1:自社在庫, 2:預り在庫,'; + +comment on column 在庫データ.良品区分 is 'G:良品, F:不良品, U:未検品'; + +create table if not exists 棚番マスタ +( + 倉庫コード varchar(3) not null + references 倉庫マスタ + on update cascade on delete restrict, + 棚番コード varchar(4) not null, + 商品コード varchar(16) not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_location_mst + primary key (倉庫コード, 棚番コード, 商品コード) +); + +create table if not exists 仕入データ +( + 仕入番号 varchar(10) not null + constraint pk_pu + primary key, + 仕入日 timestamp(6) default CURRENT_DATE, + 仕入先コード varchar(8) not null, + 仕入先枝番 integer default 0, + 仕入担当者コード varchar(10) not null, + 開始日 timestamp(6) default CURRENT_DATE not null, + 発注番号 varchar(10), + 部門コード varchar(6) not null, + 仕入金額合計 integer default 0, + 消費税合計 integer default 0 not null, + 備考 varchar(1000), + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + updater varchar(12) +); + +create table if not exists 仕入データ明細 +( + 仕入番号 varchar(10) not null + references 仕入データ + on update cascade on delete restrict, + 仕入行番号 integer not null, + 仕入行表示番号 integer not null, + 発注行番号 integer not null, + 商品コード varchar(16) not null, + 倉庫コード varchar(3) not null, + 商品名 varchar(10) not null, + 仕入単価 integer default 0, + 仕入数量 integer default 1 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12), + constraint pk_pu_details + primary key (仕入行番号, 仕入番号) +); + +create table if not exists 支払データ +( + 支払番号 varchar(10) not null + constraint pk_pay + primary key, + 支払日 integer default 0, + 部門コード varchar(6) not null, + 部門開始日 timestamp(6) default CURRENT_DATE not null, + 仕入先コード varchar(8) not null, + 仕入先枝番 integer default 0, + 支払方法区分 integer default 1, + 支払金額 integer default 0, + 消費税合計 integer default 0 not null, + 支払完了フラグ integer default 0 not null, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +comment on column 支払データ.支払日 is '10:10日払い, 99:末日'; + +comment on column 支払データ.支払方法区分 is '1:振込, 2:手形'; + +comment on column 支払データ.支払完了フラグ is '0:未完了, 1:完了'; + +create table if not exists 与信残高データ +( + 取引先コード varchar(8) not null + constraint pk_credit_balance + primary key, + 受注残高 integer default 0, + 債権残高 integer default 0, + 債務残高 integer default 0, + 作成日時 timestamp(6) default CURRENT_DATE not null, + 作成者名 varchar(12), + 更新日時 timestamp(6) default CURRENT_DATE not null, + 更新者名 varchar(12) +); + +create table if not exists 自動採番マスタ +( + 伝票種別コード varchar(2) not null, + 年月 timestamp(6) not null, + 最終伝票番号 integer default 0 not null, + primary key (伝票種別コード, 年月) +); diff --git a/api/src/main/resources/db/migration/postgresql/V2.00__usr.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V2.00__usr.sql similarity index 78% rename from api/src/main/resources/db/migration/postgresql/V2.00__usr.sql rename to app/backend/api/src/main/resources/db/migration/postgresql/V2.00__usr.sql index c80ab4c9..51d021f6 100644 --- a/api/src/main/resources/db/migration/postgresql/V2.00__usr.sql +++ b/app/backend/api/src/main/resources/db/migration/postgresql/V2.00__usr.sql @@ -12,6 +12,13 @@ CREATE TABLE system.usr PRIMARY KEY (user_id) ); +comment on table system.usr is 'ユーザー'; +comment on column system.usr.user_id is 'ユーザーID'; +comment on column system.usr.first_name is '姓'; +comment on column system.usr.last_name is '名'; +comment on column system.usr.password is 'パスワード'; +comment on column system.usr.role_name is 'ロール名'; + -- ダミーユーザー(password = demo) INSERT INTO system.usr (user_id, first_name, last_name, role_name, password) VALUES ('taro-yamada', '太郎', '山田', 'USER', '$2a$10$oxSJl.keBwxmsMLkcT9lPeAIxfNTPNQxpeywMrF7A3kVszwUTqfTK'); diff --git a/api/src/main/resources/db/migration/postgresql/V2.01__usr.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V2.01__usr.sql similarity index 100% rename from api/src/main/resources/db/migration/postgresql/V2.01__usr.sql rename to app/backend/api/src/main/resources/db/migration/postgresql/V2.01__usr.sql diff --git a/api/src/main/resources/db/migration/postgresql/V2.10__employee.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V2.10__employee.sql similarity index 100% rename from api/src/main/resources/db/migration/postgresql/V2.10__employee.sql rename to app/backend/api/src/main/resources/db/migration/postgresql/V2.10__employee.sql diff --git a/app/backend/api/src/main/resources/db/migration/postgresql/V3.10__product.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V3.10__product.sql new file mode 100644 index 00000000..bf51c684 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/postgresql/V3.10__product.sql @@ -0,0 +1,3 @@ +-- user_idカラムを追加 +ALTER TABLE "商品マスタ" + ADD COLUMN "version" INT DEFAULT 0; diff --git a/app/backend/api/src/main/resources/db/migration/postgresql/V3.20__application_execution_history.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V3.20__application_execution_history.sql new file mode 100644 index 00000000..7072d0b2 --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/postgresql/V3.20__application_execution_history.sql @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS system.application_execution_history; + +CREATE TABLE system.application_execution_history ( + id SERIAL PRIMARY KEY, + process_name VARCHAR(255) NOT NULL, + process_code VARCHAR(40) NOT NULL, + process_type VARCHAR(10) NOT NULL, + process_start TIMESTAMP NOT NULL, + process_end TIMESTAMP, + process_flag INTEGER DEFAULT 0, + process_details TEXT, + version INTEGER DEFAULT 0, + user_id varchar(255) references system.usr(user_id) on delete set null +); + +COMMENT ON TABLE system.application_execution_history IS 'アプリケーション実行履歴'; +COMMENT ON COLUMN system.application_execution_history.process_name IS 'プロセス名'; +COMMENT ON COLUMN system.application_execution_history.process_code IS 'プロセスコード'; +COMMENT ON COLUMN system.application_execution_history.process_type IS 'プロセスタイプ'; +COMMENT ON COLUMN system.application_execution_history.process_start IS 'プロセス開始日時'; +COMMENT ON COLUMN system.application_execution_history.process_end IS 'プロセス終了日時'; +COMMENT ON COLUMN system.application_execution_history.process_flag IS 'プロセスフラグ'; +COMMENT ON COLUMN system.application_execution_history.process_details IS 'プロセス詳細'; \ No newline at end of file diff --git a/app/backend/api/src/main/resources/db/migration/postgresql/V3.21__employee.sql b/app/backend/api/src/main/resources/db/migration/postgresql/V3.21__employee.sql new file mode 100644 index 00000000..3efd93af --- /dev/null +++ b/app/backend/api/src/main/resources/db/migration/postgresql/V3.21__employee.sql @@ -0,0 +1,2 @@ +ALTER TABLE 社員マスタ + RENAME COLUMN "FAX番号" TO "fax番号"; \ No newline at end of file diff --git a/api/src/main/resources/messages.properties b/app/backend/api/src/main/resources/messages.properties similarity index 95% rename from api/src/main/resources/messages.properties rename to app/backend/api/src/main/resources/messages.properties index 791eaab6..8404d113 100644 --- a/api/src/main/resources/messages.properties +++ b/app/backend/api/src/main/resources/messages.properties @@ -23,3 +23,4 @@ error.product_category.not.exist=Product Category not found success.product_category.registered=Product Category register success success.product_category.updated=Product Category update success success.product_category.deleted=Product Category delete success +success.audit.history.deleted=Audit history delete success \ No newline at end of file diff --git a/api/src/main/resources/messages_ja.properties b/app/backend/api/src/main/resources/messages_ja.properties similarity index 94% rename from api/src/main/resources/messages_ja.properties rename to app/backend/api/src/main/resources/messages_ja.properties index 1bfefcdc..cb17a4af 100644 --- a/api/src/main/resources/messages_ja.properties +++ b/app/backend/api/src/main/resources/messages_ja.properties @@ -23,3 +23,4 @@ error.product_category.not.exist=\u8A72\u5F53\u3059\u308B\u5546\u54C1\u5206\u985 success.product_category.registered=\u5546\u54C1\u5206\u985E\u3092\u767B\u9332\u3057\u307E\u3057\u305F success.product_category.updated=\u5546\u54C1\u5206\u985E\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F success.product_category.deleted=\u5546\u54C1\u5206\u985E\u3092\u524A\u9664\u3057\u307E\u3057\u305F +success.audit.history.deleted=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u5B9F\u884C\u5C65\u6B74\u3092\u524A\u9664\u3057\u307E\u3057\u305F diff --git a/api/src/test/java/com/example/sms/AcceptanceTests.java b/app/backend/api/src/test/java/com/example/sms/AcceptanceTests.java similarity index 66% rename from api/src/test/java/com/example/sms/AcceptanceTests.java rename to app/backend/api/src/test/java/com/example/sms/AcceptanceTests.java index 39c4974f..1b994fc5 100644 --- a/api/src/test/java/com/example/sms/AcceptanceTests.java +++ b/app/backend/api/src/test/java/com/example/sms/AcceptanceTests.java @@ -7,7 +7,10 @@ @RunWith(Cucumber.class) @CucumberOptions( features = "classpath:features/", - glue = {"com.example.sms"} + glue = {"com.example.sms"}, + plugin = { + "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm" + } ) public class AcceptanceTests { } diff --git a/api/src/test/java/com/example/sms/ArchitectureRuleTest.java b/app/backend/api/src/test/java/com/example/sms/ArchitectureRuleTest.java similarity index 100% rename from api/src/test/java/com/example/sms/ArchitectureRuleTest.java rename to app/backend/api/src/test/java/com/example/sms/ArchitectureRuleTest.java diff --git a/api/src/test/java/com/example/sms/Erd.java b/app/backend/api/src/test/java/com/example/sms/Erd.java similarity index 100% rename from api/src/test/java/com/example/sms/Erd.java rename to app/backend/api/src/test/java/com/example/sms/Erd.java diff --git a/api/src/test/java/com/example/sms/IntegrationTest.java b/app/backend/api/src/test/java/com/example/sms/IntegrationTest.java similarity index 100% rename from api/src/test/java/com/example/sms/IntegrationTest.java rename to app/backend/api/src/test/java/com/example/sms/IntegrationTest.java diff --git a/api/src/test/java/com/example/sms/PasswordGenerator.java b/app/backend/api/src/test/java/com/example/sms/PasswordGenerator.java similarity index 100% rename from api/src/test/java/com/example/sms/PasswordGenerator.java rename to app/backend/api/src/test/java/com/example/sms/PasswordGenerator.java diff --git a/api/src/test/java/com/example/sms/PresentationTest.java b/app/backend/api/src/test/java/com/example/sms/PresentationTest.java similarity index 100% rename from api/src/test/java/com/example/sms/PresentationTest.java rename to app/backend/api/src/test/java/com/example/sms/PresentationTest.java diff --git a/api/src/test/java/com/example/sms/SmsApplicationTests.java b/app/backend/api/src/test/java/com/example/sms/SmsApplicationTests.java similarity index 100% rename from api/src/test/java/com/example/sms/SmsApplicationTests.java rename to app/backend/api/src/test/java/com/example/sms/SmsApplicationTests.java diff --git a/api/src/test/java/com/example/sms/TestDataFactory.java b/app/backend/api/src/test/java/com/example/sms/TestDataFactory.java similarity index 90% rename from api/src/test/java/com/example/sms/TestDataFactory.java rename to app/backend/api/src/test/java/com/example/sms/TestDataFactory.java index 6324990c..22e66f88 100644 --- a/api/src/test/java/com/example/sms/TestDataFactory.java +++ b/app/backend/api/src/test/java/com/example/sms/TestDataFactory.java @@ -27,4 +27,7 @@ public interface TestDataFactory { void setUpForProductService(); + void setUpForAuditService(); + + void setUpForDownloadService(); } diff --git a/api/src/test/java/com/example/sms/TestDataFactoryImpl.java b/app/backend/api/src/test/java/com/example/sms/TestDataFactoryImpl.java similarity index 70% rename from api/src/test/java/com/example/sms/TestDataFactoryImpl.java rename to app/backend/api/src/test/java/com/example/sms/TestDataFactoryImpl.java index ff10e05b..91b0297f 100644 --- a/api/src/test/java/com/example/sms/TestDataFactoryImpl.java +++ b/app/backend/api/src/test/java/com/example/sms/TestDataFactoryImpl.java @@ -4,13 +4,17 @@ import com.example.sms.domain.model.master.department.DepartmentId; import com.example.sms.domain.model.master.employee.Employee; import com.example.sms.domain.model.master.product.*; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; import com.example.sms.domain.type.product.*; import com.example.sms.domain.type.user.RoleName; import com.example.sms.service.master.department.DepartmentRepository; import com.example.sms.service.master.employee.EmployeeRepository; import com.example.sms.service.master.product.ProductCategoryRepository; import com.example.sms.service.master.product.ProductRepository; +import com.example.sms.service.system.audit.AuditRepository; import com.example.sms.service.system.user.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -30,12 +34,12 @@ public class TestDataFactoryImpl implements TestDataFactory { ProductRepository productRepository; @Autowired ProductCategoryRepository productCategoryRepository; + @Autowired + AuditRepository auditRepository; @Override public void setUpForAuthApiService() { - userRepository.deleteAll(); - userRepository.save(user()); - userRepository.save(admin()); + setUpUser(); } @Override @@ -65,9 +69,7 @@ public ProductCategory ProductCategory() { @Override public void setUpForUserManagementService() { - userRepository.deleteAll(); - userRepository.save(user()); - userRepository.save(admin()); + setUpUser(); } @Override @@ -82,6 +84,7 @@ public void setUpForDepartmentService() { @Override public void setUpForEmployeeService() { + userRepository.save(user()); LocalDateTime startDate = LocalDateTime.of(2021, 1, 1, 0, 0); departmentRepository.deleteAll(); departmentRepository.save(department("10000", startDate, "部門1")); @@ -106,7 +109,45 @@ public void setUpForProductService() { productCategoryRepository.deleteAll(); productCategoryRepository.save(getProductCategory("カテゴリ1", "カテゴリ1", 1, "カテゴリ1", 1)); - productCategoryRepository.save(getProductCategory("カテゴリ2", "カテゴリ2", 2, "カテゴリ2", 2)); + productCategoryRepository.save(getProductCategory("カテゴリ2", "カテゴリ2", 2, "カテゴリ1~カテゴリ2", 2)); + } + + private void setUpUser() { + userRepository.deleteAll(); + userRepository.save(user()); + userRepository.save(admin()); + } + + @Override + public void setUpForAuditService() { + User execUser = User.of("U777777", user().getPassword().Value(), user().getName().FirstName(), user().getName().LastName(), user().getRoleName()); + userRepository.save(execUser); + + auditRepository.deleteAll(); + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, "その他", "9999", ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", execUser); + auditRepository.save(applicationExecutionHistory); + auditRepository.save(applicationExecutionHistory); + } + + @Override + public void setUpForDownloadService() { + departmentRepository.deleteAll(); + departmentRepository.save(department("30000", LocalDateTime.of(2021, 1, 1, 0, 0), "部門3")); + departmentRepository.save(department("40000", LocalDateTime.of(2021, 1, 1, 0, 0), "部門4")); + departmentRepository.save(department("50000", LocalDateTime.of(2021, 1, 1, 0, 0), "部門5")); + employeeRepository.deleteAll(); + userRepository.save(user()); + employeeRepository.save(employee("EMP003", "30000", LocalDateTime.of(2021, 1, 1, 0, 0))); + employeeRepository.save(employee("EMP004", "30000", LocalDateTime.of(2021, 1, 1, 0, 0))); + employeeRepository.save(employee("EMP005", "40000", LocalDateTime.of(2021, 1, 1, 0, 0))); + productCategoryRepository.deleteAll(); + productCategoryRepository.save(getProductCategory("00000001", "カテゴリ3", 1, "2", 3)); + productCategoryRepository.save(getProductCategory("00000002", "カテゴリ4", 1, "2", 3)); + productCategoryRepository.save(getProductCategory("00000003", "カテゴリ5", 1, "2", 3)); + productRepository.deleteAll(); + productRepository.save(product("99999999", "商品1", "商品1", "ショウヒンイチ", ProductType.その他, 900, 810, 90, TaxType.その他, "カテゴリ9", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "サプライヤ9", 9)); + productRepository.save(product("99999998", "商品2", "商品2", "ショウヒン二", ProductType.その他, 800, 720, 80, TaxType.その他, "カテゴリ8", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "サプライヤ8", 8)); + productRepository.save(product("99999997", "商品3", "商品3", "ショウヒンサン", ProductType.その他, 700, 630, 70, TaxType.その他, "カテゴリ7", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "サプライヤ7", 7)); } private static User user() { diff --git a/api/src/test/java/com/example/sms/domain/model/common/money/MoneyTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/common/money/MoneyTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/common/money/MoneyTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/common/money/MoneyTest.java diff --git a/api/src/test/java/com/example/sms/domain/model/common/quantity/QuantityTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/common/quantity/QuantityTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/common/quantity/QuantityTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/common/quantity/QuantityTest.java diff --git a/api/src/test/java/com/example/sms/domain/model/master/department/DepartmentTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/master/department/DepartmentTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/master/department/DepartmentTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/master/department/DepartmentTest.java diff --git a/api/src/test/java/com/example/sms/domain/model/master/employee/EmployeeTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/master/employee/EmployeeTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/master/employee/EmployeeTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/master/employee/EmployeeTest.java diff --git a/api/src/test/java/com/example/sms/domain/model/master/product/ProductTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/master/product/ProductTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/master/product/ProductTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/master/product/ProductTest.java diff --git a/api/src/test/java/com/example/sms/domain/model/system/package-info.java b/app/backend/api/src/test/java/com/example/sms/domain/model/system/package-info.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/system/package-info.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/system/package-info.java diff --git a/api/src/test/java/com/example/sms/domain/model/system/user/UserTest.java b/app/backend/api/src/test/java/com/example/sms/domain/model/system/user/UserTest.java similarity index 100% rename from api/src/test/java/com/example/sms/domain/model/system/user/UserTest.java rename to app/backend/api/src/test/java/com/example/sms/domain/model/system/user/UserTest.java diff --git a/api/src/test/java/com/example/sms/presentation/api/TestControllerTest.java b/app/backend/api/src/test/java/com/example/sms/presentation/api/ApiControllerTest.java similarity index 98% rename from api/src/test/java/com/example/sms/presentation/api/TestControllerTest.java rename to app/backend/api/src/test/java/com/example/sms/presentation/api/ApiControllerTest.java index 9279d6fd..f243f587 100644 --- a/api/src/test/java/com/example/sms/presentation/api/TestControllerTest.java +++ b/app/backend/api/src/test/java/com/example/sms/presentation/api/ApiControllerTest.java @@ -16,7 +16,7 @@ @DisplayName("JWT認可API") @PresentationTest @AutoConfigureMybatis -public class TestControllerTest { +public class ApiControllerTest { @Autowired private MockMvc mockMvc; diff --git a/api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java similarity index 77% rename from api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java rename to app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java index e58fab63..a401680e 100644 --- a/api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java +++ b/app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentRepositoryTest.java @@ -8,14 +8,35 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; import java.time.LocalDateTime; import static org.junit.jupiter.api.Assertions.assertEquals; @SpringBootTest +@Testcontainers +@ActiveProfiles("container") @DisplayName("部門レポジトリ") -public class DepartmentRepositoryTest { +class DepartmentRepositoryTest { + @Container + private static final PostgreSQLContainer postgres = + new PostgreSQLContainer<>(DockerImageName.parse("postgres:15")) + .withUsername("root") + .withPassword("password") + .withDatabaseName("postgres"); + + @DynamicPropertySource + static void setup(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", postgres::getJdbcUrl); + } + @Autowired private DepartmentRepository repository; diff --git a/app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java new file mode 100644 index 00000000..63baa85a --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/master/department/DepartmentServiceTest.java @@ -0,0 +1,183 @@ +package com.example.sms.service.master.department; + +import com.example.sms.IntegrationTest; +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.master.department.Department; +import com.example.sms.domain.model.master.department.DepartmentId; +import com.example.sms.domain.model.master.department.DepartmentList; +import com.github.pagehelper.PageInfo; +import io.cucumber.java8.De; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@IntegrationTest +@DisplayName("部門サービス") +public class DepartmentServiceTest { + @Autowired + DepartmentService departmentService; + + @Autowired + TestDataFactory testDataFactory; + + @BeforeEach + void setUp() { + testDataFactory.setUpForDepartmentService(); + } + + @Nested + @DisplayName("部門管理") + class DepartmentManagementTests { + @Test + @DisplayName("部門一覧を取得できる") + void getAllDepartments() { + DepartmentList result = departmentService.selectAll(); + + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("部門を新規登録できる") + void registerNewDepartment() { + Department newDepartment = testDataFactory.Department(); + + departmentService.register(newDepartment); + + DepartmentList result = departmentService.selectAll(); + assertEquals(3, result.asList().size()); + assertEquals(2, result.asList().getFirst().getEmployees().size()); + } + + @Test + @DisplayName("部門の登録情報を編集できる") + void editDepartmentDetails() { + Department department = testDataFactory.Department(); + + Department updateDepartment = Department.of(department.getDepartmentId(), department.getEndDate().getValue(), "editedDepartmentName", department.getLayer(), department.getPath().getValue(), department.getLowerType().getValue(), department.getSlitYn().getValue()); + departmentService.save(updateDepartment); + + Department result = departmentService.find(department.getDepartmentId()); + assertEquals("editedDepartmentName", result.getDepartmentName()); + } + + @Test + @DisplayName("部門を削除できる") + void deleteDepartment() { + Department department = testDataFactory.Department(); + + departmentService.delete(department.getDepartmentId()); + + DepartmentList result = departmentService.selectAll(); + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("部門を検索できる") + void findDepartment() { + Department department = testDataFactory.Department(); + + departmentService.register(department); + + Department result = departmentService.find(department.getDepartmentId()); + assertEquals(department, result); + } + + @Nested + @DisplayName("部門の検索ができる") + class SearchDepartmentTests { + @Test + @DisplayName("部門コードで検索できる") + void case1() { + String departmentId = "30000"; + Department department = Department.of(DepartmentId.of(departmentId, LocalDateTime.of(2021,1,1,0,0,0)), LocalDateTime.of(9999, 12, 31, 0, 0), "部門", 0, departmentId + "~", 0, 1); + departmentService.register(department); + DepartmentCriteria criteria = DepartmentCriteria.builder().departmentCode(departmentId).build(); + + PageInfo result = departmentService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(department, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("部門名で検索できる") + void case2() { + String departmentId = "30000"; + String departmentName = "部門"; + Department department =Department.of(DepartmentId.of(departmentId, LocalDateTime.of(2021,1,1,0,0,0)), LocalDateTime.of(9999, 12, 31, 0, 0), departmentName, 0, departmentId + "~", 0, 1); + departmentService.register(department); + DepartmentCriteria criteria = DepartmentCriteria.builder().departmentName(departmentName).build(); + + PageInfo result = departmentService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(department, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("開始日で検索できる") + void case3() { + String departmentId = "30000"; + LocalDateTime startDate = LocalDateTime.of(2024,1,1,0,0,0); + Department department = Department.of(DepartmentId.of(departmentId, startDate), LocalDateTime.of(9999, 12, 31, 0, 0), "部門", 0, departmentId + "~", 0, 1); + departmentService.register(department); + DepartmentCriteria criteria = DepartmentCriteria.builder().startDate(startDate).build(); + + PageInfo result = departmentService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(department, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("終了日で検索できる") + void case4() { + String departmentId = "30000"; + LocalDateTime endDate = LocalDateTime.of(2025, 12, 31, 0, 0); + Department department = Department.of(DepartmentId.of(departmentId, LocalDateTime.of(2021,1,1,0,0,0)), endDate, "部門", 0, departmentId + "~", 0, 1); + departmentService.register(department); + DepartmentCriteria criteria = DepartmentCriteria.builder().endDate(endDate).build(); + + PageInfo result = departmentService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(department, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("複数条件で検索できる") + void case5() { + String departmentId = "30000"; + String departmentName = "部門"; + LocalDateTime startDate = LocalDateTime.of(2021,1,1,0,0,0); + LocalDateTime endDate = LocalDateTime.of(9999, 12, 31, 0, 0); + Department department = Department.of(DepartmentId.of(departmentId, startDate), endDate, departmentName, 0, departmentId + "~", 0, 1); + departmentService.register(department); + DepartmentCriteria criteria = DepartmentCriteria.builder().departmentCode(departmentId).departmentName(departmentName).startDate(startDate).endDate(endDate).build(); + + PageInfo result = departmentService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(department, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("不正な期間を指定した場合、エラーが発生する") + void case6() { + assertThrows(IllegalArgumentException.class, () -> { + DepartmentCriteria criteria = DepartmentCriteria.builder(). + startDate(LocalDateTime.of(2021, 1, 1, 0, 0, 0)). + endDate(LocalDateTime.of(2020, 12, 31, 0, 0, 0)). + build(); + }); + } + } + } +} diff --git a/api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java similarity index 67% rename from api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java rename to app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java index 29595619..9352a2e9 100644 --- a/api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java +++ b/app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeRepositoryTest.java @@ -1,23 +1,49 @@ package com.example.sms.service.master.employee; import com.example.sms.TestDataFactoryImpl; +import com.example.sms.domain.model.master.department.Department; import com.example.sms.domain.model.master.employee.Employee; +import com.example.sms.service.master.department.DepartmentRepository; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; import java.time.LocalDateTime; import static org.junit.jupiter.api.Assertions.assertEquals; @SpringBootTest +@Testcontainers +@ActiveProfiles("container") @DisplayName("社員レポジトリ") -public class EmployeeRepositoryTest { +class EmployeeRepositoryTest { + @Container + private static final PostgreSQLContainer postgres = + new PostgreSQLContainer<>(DockerImageName.parse("postgres:15")) + .withUsername("root") + .withPassword("password") + .withDatabaseName("postgres"); + + @DynamicPropertySource + static void setup(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", postgres::getJdbcUrl); + } + @Autowired private EmployeeRepository repository; + @Autowired + private DepartmentRepository departmentRepository; + @BeforeEach void setUp() { repository.deleteAll(); @@ -27,6 +53,10 @@ private Employee getEmployee() { return TestDataFactoryImpl.employee("EMP999", "10000", LocalDateTime.of(2021, 1, 1, 0, 0)); } + private Department getDepartment() { + return TestDataFactoryImpl.department("10000", LocalDateTime.of(2021, 1, 1, 0, 0), "部署名"); + } + @Test @DisplayName("社員一覧を取得できる") void shouldRetrieveAllEmployees() { @@ -41,7 +71,9 @@ void shouldRetrieveAllEmployees() { @DisplayName("社員を登録できる") void shouldRegisterEmployee() { Employee employee = getEmployee(); + Department department = getDepartment(); + departmentRepository.save(department); repository.save(employee); Employee actual = repository.findById(employee.getEmpCode()).get(); @@ -61,6 +93,9 @@ void shouldRegisterEmployee() { @DisplayName("社員を更新できる") void shouldUpdateEmployee() { Employee employee = getEmployee(); + Department department = getDepartment(); + + departmentRepository.save(department); repository.save(employee); employee = repository.findById(employee.getEmpCode()).get(); diff --git a/app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java new file mode 100644 index 00000000..f7804286 --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/master/employee/EmployeeServiceTest.java @@ -0,0 +1,335 @@ +package com.example.sms.service.master.employee; + +import com.example.sms.IntegrationTest; +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.master.department.Department; +import com.example.sms.domain.model.master.department.DepartmentId; +import com.example.sms.domain.model.master.employee.Employee; +import com.example.sms.domain.model.master.employee.EmployeeList; +import com.example.sms.service.master.department.DepartmentService; +import com.github.pagehelper.PageInfo; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@IntegrationTest +@DisplayName("社員サービス") +class EmployeeServiceTest { + @Autowired + private EmployeeService employeeService; + + @Autowired + private TestDataFactory testDataFactory; + @Autowired + private DepartmentService departmentService; + + @BeforeEach + void setUp() { + testDataFactory.setUpForEmployeeService(); + } + + @Test + @DisplayName("社員一覧を取得できる") + void shouldRetrieveAllEmployees() { + EmployeeList result = employeeService.selectAll(); + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("社員を新規登録できる") + void shouldRegisterNewEmployee() { + Employee newEmployee = testDataFactory.Employee(); + + employeeService.register(newEmployee); + + EmployeeList result = employeeService.selectAll(); + assertEquals(3, result.asList().size()); + } + + @Test + @DisplayName("社員の登録情報を編集できる") + void shouldEditEmployeeDetails() { + Employee employee = testDataFactory.Employee(); + Employee updateEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), "edited EmployeeName", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + + employeeService.save(updateEmployee); + + Employee result = employeeService.find(employee.getEmpCode()); + assertEquals("edited EmployeeName", result.getEmpName().Name()); + } + + @Test + @DisplayName("社員を削除できる") + void shouldDeleteEmployee() { + Employee employee = testDataFactory.Employee(); + + employeeService.delete(employee.getEmpCode()); + + EmployeeList result = employeeService.selectAll(); + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("社員を検索できる") + void shouldFindEmployee() { + Employee employee = testDataFactory.Employee(); + employeeService.register(employee); + + Employee result = employeeService.find(employee.getEmpCode()); + + assertEquals(employee, result); + } + + @Nested + @DisplayName("社員の検索ができる") + class EmployeeSearchTests { + @Test + @DisplayName("社員をコードで検索できる") + void case1() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of("EMP123", employee.getEmpName().Name(), employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeCode("EMP123").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前で検索できる") + void case2_1() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), "検索 太郎", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeFirstName("検索").employeeLastName("太郎").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前で検索できる") + void case2_2() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), "検索 太郎", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeFirstName("検索").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前で検索できる") + void case2_3() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), "検索 太郎", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeLastName("太郎").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前で検索できる") + void case2_4() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), "検索 太郎", employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeLastName("検索").employeeLastName("次郎").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(0, result.getList().size()); + assertEquals(0, result.getTotal()); + } + @Test + @DisplayName("社員を名前カナで検索できる") + void case3_1() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), "ケンサク タロウ", employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeFirstNameKana("ケンサク").employeeLastNameKana("タロウ").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前カナで検索できる") + void case3_2() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), "ケンサク タロウ", employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeFirstNameKana("ケンサク").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前カナで検索できる") + void case3_3() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), "ケンサク タロウ", employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeLastNameKana("タロウ").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を名前カナで検索できる") + void case3_4() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), "ケンサク タロウ", employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeLastNameKana("ケンサク").employeeLastNameKana("ジロウ").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(0, result.getList().size()); + assertEquals(0, result.getTotal()); + } + @Test + @DisplayName("社員を電話番号で検索できる") + void case4() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), employee.getEmpName().NameKana(), "03-9999-0000", employee.getFax().getValue(), employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().phoneNumber("03-9999-0000").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員をFAX番号で検索できる") + void case5() { + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), employee.getEmpName().NameKana(), employee.getTel().getValue(), "03-9999-0000", employee.getOccuCode().getValue()), + employee.getDepartment(), + employee.getUser() + ); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().faxNumber("03-9999-0000").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("社員を部署コードで検索できる") + void case6() { + Department department = testDataFactory.Department(); + Department searchDepartment = Department.of(DepartmentId.of("12345", LocalDateTime.of(2024,1,1,0,0)), department.getEndDate().getValue(), department.getDepartmentName(), department.getLayer(), department.getPath().getValue(), department.getLowerType().getValue(), department.getSlitYn().getValue()); + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of(employee.getEmpCode().getValue(), employee.getEmpName().Name(), employee.getEmpName().NameKana(), employee.getTel().getValue(), employee.getFax().getValue(), employee.getOccuCode().getValue()), + searchDepartment, + employee.getUser() + ); + departmentService.register(searchDepartment); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().departmentCode("12345").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + @Test + @DisplayName("複合条件で社員を検索できる") + void case7() { + Department department = testDataFactory.Department(); + Department searchDepartment = Department.of(DepartmentId.of("12345", LocalDateTime.of(2024,1,1,0,0)), department.getEndDate().getValue(), department.getDepartmentName(), department.getLayer(), department.getPath().getValue(), department.getLowerType().getValue(), department.getSlitYn().getValue()); + Employee employee = testDataFactory.Employee(); + Employee searchEmployee = Employee.of( + Employee.of("EMP123", "検索 太郎", "ケンサク タロウ", "03-9999-0000", "03-9999-0000", employee.getOccuCode().getValue()), + searchDepartment, + employee.getUser() + ); + departmentService.register(searchDepartment); + employeeService.register(searchEmployee); + EmployeeCriteria criteria = EmployeeCriteria.builder().employeeCode("EMP123").employeeFirstName("検索").employeeLastName("太郎").employeeFirstNameKana("ケンサク").employeeLastNameKana("タロウ").phoneNumber("03-9999-0000").faxNumber("03-9999-0000").departmentCode("12345").build(); + + PageInfo result = employeeService.searchWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchEmployee, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + } +} diff --git a/api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java similarity index 82% rename from api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java rename to app/backend/api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java index a58228cf..9805da20 100644 --- a/api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java +++ b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductCategoryRepositoryTest.java @@ -11,6 +11,13 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; import java.util.List; import java.util.stream.IntStream; @@ -18,8 +25,22 @@ import static org.junit.Assert.assertEquals; @SpringBootTest +@Testcontainers +@ActiveProfiles("container") @DisplayName("商品分類レポジトリ") public class ProductCategoryRepositoryTest { + @Container + private static final PostgreSQLContainer postgres = + new PostgreSQLContainer<>(DockerImageName.parse("postgres:15")) + .withUsername("root") + .withPassword("password") + .withDatabaseName("postgres"); + + @DynamicPropertySource + static void setup(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", postgres::getJdbcUrl); + } + @Autowired private ProductCategoryRepository repository; @Autowired diff --git a/api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java similarity index 87% rename from api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java rename to app/backend/api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java index fc80db0a..83925874 100644 --- a/api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java +++ b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductRepositoryTest.java @@ -10,16 +10,39 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; import java.util.List; import java.util.Optional; import java.util.stream.IntStream; import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; @SpringBootTest +@Testcontainers +@ActiveProfiles("container") @DisplayName("商品レポジトリ") public class ProductRepositoryTest { + @Container + private static final PostgreSQLContainer postgres = + new PostgreSQLContainer<>(DockerImageName.parse("postgres:15")) + .withUsername("root") + .withPassword("password") + .withDatabaseName("postgres"); + + @DynamicPropertySource + static void setup(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", postgres::getJdbcUrl); + } + @Autowired private ProductRepository repository; @@ -110,6 +133,39 @@ void shouldDeleteProduct() { assertEquals(0, repository.selectAll().size()); } + + @Test + @DisplayName("楽観ロックが正常に動作すること") + void testOptimisticLockingWithThreads() throws InterruptedException { + // Productを新規作成して保存 + Product product1 = getProduct("99999999"); + repository.save(product1); + + // 同じIDのProductをもう一度データベースから取得 + repository.findById("99999999").orElseThrow(); + + // スレッド1でproduct1を更新 + Thread thread1 = new Thread(() -> { + Product updatedProduct1 = getProduct("99999999"); + repository.save(updatedProduct1); + }); + + // スレッド2でproduct2を更新し、例外を確認 + Thread thread2 = new Thread(() -> { + Product updatedProduct2 = getProduct("99999999"); + assertThrows(OptimisticLockingFailureException.class, () -> { + repository.save(updatedProduct2); + }); + }); + + // スレッドを開始 + thread1.start(); + thread2.start(); + + // スレッドの終了を待機 + thread1.join(); + thread2.join(); + } } @Nested diff --git a/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java new file mode 100644 index 00000000..28acedce --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/master/product/ProductServiceTest.java @@ -0,0 +1,399 @@ +package com.example.sms.service.master.product; + +import com.example.sms.IntegrationTest; +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.master.product.Product; +import com.example.sms.domain.model.master.product.ProductCategory; +import com.example.sms.domain.model.master.product.ProductCategoryList; +import com.example.sms.domain.model.master.product.ProductList; +import com.example.sms.domain.type.product.*; +import com.github.pagehelper.PageInfo; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.Assert.assertEquals; + +@IntegrationTest +@DisplayName("商品サービス") +public class ProductServiceTest { + @Autowired + private ProductService productService; + + @Autowired + private TestDataFactory testDataFactory; + + @BeforeEach + void setUp() { + testDataFactory.setUpForProductService(); + } + + @Nested + @DisplayName("商品") + class ProductTest { + @Nested + @DisplayName("商品アイテム") + class ProductItemTest { + @Test + @DisplayName("商品一覧を取得できる") + void shouldRetrieveAllProducts() { + ProductList result = productService.selectAll(); + assertEquals(3, result.asList().size()); + } + + @Test + @DisplayName("商品を新規登録できる") + void shouldRegisterNewProduct() { + Product newProduct = testDataFactory.Product(); + + productService.register(newProduct); + + ProductList result = productService.selectAll(); + assertEquals(4, result.asList().size()); + Product product = productService.find(newProduct.getProductCode().getValue()); + assertEquals(newProduct, product); + } + + @Test + @DisplayName("商品の登録情報を編集できる") + void shouldEditProductDetails() { + Product product = testDataFactory.Product(); + productService.register(product); + + Product updateProduct = Product.of(product.getProductCode().getValue(), "更新後商品正式名", "更新後商品略称", "更新後商品名カナ", ProductType.商品, 2000, 3000, 4000, TaxType.内税, "99999999", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "99999999", 6); + productService.save(updateProduct); + + Product result = productService.find(product.getProductCode().getValue()); + assertEquals("更新後商品正式名", result.getProductName().getProductFormalName()); + assertEquals(updateProduct, result); + } + + @Test + @DisplayName("商品を削除できる") + void shouldDeleteProduct() { + Product product = testDataFactory.Product(); + productService.register(product); + + productService.delete(product); + + ProductList result = productService.selectAll(); + assertEquals(3, result.asList().size()); + } + + @Nested + @DisplayName("商品検索") + class ProductSearchTest { + @Test + @DisplayName("商品をコードで検索できる") + void case1() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of("10101001", product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getTaxType().name(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productCode("10101001").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を正式名で検索できる") + void case2() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), "検索用商品名", product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productNameFormal("検索用商品名").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を略称で検索できる") + void case3() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), "検索用商品略称", product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productNameAbbreviation("検索用商品略称").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品をカナで検索できる") + void case4() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), "カナ", product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productNameKana("カナ").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を商品分類コードで検索できる") + void case5() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), "99999999", product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productCategoryCode("99999999").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を仕入先コードで検索できる") + void case6() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), "99999999", product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().supplierCode("99999999").build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を商品区分で検索できる") + void case7() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), ProductType.商品, product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productType(ProductType.商品.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を税区分で検索できる") + void case8() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), TaxType.その他, product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().taxType(TaxType.その他.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を雑費区分で検索できる") + void case9() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), MiscellaneousType.適用, product.getStockManagementTargetType(), product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().miscellaneousType(MiscellaneousType.適用.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を在庫管理対象区分で検索できる") + void case10() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), StockManagementTargetType.対象外, product.getStockAllocationType(), product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().stockManagementTargetType(StockManagementTargetType.対象外.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を在庫引当区分で検索できる") + void case11() { + Product product = testDataFactory.Product(); + Product searchProduct = Product.of(product.getProductCode().getValue(), product.getProductName().getProductFormalName(), product.getProductName().getProductAbbreviation(), product.getProductName().getProductNameKana(), product.getProductType(), product.getSellingPrice().getAmount(), product.getPurchasePrice().getAmount(), product.getCostOfSales().getAmount(), product.getTaxType(), product.getProductCategoryCode().getValue(), product.getMiscellaneousType(), product.getStockManagementTargetType(), StockAllocationType.未引当, product.getSupplierCode().getValue(), product.getSupplierCode().getBranchNumber()); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().stockAllocationType(StockAllocationType.未引当.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品を複合条件で検索できる") + void case12() { + Product searchProduct = Product.of("10101001", "検索用商品正式名", "検索用商品略称", "検索用商品名カナ", ProductType.商品, 2000, 3000, 4000, TaxType.内税, "99999999", MiscellaneousType.適用外, StockManagementTargetType.対象, StockAllocationType.引当済, "99999999", 6); + productService.register(searchProduct); + ProductCriteria criteria = ProductCriteria.builder().productCode("10101001").productNameFormal("検索用商品正式名").productNameAbbreviation("検索用商品略称").productNameKana("検索用商品名カナ").productType(ProductType.商品.getCode()).taxType(TaxType.内税.getCode()).miscellaneousType(MiscellaneousType.適用外.getCode()).stockManagementTargetType(StockManagementTargetType.対象.getCode()).stockAllocationType(StockAllocationType.引当済.getCode()).build(); + + PageInfo result = productService.searchProductWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProduct, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + } + } + + @Nested + @DisplayName("商品分類") + class ProductCategoryTest { + @Test + @DisplayName("商品分類一覧を取得できる") + void shouldRetrieveAllProductCategories() { + ProductCategoryList result = productService.selectAllCategory(); + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("商品分類を新規登録できる") + void shouldRegisterNewProductCategory() { + ProductCategory newProductCategory = testDataFactory.ProductCategory(); + productService.registerCategory(newProductCategory); + + ProductCategoryList result = productService.selectAllCategory(); + assertEquals(3, result.asList().size()); + ProductCategory productCategory = productService.findCategory(newProductCategory.getProductCategoryCode().getValue()); + assertEquals(newProductCategory, productCategory); + } + + @Test + @DisplayName("商品分類の登録情報を編集できる") + void shouldEditProductCategoryDetails() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + productService.registerCategory(productCategory); + + ProductCategory updateProductCategory = ProductCategory.of(productCategory.getProductCategoryCode().getValue(), "更新後商品分類名", productCategory.getProductCategoryHierarchy(), productCategory.getProductCategoryPath(), productCategory.getLowestLevelDivision()); + productService.saveCategory(updateProductCategory); + + ProductCategory result = productService.findCategory(productCategory.getProductCategoryCode().getValue()); + assertEquals("更新後商品分類名", result.getProductCategoryName()); + assertEquals(updateProductCategory, result); + } + + @Test + @DisplayName("商品分類を削除できる") + void shouldDeleteProductCategory() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + productService.registerCategory(productCategory); + + productService.deleteCategory(productCategory); + + ProductCategoryList result = productService.selectAllCategory(); + assertEquals(2, result.asList().size()); + } + + @Nested + @DisplayName("商品分類検索") + class ProductCategorySearchTest { + @Test + @DisplayName("商品分類をコードで検索できる") + void case1() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + ProductCategory searchProductCategory = ProductCategory.of("12345678", productCategory.getProductCategoryName(), productCategory.getProductCategoryHierarchy(), productCategory.getProductCategoryPath(), productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder().productCategoryCode("12345678").build(); + + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProductCategory, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品分類を名前で検索できる") + void case2() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + ProductCategory searchProductCategory = ProductCategory.of(productCategory.getProductCategoryCode().getValue(), "検索用商品分類名", productCategory.getProductCategoryHierarchy(), productCategory.getProductCategoryPath(), productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder().productCategoryCode(productCategory.getProductCategoryCode().getValue()).build(); + + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProductCategory, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品分類をパスで検索できる") + void case3() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + ProductCategory searchProductCategory = ProductCategory.of("10000000", productCategory.getProductCategoryName(), productCategory.getProductCategoryHierarchy(), "10000000~", productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + searchProductCategory = ProductCategory.of("11000000", productCategory.getProductCategoryName(), productCategory.getProductCategoryHierarchy(), "10000000~11000000", productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder().productCategoryPath("10000000~").build(); + + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + + assertEquals(2, result.getList().size()); + assertEquals(searchProductCategory, result.getList().getLast()); + assertEquals(2, result.getTotal()); + } + + @Test + @DisplayName("商品分類をコードと名前で検索できる") + void case4() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + ProductCategory searchProductCategory = ProductCategory.of("12345678", "検索用商品分類名", productCategory.getProductCategoryHierarchy(), productCategory.getProductCategoryPath(), productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder().productCategoryCode("12345678").productCategoryName("検索用商品分類名").build(); + + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProductCategory, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + + @Test + @DisplayName("商品分類をコードとパスで検索できる") + void case5() { + ProductCategory productCategory = testDataFactory.ProductCategory(); + ProductCategory searchProductCategory = ProductCategory.of("12345678", productCategory.getProductCategoryName(), productCategory.getProductCategoryHierarchy(), "12345678~", productCategory.getLowestLevelDivision()); + productService.registerCategory(searchProductCategory); + ProductCategoryCriteria criteria = ProductCategoryCriteria.builder().productCategoryCode("12345678").productCategoryPath("12345678~").build(); + + PageInfo result = productService.searchProductCategoryWithPageInfo(criteria); + + assertEquals(1, result.getList().size()); + assertEquals(searchProductCategory, result.getList().getFirst()); + assertEquals(1, result.getTotal()); + } + } + } + } +} \ No newline at end of file diff --git a/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditRepositoryTest.java new file mode 100644 index 00000000..d27379bc --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditRepositoryTest.java @@ -0,0 +1,84 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistoryList; +import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import com.example.sms.domain.type.user.RoleName; +import com.example.sms.service.system.user.UserRepository; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.time.LocalDateTime; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@SpringBootTest +@DisplayName("監査レポジトリ") +public class AuditRepositoryTest { + + @Autowired + private AuditRepository repository; + @Autowired + private UserRepository userRepository; + + @BeforeEach + void setUp() { + userRepository.deleteAll(); + repository.deleteAll(); + userRepository.save(getUser()); + } + + private static User getUser() { + return User.of("U999999", "a234567Z", "firstName", "lastName", RoleName.USER); + } + + private static ApplicationExecutionHistory getHistory() { + return ApplicationExecutionHistory.of(1, "その他", "9999", ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", getUser()); + } + + @Test + @DisplayName("アプリケーション実行履歴一覧を取得できる") + void shouldRetrieveAllAuditLogs() { + ApplicationExecutionHistory history = getHistory(); + + repository.save(history); + + ApplicationExecutionHistoryList actual = repository.selectAll(); + assertEquals(1, actual.size()); + } + + @Test + @DisplayName("アプリケーション実行履歴を登録できる") + void shouldRetrieveAuditLog() { + ApplicationExecutionHistory history = getHistory(); + + repository.save(history); + + ApplicationExecutionHistory actual = repository.findById(history.getId()).get(); + assertEquals(history.getId(), actual.getId()); + assertEquals(history.getProcess(), actual.getProcess()); + assertEquals(history.getType(), actual.getType()); + assertEquals(history.getProcessStart(), actual.getProcessStart()); + assertEquals(history.getProcessEnd(), actual.getProcessEnd()); + assertEquals(history.getProcessFlag(), actual.getProcessFlag()); + assertEquals(getUser(), actual.getUser()); + } + + @Test + @DisplayName("アプリケーション実行履歴を削除できる") + void shouldDeleteAuditLog() { + ApplicationExecutionHistory history = getHistory(); + repository.save(history); + + repository.deleteById(history.getId()); + + Optional actual = repository.findById(history.getId()); + assertEquals(Optional.empty(), actual); + } +} diff --git a/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditServiceTest.java new file mode 100644 index 00000000..b925c4d2 --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/system/audit/AuditServiceTest.java @@ -0,0 +1,214 @@ +package com.example.sms.service.system.audit; + +import com.example.sms.IntegrationTest; +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistoryList; +import com.example.sms.domain.model.system.user.User; +import com.example.sms.domain.model.system.user.UserId; +import com.example.sms.domain.type.audit.ApplicationExecutionHistoryType; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessFlag; +import com.example.sms.domain.type.audit.ApplicationExecutionProcessType; +import com.example.sms.domain.type.user.RoleName; +import com.example.sms.service.system.auth.AuthApiService; +import com.example.sms.service.system.user.UserManagementService; +import com.github.pagehelper.PageInfo; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.mockStatic; + +@IntegrationTest +@DisplayName("監査サービス") +public class AuditServiceTest { + @Autowired + AuditService auditService; + @Autowired + UserManagementService userManagementService; + + @Autowired + TestDataFactory testDataFactory; + + @BeforeEach + void setUp() { + testDataFactory.setUpForAuditService(); + } + + @Nested + @DisplayName("アプリケーション実行履歴") + class ApplicationExecutionHistoryTests { + @Test + @DisplayName("アプリケーション実行履歴一覧を取得できる") + void getApplicationExecutionHistoryList() { + ApplicationExecutionHistoryList result = auditService.selectAll(); + assertEquals(2, result.asList().size()); + } + + @Test + @DisplayName("アプリケーション実行履歴を登録できる") + void registerApplicationExecutionHistory() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, "その他", "9999", ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + + ApplicationExecutionHistoryList result = auditService.selectAll(); + + assertEquals(3, result.asList().size()); + assertEquals(userId, result.asList().get(2).getUser().getUserId()); + } + + @Test + @DisplayName("アプリケーション実行履歴を取得できる") + void getApplicationExecutionHistory() { + UserId userId = UserId.of("U777777"); + User user = User.of(userId.getValue(), "$2a$10$oxSJl.keBwxmsMLkcT9lPeAIxfNTPNQxpeywMrF7A3kVszwUTqfTK", "first", "last", RoleName.USER); + userManagementService.register(user); + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(1, "その他", "9999", ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", user); + auditService.register(applicationExecutionHistory, userId); + + ApplicationExecutionHistory result = auditService.find(String.valueOf(1)); + + assertEquals(applicationExecutionHistory, result); + } + + @Test + @DisplayName("アプリケーション実行履歴をページングで取得できる") + void getApplicationExecutionHistoryWithPageInfo() { + assertEquals(2, auditService.selectAllWithPageInfo().getSize()); + } + + @Nested + @DisplayName("アプリケーション実行履歴を検索できる") + class SearchApplicationExecutionHistoryTests { + @Test + @DisplayName("3条件が全て一致するアプリケーション実行履歴を検索できる") + void case1() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, ApplicationExecutionProcessType.ユーザー登録.getName(), ApplicationExecutionProcessType.ユーザー登録.getCode(), ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + AuditCriteria criteria = AuditCriteria.of(ApplicationExecutionProcessType.ユーザー登録, ApplicationExecutionHistoryType.同期, ApplicationExecutionProcessFlag.未実行); + + PageInfo result = auditService.searchWithPageInfo(criteria); + + assertEquals(1, result.getSize()); + assertEquals(ApplicationExecutionProcessType.ユーザー登録, result.getList().get(0).getProcess().getProcessType()); + assertEquals(ApplicationExecutionProcessFlag.未実行, result.getList().get(0).getProcessFlag()); + assertEquals(ApplicationExecutionHistoryType.同期, result.getList().get(0).getType()); + } + @Test + @DisplayName("2条件が一致するアプリケーション実行履歴を検索できる") + void case2() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, ApplicationExecutionProcessType.ユーザー登録.getName(), ApplicationExecutionProcessType.ユーザー登録.getCode(), ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + AuditCriteria criteria = AuditCriteria.of(ApplicationExecutionProcessType.ユーザー登録, ApplicationExecutionHistoryType.同期, null); + + PageInfo result = auditService.searchWithPageInfo(criteria); + + assertEquals(1, result.getSize()); + assertEquals(ApplicationExecutionProcessType.ユーザー登録, result.getList().get(0).getProcess().getProcessType()); + assertEquals(ApplicationExecutionHistoryType.同期, result.getList().get(0).getType()); + } + @Test + @DisplayName("1条件が一致するアプリケーション実行履歴を検索できる") + void case3() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, ApplicationExecutionProcessType.ユーザー登録.getName(), ApplicationExecutionProcessType.ユーザー登録.getCode(), ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + AuditCriteria criteria = AuditCriteria.of(ApplicationExecutionProcessType.ユーザー登録, null, null); + + PageInfo result = auditService.searchWithPageInfo(criteria); + + assertEquals(1, result.getSize()); + assertEquals(ApplicationExecutionProcessType.ユーザー登録, result.getList().get(0).getProcess().getProcessType()); + } + @Test + @DisplayName("条件なしの場合はアプリケーション実行履歴を全件検索できる") + void case4() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, ApplicationExecutionProcessType.ユーザー登録.getName(), ApplicationExecutionProcessType.ユーザー登録.getCode(), ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + AuditCriteria criteria = AuditCriteria.of(null, null, null); + + PageInfo result = auditService.searchWithPageInfo(criteria); + + assertEquals(3, result.getSize()); + } + @Test + @DisplayName("条件に一致するアプリケーション実行履歴が存在しない場合は空のリストを返す") + void case5() { + ApplicationExecutionHistory applicationExecutionHistory = ApplicationExecutionHistory.of(null, ApplicationExecutionProcessType.ユーザー登録.getName(), ApplicationExecutionProcessType.ユーザー登録.getCode(), ApplicationExecutionHistoryType.同期, LocalDateTime.of(2024,1,1,1,0), LocalDateTime.of(2024,1,1,2,0), ApplicationExecutionProcessFlag.未実行, "processDetails", null); + UserId userId = UserId.of("U777777"); + auditService.register(applicationExecutionHistory, userId); + AuditCriteria criteria = AuditCriteria.of(ApplicationExecutionProcessType.商品登録, ApplicationExecutionHistoryType.非同期, ApplicationExecutionProcessFlag.実行済); + + PageInfo result = auditService.searchWithPageInfo(criteria); + + assertEquals(0, result.getSize()); + } + } + + @Test + @DisplayName("実行ユーザーを削除した場合は、アプリケーション実行履歴の実行ユーザーはnullになる") + void deleteExecutionUser() { + UserId userId = UserId.of("U777777"); + userManagementService.delete(userId); + + ApplicationExecutionHistoryList result = auditService.selectAll(); + boolean isUserDeleted = result.asList().stream().anyMatch(a -> a.getUser() == null); + assertTrue(isUserDeleted); + } + + @Test + @DisplayName("アプリケーション実行履歴の記録を開始できる") + void startApplicationExecutionHistory() { + try (MockedStatic authApiServiceMockedStatic = mockStatic(AuthApiService.class)) { + authApiServiceMockedStatic.when(AuthApiService::getCurrentUserId).thenReturn(UserId.of("U777777")); + + ApplicationExecutionHistory result = auditService.start(ApplicationExecutionProcessType.その他, ApplicationExecutionHistoryType.同期); + + assertNotNull(result.getId()); + assertEquals(ApplicationExecutionProcessFlag.実行中, result.getProcessFlag()); + } + } + + @Test + @DisplayName("アプリケーション実行履歴の記録を終了できる") + void endApplicationExecutionHistory() { + try (MockedStatic authApiServiceMockedStatic = mockStatic(AuthApiService.class)) { + authApiServiceMockedStatic.when(AuthApiService::getCurrentUserId).thenReturn(UserId.of("U777777")); + ApplicationExecutionHistory history = auditService.start(ApplicationExecutionProcessType.その他, ApplicationExecutionHistoryType.同期); + + auditService.end(history); + + ApplicationExecutionHistory result = auditService.find(String.valueOf(history.getId())); + assertNotNull(result.getProcessEnd()); + assertEquals(ApplicationExecutionProcessFlag.実行済, result.getProcessFlag()); + } + } + + @Test + @DisplayName("アプリケーション実行履歴の記録をエラーで終了できる") + void errorApplicationExecutionHistory() { + try (MockedStatic authApiServiceMockedStatic = mockStatic(AuthApiService.class)) { + authApiServiceMockedStatic.when(AuthApiService::getCurrentUserId).thenReturn(UserId.of("U777777")); + ApplicationExecutionHistory history = auditService.start(ApplicationExecutionProcessType.その他, ApplicationExecutionHistoryType.同期); + + auditService.error(history, "error message"); + + ApplicationExecutionHistory result = auditService.find(String.valueOf(history.getId())); + assertNotNull(result.getProcessEnd()); + assertEquals(ApplicationExecutionProcessFlag.エラー, result.getProcessFlag()); + assertEquals("error message", result.getProcessDetails()); + } + } + + } +} diff --git a/api/src/test/java/com/example/sms/service/system/auth/AuthApiServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/auth/AuthApiServiceTest.java similarity index 100% rename from api/src/test/java/com/example/sms/service/system/auth/AuthApiServiceTest.java rename to app/backend/api/src/test/java/com/example/sms/service/system/auth/AuthApiServiceTest.java diff --git a/api/src/test/java/com/example/sms/service/system/auth/AuthServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/auth/AuthServiceTest.java similarity index 100% rename from api/src/test/java/com/example/sms/service/system/auth/AuthServiceTest.java rename to app/backend/api/src/test/java/com/example/sms/service/system/auth/AuthServiceTest.java diff --git a/app/backend/api/src/test/java/com/example/sms/service/system/download/DownloadServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/download/DownloadServiceTest.java new file mode 100644 index 00000000..db7e9f20 --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/service/system/download/DownloadServiceTest.java @@ -0,0 +1,145 @@ +package com.example.sms.service.system.download; + +import com.example.sms.IntegrationTest; +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.system.download.*; +import com.example.sms.domain.type.product.*; +import com.example.sms.infrastructure.datasource.system.download.DepartmentDownloadCSV; +import com.example.sms.infrastructure.datasource.system.download.EmployeeDownloadCSV; +import com.example.sms.infrastructure.datasource.system.download.ProductDownloadCSV; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.test.context.support.WithMockUser; + +import java.time.LocalDateTime; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +@IntegrationTest +@DisplayName("データダウンロードサービス") +public class DownloadServiceTest { + + @Autowired + DownloadService downloadService; + + @Autowired + TestDataFactory testDataFactory; + + @BeforeEach + void setUp() { + testDataFactory.setUpForDownloadService(); + } + + @Nested + @DisplayName("部門") + @WithMockUser(username = "admin", roles = "ADMIN") + class DepartmentDownload { + @Test + @DisplayName("件数取得") + void testCount() { + DownloadCriteria condition = Department.of(); + int result = downloadService.count(condition); + + assertEquals(3, result); + } + + @Test + @DisplayName("データダウンロード変換") + void testDownload() { + DownloadCriteria condition = Department.of(); + List rawResult = downloadService.convert(condition); + + List result = rawResult.stream() + .filter(DepartmentDownloadCSV.class::isInstance) + .map(DepartmentDownloadCSV.class::cast) + .toList(); + + assertFalse(result.isEmpty()); + assertEquals("30000", result.getFirst().getDepartmentCode()); + assertEquals(LocalDateTime.of(2021,1,1,0, 0), result.getFirst().getDepartmentStartDate()); + assertEquals(LocalDateTime.of(9999,12,31,0, 0), result.getFirst().getDepartmentEndDate()); + assertEquals("部門3", result.getFirst().getDepartmentName()); + } + } + @Nested + @DisplayName("社員") + @WithMockUser(username = "admin", roles = "ADMIN") + class EmployeeDownload { + @Test + @DisplayName("件数取得") + void testCount() { + DownloadCriteria condition = Employee.of(); + int result = downloadService.count(condition); + + assertEquals(3, result); + } + + @Test + @DisplayName("データダウンロード変換") + void testDownload() { + DownloadCriteria condition = Employee.of(); + List rawResult = downloadService.convert(condition); + + List result = rawResult.stream() + .filter(EmployeeDownloadCSV.class::isInstance) + .map(EmployeeDownloadCSV.class::cast) + .toList(); + + assertFalse(result.isEmpty()); + assertEquals("EMP003", result.getFirst().getEmployeeCode()); + assertEquals("30000", result.getFirst().getDepartmentCode()); + assertEquals(LocalDateTime.of(2021,1,1,0, 0), result.getFirst().getStartDate()); + assertEquals("firstName lastName", result.getFirst().getEmployeeName()); + assertEquals("firstNameKana lastNameKana", result.getFirst().getEmployeeNameKana()); + assertEquals("090-1234-5678", result.getFirst().getPhoneNumber()); + assertEquals("03-1234-5678", result.getFirst().getFaxNumber()); + assertEquals("U999999", result.getFirst().getUserId()); + } + } + @Nested + @DisplayName("商品分類") + @WithMockUser(username = "admin", roles = "ADMIN") + class ProductCategoryDownload { + @Test + @DisplayName("件数取得") + void testCount() { + DownloadCriteria condition = Product.of(); + int result = downloadService.count(condition); + + assertEquals(3, result); + } + + @Test + @DisplayName("データダウンロード変換") + void testDownload() { + DownloadCriteria condition = Product.of(); + List rawResult = downloadService.convert(condition); + + List result = rawResult.stream() + .filter(ProductDownloadCSV.class::isInstance) + .map(ProductDownloadCSV.class::cast) + .toList(); + + assertFalse(result.isEmpty()); + assertEquals("99999999", result.getFirst().getProductCode()); + assertEquals("商品1", result.getFirst().getProductFormalName()); + assertEquals("商品1", result.getFirst().getProductAbbreviation()); + assertEquals("ショウヒンイチ", result.getFirst().getProductNameKana()); + assertEquals(ProductType.その他.getCode(), result.getFirst().getProductCategory()); + assertEquals(900, result.getFirst().getSalesPrice().intValue()); + assertEquals(810, result.getFirst().getPurchasePrice().intValue()); + assertEquals(90, result.getFirst().getCostOfGoodsSold().intValue()); + assertEquals(TaxType.その他.getCode(), result.getFirst().getTaxCategory()); + assertEquals("カテゴリ9", result.getFirst().getProductCategoryCode()); + assertEquals(MiscellaneousType.適用外.getCode(), result.getFirst().getMiscellaneousCategory()); + assertEquals(StockManagementTargetType.対象.getCode(), result.getFirst().getInventoryManagementCategory()); + assertEquals(StockAllocationType.引当済.getCode(), result.getFirst().getInventoryAllocationCategory()); + assertEquals("サプライヤ9", result.getFirst().getSupplierCode()); + assertEquals(9, result.getFirst().getSupplierBranchNumber()); + } + } +} diff --git a/api/src/test/java/com/example/sms/service/system/user/UserManagementServiceTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/user/UserManagementServiceTest.java similarity index 100% rename from api/src/test/java/com/example/sms/service/system/user/UserManagementServiceTest.java rename to app/backend/api/src/test/java/com/example/sms/service/system/user/UserManagementServiceTest.java diff --git a/api/src/test/java/com/example/sms/service/system/user/UserRepositoryTest.java b/app/backend/api/src/test/java/com/example/sms/service/system/user/UserRepositoryTest.java similarity index 100% rename from api/src/test/java/com/example/sms/service/system/user/UserRepositoryTest.java rename to app/backend/api/src/test/java/com/example/sms/service/system/user/UserRepositoryTest.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/UC001Stepdefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC001Stepdefs.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/UC001Stepdefs.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC001Stepdefs.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/UC002StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC002StepDefs.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/UC002StepDefs.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC002StepDefs.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java similarity index 81% rename from api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java index fb788cdb..3fc51003 100644 --- a/api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java +++ b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC003StepDefs.java @@ -4,6 +4,7 @@ import com.example.sms.domain.model.master.department.Department; import com.example.sms.domain.type.department.DepartmentLowerType; import com.example.sms.domain.type.department.SlitYnType; +import com.example.sms.presentation.api.master.department.DepartmentCriteriaResource; import com.example.sms.presentation.api.master.department.DepartmentResource; import com.example.sms.stepdefinitions.utils.ListResponse; import com.example.sms.stepdefinitions.utils.MessageResponse; @@ -19,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; -import java.time.LocalDateTime; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -80,10 +80,7 @@ public void toShow(String message) throws JsonProcessingException { } @もし(":UC003 部門コード {string} 部門名 {string} で新規登録する") - public void toRegist(String code, String name) throws IOException { - String url = DEPARTMENT_API_URL; - LocalDateTime from = LocalDateTime.of(2021, 1, 1, 0, 0, 0); - LocalDateTime to = LocalDateTime.of(2021, 12, 31, 23, 59, 59); + public void toRegister(String code, String name) throws IOException { DepartmentResource departmentResource = new DepartmentResource(); departmentResource.setDepartmentCode(code); departmentResource.setStartDate("2021-01-01T00:00:00+09:00"); @@ -96,7 +93,7 @@ public void toRegist(String code, String name) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String json = objectMapper.writeValueAsString(departmentResource); - executePost(url, json); + executePost(DEPARTMENT_API_URL, json); } @もし(":UC003 部門コード {string} で検索する") @@ -138,4 +135,27 @@ public void toDelete(String code) throws IOException { String url = DEPARTMENT_API_URL + "/" + code + "/" + from; executeDelete(url); } + + @もし(":UC003 開始期間を {string} から {string} で検索する") + public void searchByCriteria(String from, String to) throws IOException { + String url = DEPARTMENT_API_URL + "/search"; + DepartmentCriteriaResource departmentCriteriaResource = new DepartmentCriteriaResource(); + departmentCriteriaResource.setStartDate(from); + departmentCriteriaResource.setEndDate(to); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(departmentCriteriaResource); + executePost(url, json); + } + + @ならば(":UC003 検索結果一覧を取得できる") + public void canFetch() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List departmentList = response.getList(); + assertEquals(2, departmentList.size()); + } } diff --git a/api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java similarity index 83% rename from api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java index 304428fd..4e32a823 100644 --- a/api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java +++ b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC004StepDefs.java @@ -2,6 +2,7 @@ import com.example.sms.TestDataFactory; import com.example.sms.domain.model.master.employee.Employee; +import com.example.sms.presentation.api.master.employee.EmployeeCriteriaResource; import com.example.sms.presentation.api.master.employee.EmployeeResource; import com.example.sms.stepdefinitions.utils.ListResponse; import com.example.sms.stepdefinitions.utils.MessageResponse; @@ -139,4 +140,26 @@ public void toDelete(String code) throws IOException { String url = EMPLOYEE_API_URL + "/" + code; executeDelete(url); } + + @もし(":UC004 社員名 {string} で検索する") + public void searchByCriteria(String name) throws IOException { + String url = EMPLOYEE_API_URL + "/search"; + EmployeeCriteriaResource employeeCriteriaResource = new EmployeeCriteriaResource(); + employeeCriteriaResource.setEmployeeFirstName(name); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(employeeCriteriaResource); + executePost(url, json); + } + + @ならば(":UC004 検索結果一覧を取得できる") + public void catFetch() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List employeeList = response.getList(); + assertEquals(2, employeeList.size()); + } } diff --git a/api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java similarity index 80% rename from api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java index 3f25ea2e..be95693b 100644 --- a/api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java +++ b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC005StepDefs.java @@ -4,7 +4,9 @@ import com.example.sms.domain.model.master.product.Product; import com.example.sms.domain.model.master.product.ProductCategory; import com.example.sms.domain.type.product.*; +import com.example.sms.presentation.api.master.product.ProductCategoryCriteriaResource; import com.example.sms.presentation.api.master.product.ProductCategoryResource; +import com.example.sms.presentation.api.master.product.ProductCriteriaResource; import com.example.sms.presentation.api.master.product.ProductResource; import com.example.sms.stepdefinitions.utils.ListResponse; import com.example.sms.stepdefinitions.utils.MessageResponse; @@ -214,4 +216,48 @@ public void toDeleteCategory(String code) throws IOException { String url = PRODUCT_CATEGORIES_API_URL + "/" + code; executeDelete(url); } + + @もし(":UC005 商品区分 {string} で検索する") + public void searchByCriteria(String name) throws IOException { + String url = PRODUCTS_API_URL + "/search"; + ProductCriteriaResource productCriteriaResource = new ProductCriteriaResource(); + productCriteriaResource.setProductType(name); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(productCriteriaResource); + executePost(url, json); + } + + @ならば(":UC005 商品検索結果一覧を取得できる") + public void catFetch() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List productList = response.getList(); + assertEquals(3, productList.size()); + } + + @もし(":UC005 商品分類パス {string} で検索する") + public void searchByCriteria2(String name) throws IOException { + String url = PRODUCT_CATEGORIES_API_URL + "/search"; + ProductCategoryCriteriaResource productCategoryCriteriaResource = new ProductCategoryCriteriaResource(); + productCategoryCriteriaResource.setProductCategoryPath(name); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(productCategoryCriteriaResource); + executePost(url, json); + } + + @ならば(":UC005 商品分類検索結果一覧を取得できる") + public void catFetch2() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List productCategoryList = response.getList(); + assertEquals(2, productCategoryList.size()); + } } diff --git a/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC006StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC006StepDefs.java new file mode 100644 index 00000000..3f58ee36 --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC006StepDefs.java @@ -0,0 +1,107 @@ +package com.example.sms.stepdefinitions; + +import com.example.sms.TestDataFactory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionHistory; +import com.example.sms.domain.model.system.audit.ApplicationExecutionProcess; +import com.example.sms.presentation.api.system.audit.AuditCriteriaResource; +import com.example.sms.stepdefinitions.utils.ListResponse; +import com.example.sms.stepdefinitions.utils.MessageResponse; +import com.example.sms.stepdefinitions.utils.SpringAcceptanceTest; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.cucumber.java.ja.ならば; +import io.cucumber.java.ja.もし; +import io.cucumber.java.ja.前提; + +import java.io.IOException; +import java.util.List; + +import com.fasterxml.jackson.core.type.TypeReference; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class UC006StepDefs extends SpringAcceptanceTest { + private static final String PORT = "8079"; + private static final String HOST = "http://localhost:" + PORT; + private static final String AUTH_API_URL = HOST + "/api/auth"; + private static final String AUDIT_API_URL = HOST + "/api/audits"; + + @Autowired + TestDataFactory testDataFactory; + + @前提(":UC006 {string} である") + public void login(String user) { + String url = AUTH_API_URL + "/" + "signin"; + + if (user.equals("管理者")) { + signin("U888888", "demo", url); + } else { + signin("U999999", "demo", url); + } + } + + @前提(":UC006 アプリケーションが実行されている") + public void exec() { + testDataFactory.setUpForAuditService(); + } + + @もし(":UC006 {string} を取得する") + public void toGet(String list) throws IOException { + if (list.equals("アプリケーション実行履歴")) { + executeGet(AUDIT_API_URL); + } + } + + @ならば(":UC006 {string} を取得できる") + public void catGet(String list) throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + String result; + + if (list.equals("アプリケーション実行履歴一覧")) { + result = latestResponse.getBody(); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List applicationExecutionHistoryList = response.getList(); + assertEquals(2, applicationExecutionHistoryList.size()); + } + } + + @もし(":UC006 アプリケーション実行履歴を検索する") + public void search() throws IOException { + String url = AUDIT_API_URL + "/search"; + AuditCriteriaResource auditCriteriaResource = new AuditCriteriaResource(); + auditCriteriaResource.setProcess(ApplicationExecutionProcess.of("その他", "9999")); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(auditCriteriaResource); + executePost(url, json); + } + + @ならば(":UC006 アプリケーション実行履歴を取得できる") + public void fetch() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + ListResponse response = objectMapper.readValue(result, new TypeReference<>() { + }); + List applicationExecutionHistoryList = response.getList(); + assertEquals(2, applicationExecutionHistoryList.size()); + } + + @もし(":UC006 アプリケーション実行履歴を削除する") + public void delete() throws IOException { + String url = AUDIT_API_URL + "/" + "1"; + executeDelete(url); + } + + @ならば(":UC006 {string} が表示される") + public void toShow(String message) throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + MessageResponse response = objectMapper.readValue(result, MessageResponse.class); + assertEquals(message, response.getMessage()); + } +} diff --git a/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC007StepDefs.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC007StepDefs.java new file mode 100644 index 00000000..e278bde8 --- /dev/null +++ b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/UC007StepDefs.java @@ -0,0 +1,88 @@ +package com.example.sms.stepdefinitions; + +import com.example.sms.TestDataFactory; +import com.example.sms.domain.type.download.DownloadTarget; +import com.example.sms.presentation.api.system.auth.payload.response.MessageResponse; +import com.example.sms.presentation.api.system.download.DownloadConditionResource; +import com.example.sms.stepdefinitions.utils.SpringAcceptanceTest; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.cucumber.java.ja.ならば; +import io.cucumber.java.ja.もし; +import io.cucumber.java.ja.前提; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class UC007StepDefs extends SpringAcceptanceTest { + private static final String PORT = "8079"; + private static final String HOST = "http://localhost:" + PORT; + private static final String AUTH_API_URL = HOST + "/api/auth"; + private static final String DOWNLOAD_API_URL = HOST + "/api/downloads"; + + @Autowired + TestDataFactory testDataFactory; + + @前提(":UC007 {string} である") + public void login(String user) { + String url = AUTH_API_URL + "/" + "signin"; + + if (user.equals("管理者")) { + signin("U888888", "demo", url); + } else { + signin("U999999", "demo", url); + } + } + + @前提(":UC007 ダウンロードデータが存在する") + public void setUp() { + testDataFactory.setUpForDownloadService(); + } + + @もし(":UC007 {string} ダウンロード件数を取得する") + public void toGet(String target) throws IOException { + String url = DOWNLOAD_API_URL + "/count"; + DownloadConditionResource downloadConditionResource = new DownloadConditionResource(); + if (target.equals("部門")) { + downloadConditionResource = new DownloadConditionResource(); + downloadConditionResource.setTarget(DownloadTarget.部門); + } + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(downloadConditionResource); + executePost(url, json); + } + + @ならば(":UC007 ダウンロード件数を取得できる") + public void canGet() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + + String result = latestResponse.getBody(); + assertEquals("3", result); + } + + @もし(":UC007 {string} ダウンロードを実行する") + public void exec(String target) throws IOException { + String url = DOWNLOAD_API_URL + "/download"; + DownloadConditionResource downloadConditionResource = new DownloadConditionResource(); + if (target.equals("部門")) { + downloadConditionResource = new DownloadConditionResource(); + downloadConditionResource.setTarget(DownloadTarget.部門); + } + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(downloadConditionResource); + executePost(url, json); + } + + @ならば(":UC007 ダウンロードデータが作成される") + public void toShow() throws JsonProcessingException { + String result = latestResponse.getBody(); + ObjectMapper objectMapper = new ObjectMapper(); + MessageResponse response = objectMapper.readValue(result, MessageResponse.class); + assertNotNull(response); + } +} diff --git a/api/src/test/java/com/example/sms/stepdefinitions/utils/HeaderSettingRequestCallback.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/HeaderSettingRequestCallback.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/utils/HeaderSettingRequestCallback.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/HeaderSettingRequestCallback.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/utils/ListResponse.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/ListResponse.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/utils/ListResponse.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/ListResponse.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/utils/MessageResponse.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/MessageResponse.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/utils/MessageResponse.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/MessageResponse.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/utils/ResponseResults.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/ResponseResults.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/utils/ResponseResults.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/ResponseResults.java diff --git a/api/src/test/java/com/example/sms/stepdefinitions/utils/SpringAcceptanceTest.java b/app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/SpringAcceptanceTest.java similarity index 100% rename from api/src/test/java/com/example/sms/stepdefinitions/utils/SpringAcceptanceTest.java rename to app/backend/api/src/test/java/com/example/sms/stepdefinitions/utils/SpringAcceptanceTest.java diff --git a/app/backend/api/src/test/resources/allure.properties b/app/backend/api/src/test/resources/allure.properties new file mode 100644 index 00000000..cb77d0a3 --- /dev/null +++ b/app/backend/api/src/test/resources/allure.properties @@ -0,0 +1 @@ +allure.results.directory=build/allure-results \ No newline at end of file diff --git a/app/backend/api/src/test/resources/application-container.properties b/app/backend/api/src/test/resources/application-container.properties new file mode 100644 index 00000000..ef559477 --- /dev/null +++ b/app/backend/api/src/test/resources/application-container.properties @@ -0,0 +1,26 @@ +spring.application.name=sms +spring.datasource.url=jdbc:postgresql://localhost:5432/mydb +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.username=root +spring.datasource.password=password +spring.jpa.hibernate.ddl-auto=validate +spring.jpa.properties.hibernate.forma_sql=true +spring.sql.init.encoding=UTF-8 +logging.level.org.hibernate.SQL=DEBUG +logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE +spring.sql.init.mode=always +spring.jpa.open-in-view=true +spring.flyway.clean-disabled=false +spring.flyway.enabled=true +spring.flyway.schemas=public +spring.flyway.locations=classpath:/db/migration/postgresql +# swagger-ui custom path +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.packages-to-scan=com.example.sms.presentation.api +springdoc.paths-to-match=/api/** +# App Properties +sms.jwtSecret=raukSSizGSvoHnsj7Q2HbH8OhBMRJd+DB/mVtc3qA8k= +sms.jwtExpirationMs=86400000 +# Jackson +spring.jackson.date-format=yyyy-MM-dd'T'HH:mm:ss +spring.jackson.time-zone=Asia/Tokyo diff --git a/api/src/main/resources/application.properties b/app/backend/api/src/test/resources/application.properties similarity index 98% rename from api/src/main/resources/application.properties rename to app/backend/api/src/test/resources/application.properties index d3eaffdc..e80a95f4 100644 --- a/api/src/main/resources/application.properties +++ b/app/backend/api/src/test/resources/application.properties @@ -23,3 +23,4 @@ logging.level.com.example.sms.infrastructure.datasource=TRACE # Jackson spring.jackson.date-format=yyyy-MM-dd'T'HH:mm:ss spring.jackson.time-zone=Asia/Tokyo +server.port=8079 \ No newline at end of file diff --git a/api/src/test/resources/features/master/Department.feature b/app/backend/api/src/test/resources/features/master/Department.feature similarity index 88% rename from api/src/test/resources/features/master/Department.feature rename to app/backend/api/src/test/resources/features/master/Department.feature index d9fe057e..805c3298 100644 --- a/api/src/test/resources/features/master/Department.feature +++ b/app/backend/api/src/test/resources/features/master/Department.feature @@ -35,3 +35,7 @@ もし:UC003 部門コード "90000" 部門名 "営業部" で新規登録する かつ:UC003 部門コード "90000" を削除する ならば:UC003 "部門を削除しました" が表示される + + シナリオ: 部門を検索する + もし:UC003 開始期間を "2021-01-01T00:00:00+09:00" から "9999-12-31T00:00:00+09:00" で検索する + ならば:UC003 検索結果一覧を取得できる diff --git a/api/src/test/resources/features/master/Employee.feature b/app/backend/api/src/test/resources/features/master/Employee.feature similarity index 82% rename from api/src/test/resources/features/master/Employee.feature rename to app/backend/api/src/test/resources/features/master/Employee.feature index 50838cf2..76e5384d 100644 --- a/api/src/test/resources/features/master/Employee.feature +++ b/app/backend/api/src/test/resources/features/master/Employee.feature @@ -36,3 +36,9 @@ もし:UC004 社員コード "EMP999" 社員名 "山田 太郎" 社員名カナ "ヤマダ タロウ" で新規登録する かつ:UC004 社員コード "EMP999" を削除する ならば:UC004 "社員を削除しました" が表示される + + シナリオ: 社員を検索する + もし:UC004 社員コード "EMP999" 社員名 "山田 太郎" 社員名カナ "ヤマダ タロウ" で新規登録する + もし:UC004 社員コード "EMP998" 社員名 "山田 ジロウ" 社員名カナ "ヤマダ ジロウ" で新規登録する + もし:UC004 社員名 "山田" で検索する + ならば:UC004 検索結果一覧を取得できる diff --git a/api/src/test/resources/features/master/Product.feature b/app/backend/api/src/test/resources/features/master/Product.feature similarity index 89% rename from api/src/test/resources/features/master/Product.feature rename to app/backend/api/src/test/resources/features/master/Product.feature index 475464bb..30375068 100644 --- a/api/src/test/resources/features/master/Product.feature +++ b/app/backend/api/src/test/resources/features/master/Product.feature @@ -36,6 +36,10 @@ かつ:UC005 商品コード "10101001" を削除する ならば:UC005 "商品を削除しました" が表示される + シナリオ: 商品を検索する + もし:UC005 商品区分 "その他" で検索する + ならば:UC005 商品検索結果一覧を取得できる + シナリオ: 商品分類一覧を取得する もし:UC005 "商品分類一覧" を取得する ならば:UC005 "商品分類一覧" を取得できる @@ -60,3 +64,8 @@ もし:UC005 商品分類コード "00101000" 商品分類名 "食肉" で新規登録する かつ:UC005 商品分類コード "00101000" を削除する ならば:UC005 "商品分類を削除しました" が表示される + + シナリオ: 商品分類を検索する + もし:UC005 商品分類パス "カテゴリ1" で検索する + ならば:UC005 商品分類検索結果一覧を取得できる + diff --git a/app/backend/api/src/test/resources/features/system/Audit.feature b/app/backend/api/src/test/resources/features/system/Audit.feature new file mode 100644 index 00000000..48cc9720 --- /dev/null +++ b/app/backend/api/src/test/resources/features/system/Audit.feature @@ -0,0 +1,24 @@ +# language: ja + +機能: 監査 + + 管理者として + アプリケーションの実行履歴を把握したい + なぜならユーザーの操作履歴を監査する必要があるから + + 背景: + 前提:UC001 ユーザーが登録されている + 前提:UC006 "管理者" である + 前提:UC006 アプリケーションが実行されている + + シナリオ: 実行履歴一覧を取得する + もし:UC006 "アプリケーション実行履歴" を取得する + ならば:UC006 "アプリケーション実行履歴一覧" を取得できる + + シナリオ: 実行履歴を取得する + もし:UC006 アプリケーション実行履歴を検索する + ならば:UC006 アプリケーション実行履歴を取得できる + + シナリオ: 実行履歴を削除する + もし:UC006 アプリケーション実行履歴を削除する + ならば:UC006 "アプリケーション実行履歴を削除しました" が表示される diff --git a/api/src/test/resources/features/system/Auth.feature b/app/backend/api/src/test/resources/features/system/Auth.feature similarity index 100% rename from api/src/test/resources/features/system/Auth.feature rename to app/backend/api/src/test/resources/features/system/Auth.feature diff --git a/app/backend/api/src/test/resources/features/system/Download.feature b/app/backend/api/src/test/resources/features/system/Download.feature new file mode 100644 index 00000000..a97779c1 --- /dev/null +++ b/app/backend/api/src/test/resources/features/system/Download.feature @@ -0,0 +1,20 @@ +# language: ja + +機能: ダウンロード + + 管理者として + アプリケーションのダウンロードを実行したい + なぜならデータを加工するために必要だから + + 背景: + 前提:UC001 ユーザーが登録されている + 前提:UC007 "管理者" である + 前提:UC007 ダウンロードデータが存在する + + シナリオ: ダウンロード件数を取得する + もし:UC007 "部門" ダウンロード件数を取得する + ならば:UC007 ダウンロード件数を取得できる + + シナリオ: ダウンロードを実行する + もし:UC007 "部門" ダウンロードを実行する + ならば:UC007 ダウンロードデータが作成される diff --git a/api/src/test/resources/features/system/User.feature b/app/backend/api/src/test/resources/features/system/User.feature similarity index 100% rename from api/src/test/resources/features/system/User.feature rename to app/backend/api/src/test/resources/features/system/User.feature diff --git a/api/src/test/resources/jig.properties b/app/backend/api/src/test/resources/jig.properties similarity index 100% rename from api/src/test/resources/jig.properties rename to app/backend/api/src/test/resources/jig.properties diff --git a/api/system.properties b/app/backend/api/system.properties similarity index 100% rename from api/system.properties rename to app/backend/api/system.properties diff --git a/app/cypress.config.cjs b/app/cypress.config.cjs deleted file mode 100644 index 1d7c590e..00000000 --- a/app/cypress.config.cjs +++ /dev/null @@ -1,9 +0,0 @@ -const {defineConfig} = require("cypress"); - -module.exports = defineConfig({ - e2e: { - setupNodeEvents(on, config) { - // implement node event listeners here - }, - }, -}); diff --git a/app/.babelrc b/app/frontend/.babelrc similarity index 100% rename from app/.babelrc rename to app/frontend/.babelrc diff --git a/app/.gitignore b/app/frontend/.gitignore similarity index 79% rename from app/.gitignore rename to app/frontend/.gitignore index f3f1fcac..c0538d31 100644 --- a/app/.gitignore +++ b/app/frontend/.gitignore @@ -25,4 +25,8 @@ dist-ssr .vercel -cypress/screenshots +frontend/cypress/screenshots +frontend/cypress/downloads + +.env +.env.* diff --git a/app/README.md b/app/frontend/README.md similarity index 100% rename from app/README.md rename to app/frontend/README.md diff --git a/app/frontend/cypress.config.cjs b/app/frontend/cypress.config.cjs new file mode 100644 index 00000000..2901cffc --- /dev/null +++ b/app/frontend/cypress.config.cjs @@ -0,0 +1,12 @@ +const { allureCypress } = require("allure-cypress/reporter"); + +module.exports = { + e2e: { + setupNodeEvents(on, config) { + allureCypress(on, config, { + resultsDir: "allure-results", + }); + return config; + }, + }, +}; \ No newline at end of file diff --git a/app/cypress/e2e/master/Department.cy.js b/app/frontend/cypress/e2e/master/Department.cy.js similarity index 90% rename from app/cypress/e2e/master/Department.cy.js rename to app/frontend/cypress/e2e/master/Department.cy.js index 46256946..f87a6fa5 100644 --- a/app/cypress/e2e/master/Department.cy.js +++ b/app/frontend/cypress/e2e/master/Department.cy.js @@ -35,7 +35,8 @@ describe('部門管理', () => { context('部門検索', () => { it('検索', () => { userPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#search-department-code').type('99999'); cy.wait(1000); cy.get('#search-all').click(); cy.get(':nth-child(3) > .collection-object-item-content-name').contains('テスト'); @@ -45,7 +46,8 @@ describe('部門管理', () => { context('部門登録情報編集', () => { it('登録情報編集', () => { userPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#search-department-code').type('99999'); cy.wait(1000); cy.get('#search-all').click(); cy.wait(1000); @@ -68,7 +70,8 @@ describe('部門管理', () => { context('部門削除', () => { it('削除', () => { userPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#search-department-code').type('99999'); cy.wait(1000); cy.get('#search-all').click(); cy.wait(1000); diff --git a/app/cypress/e2e/master/Employee.cy.js b/app/frontend/cypress/e2e/master/Employee.cy.js similarity index 92% rename from app/cypress/e2e/master/Employee.cy.js rename to app/frontend/cypress/e2e/master/Employee.cy.js index 6a8c0852..81806a91 100644 --- a/app/cypress/e2e/master/Employee.cy.js +++ b/app/frontend/cypress/e2e/master/Employee.cy.js @@ -36,7 +36,8 @@ describe('社員管理', () => { context('社員検索', () => { it('検索', () => { userPage(); - cy.get('#search-input').type('EMP999'); + cy.get('#search').click(); + cy.get('#empCode').type('EMP999'); cy.wait(1000); cy.get('#search-all').click(); cy.get(':nth-child(3) > .collection-object-item-content-name').contains('山田'); @@ -46,7 +47,8 @@ describe('社員管理', () => { context('社員登録情報編集', () => { it('登録情報編集', () => { userPage(); - cy.get('#search-input').type('EMP999'); + cy.get('#search').click(); + cy.get('#empCode').type('EMP999'); cy.wait(1000); cy.get('#search-all').click(); cy.get('#edit').click(); @@ -73,7 +75,8 @@ describe('社員管理', () => { context('社員削除', () => { it('削除', () => { userPage(); - cy.get('#search-input').type('EMP999'); + cy.get('#search').click(); + cy.get('#empCode').type('EMP999'); cy.wait(1000); cy.get('#search-all').click(); cy.get('#delete').click(); diff --git a/app/cypress/e2e/master/ProductCategory.cy.js b/app/frontend/cypress/e2e/master/ProductCategory.cy.js similarity index 89% rename from app/cypress/e2e/master/ProductCategory.cy.js rename to app/frontend/cypress/e2e/master/ProductCategory.cy.js index ed8b43d2..ee759284 100644 --- a/app/cypress/e2e/master/ProductCategory.cy.js +++ b/app/frontend/cypress/e2e/master/ProductCategory.cy.js @@ -27,7 +27,8 @@ describe('商品分類管理', () => { context('商品分類検索', () => { it('検索', () => { openProductCategoryPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#productCategoryCode').type('99999'); cy.get('#search-all').click(); cy.get(':nth-child(3) > .collection-object-item-content-name').contains('テストカテゴリ'); }); @@ -35,7 +36,8 @@ describe('商品分類管理', () => { context('商品分類登録情報編集', () => { it('登録情報編集', () => { openProductCategoryPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#productCategoryCode').type('99999'); cy.get('#search-all').click(); cy.get('#edit').click(); cy.get('#productCategoryName').clear(); @@ -52,7 +54,8 @@ describe('商品分類管理', () => { context('商品分類削除', () => { it('削除', () => { openProductCategoryPage(); - cy.get('#search-input').type('99999'); + cy.get('#search').click(); + cy.get('#productCategoryCode').type('99999'); cy.get('#search-all').click(); cy.get('#delete').click(); cy.get('#message').contains('商品分類を削除しました。'); diff --git a/app/cypress/e2e/master/ProductDetail.cy.js b/app/frontend/cypress/e2e/master/ProductItem.cy.js similarity index 92% rename from app/cypress/e2e/master/ProductDetail.cy.js rename to app/frontend/cypress/e2e/master/ProductItem.cy.js index 8733ea00..57a301eb 100644 --- a/app/cypress/e2e/master/ProductDetail.cy.js +++ b/app/frontend/cypress/e2e/master/ProductItem.cy.js @@ -45,7 +45,8 @@ describe('商品管理', () => { context('商品検索', () => { it('検索', () => { openProductPage(); - cy.get('#search-input').type('99999001'); + cy.get('#search').click(); + cy.get('#productCode').type('99999001'); cy.get('#search-all').click(); cy.get('.collection-object-item-content-name').contains('テスト商品正式名'); }); @@ -54,7 +55,8 @@ describe('商品管理', () => { context('商品登録情報編集', () => { it('登録情報編集', () => { openProductPage(); - cy.get('#search-input').type('99999001'); + cy.get('#search').click(); + cy.get('#productCode').type('99999001'); cy.get('#search-all').click(); cy.get('#edit').click(); @@ -82,7 +84,8 @@ describe('商品管理', () => { context('商品削除', () => { it('削除', () => { openProductPage(); - cy.get('#search-input').type('99999001'); + cy.get('#search').click(); + cy.get('#productCode').type('99999001'); cy.get('#search-all').click(); cy.get('#delete').click(); cy.get('#message').contains('商品を削除しました。'); diff --git a/app/cypress/e2e/system/Auth.cy.js b/app/frontend/cypress/e2e/system/Auth.cy.js similarity index 100% rename from app/cypress/e2e/system/Auth.cy.js rename to app/frontend/cypress/e2e/system/Auth.cy.js diff --git a/app/frontend/cypress/e2e/system/Download.cy.js b/app/frontend/cypress/e2e/system/Download.cy.js new file mode 100644 index 00000000..987daac1 --- /dev/null +++ b/app/frontend/cypress/e2e/system/Download.cy.js @@ -0,0 +1,42 @@ +describe('アプリケーションデータダウンロード', () => { + beforeEach(() => { + cy.login('U000003', 'a234567Z'); + }) + + const userPage = () => { + cy.get('#side-nav-menu > :nth-child(1) > :nth-child(2) > .nav-sub-list > .nav-sub-item > #side-nav-download-nav').click(); + } + + it('ダウンロード画面の表示', () => { + userPage(); + cy.get('.single-view-container').should('be.visible'); + }); + + it('部門データダウンロード', () => { + userPage(); + cy.get('#downloadTarget').select('部門'); + cy.get('#download').click(); + cy.get('#message').contains('部門 データをダウンロードしました。'); + }); + + it('社員データダウンロード', () => { + userPage(); + cy.get('#downloadTarget').select('社員'); + cy.get('#download').click(); + cy.get('#message').contains('社員 データをダウンロードしました。'); + }); + + it('商品分類データダウンロード', () => { + userPage(); + cy.get('#downloadTarget').select('商品分類'); + cy.get('#download').click(); + cy.get('#message').contains('商品分類 データをダウンロードしました。'); + }); + + it('商品データダウンロード', () => { + userPage(); + cy.get('#downloadTarget').select('商品'); + cy.get('#download').click(); + cy.get('#message').contains('商品 データをダウンロードしました。'); + }); +}); diff --git a/app/cypress/e2e/system/User.cy.js b/app/frontend/cypress/e2e/system/User.cy.js similarity index 100% rename from app/cypress/e2e/system/User.cy.js rename to app/frontend/cypress/e2e/system/User.cy.js diff --git a/app/cypress/fixtures/example.json b/app/frontend/cypress/fixtures/example.json similarity index 100% rename from app/cypress/fixtures/example.json rename to app/frontend/cypress/fixtures/example.json diff --git a/app/cypress/support/commands.js b/app/frontend/cypress/support/commands.js similarity index 100% rename from app/cypress/support/commands.js rename to app/frontend/cypress/support/commands.js diff --git a/app/cypress/support/e2e.js b/app/frontend/cypress/support/e2e.js similarity index 96% rename from app/cypress/support/e2e.js rename to app/frontend/cypress/support/e2e.js index c61120ce..1c31c6c7 100644 --- a/app/cypress/support/e2e.js +++ b/app/frontend/cypress/support/e2e.js @@ -14,10 +14,11 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands.js' // Alternatively you can use CommonJS syntax: // require('./commands') +import "allure-cypress"; Cypress.Commands.add('login', (username, password) => { cy.visit('http://localhost:5173/login'); diff --git a/app/eslint.config.js b/app/frontend/eslint.config.js similarity index 100% rename from app/eslint.config.js rename to app/frontend/eslint.config.js diff --git a/app/index.html b/app/frontend/index.html similarity index 100% rename from app/index.html rename to app/frontend/index.html diff --git a/app/jest.config.cjs b/app/frontend/jest.config.cjs similarity index 100% rename from app/jest.config.cjs rename to app/frontend/jest.config.cjs diff --git a/app/package-lock.json b/app/frontend/package-lock.json similarity index 94% rename from app/package-lock.json rename to app/frontend/package-lock.json index d6b6fc82..15226749 100644 --- a/app/package-lock.json +++ b/app/frontend/package-lock.json @@ -29,7 +29,8 @@ "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", - "cypress": "^13.15.1", + "allure-cypress": "^3.0.6", + "cypress": "^13.15.2", "eslint": "^9.9.0", "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.9", @@ -42,13 +43,15 @@ "ts-jest": "^29.2.5", "typescript": "^5.5.3", "typescript-eslint": "^8.0.1", - "vite": "^5.4.1" + "vite": "^5.4.1", + "vite-plugin-env-compatible": "^2.0.1", + "wait-on": "^8.0.1" } }, "node_modules/@adobe/css-tools": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz", - "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.1.tgz", + "integrity": "sha512-12WGKBQzjUAI4ayyF4IAtfw2QR/IDoqk6jTddXDhtYTJF9ASmoE1zst7cVtP0aL/F1jUJL5r+JxKXKEgHNbEUQ==", "dev": true, "license": "MIT" }, @@ -2501,9 +2504,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", - "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2516,9 +2519,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.7.0.tgz", - "integrity": "sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2526,9 +2529,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", "dependencies": { @@ -2563,9 +2566,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.14.0.tgz", - "integrity": "sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==", + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", + "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", "dev": true, "license": "MIT", "engines": { @@ -2583,9 +2586,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.2.tgz", - "integrity": "sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2595,6 +2598,23 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -3222,9 +3242,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.26.0.tgz", - "integrity": "sha512-gJNwtPDGEaOEgejbaseY6xMFu+CPltsc8/T+diUTTbOQLqD+bnrJq9ulH6WD69TqwqWmrfRAtUv30cCFZlbGTQ==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.28.0.tgz", + "integrity": "sha512-wLJuPLT6grGZsy34g4N1yRfYeouklTgPhH1gWXCYspenKYD0s3cR99ZevOGw5BexMNywkbV3UkjADisozBmpPQ==", "cpu": [ "arm" ], @@ -3236,9 +3256,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.26.0.tgz", - "integrity": "sha512-YJa5Gy8mEZgz5JquFruhJODMq3lTHWLm1fOy+HIANquLzfIOzE9RA5ie3JjCdVb9r46qfAQY/l947V0zfGJ0OQ==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.28.0.tgz", + "integrity": "sha512-eiNkznlo0dLmVG/6wf+Ifi/v78G4d4QxRhuUl+s8EWZpDewgk7PX3ZyECUXU0Zq/Ca+8nU8cQpNC4Xgn2gFNDA==", "cpu": [ "arm64" ], @@ -3250,9 +3270,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.26.0.tgz", - "integrity": "sha512-ErTASs8YKbqTBoPLp/kA1B1Um5YSom8QAc4rKhg7b9tyyVqDBlQxy7Bf2wW7yIlPGPg2UODDQcbkTlruPzDosw==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.0.tgz", + "integrity": "sha512-lmKx9yHsppblnLQZOGxdO66gT77bvdBtr/0P+TPOseowE7D9AJoBw8ZDULRasXRWf1Z86/gcOdpBrV6VDUY36Q==", "cpu": [ "arm64" ], @@ -3264,9 +3284,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.26.0.tgz", - "integrity": "sha512-wbgkYDHcdWW+NqP2mnf2NOuEbOLzDblalrOWcPyY6+BRbVhliavon15UploG7PpBRQ2bZJnbmh8o3yLoBvDIHA==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.28.0.tgz", + "integrity": "sha512-8hxgfReVs7k9Js1uAIhS6zq3I+wKQETInnWQtgzt8JfGx51R1N6DRVy3F4o0lQwumbErRz52YqwjfvuwRxGv1w==", "cpu": [ "x64" ], @@ -3278,9 +3298,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.26.0.tgz", - "integrity": "sha512-Y9vpjfp9CDkAG4q/uwuhZk96LP11fBz/bYdyg9oaHYhtGZp7NrbkQrj/66DYMMP2Yo/QPAsVHkV891KyO52fhg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.28.0.tgz", + "integrity": "sha512-lA1zZB3bFx5oxu9fYud4+g1mt+lYXCoch0M0V/xhqLoGatbzVse0wlSQ1UYOWKpuSu3gyN4qEc0Dxf/DII1bhQ==", "cpu": [ "arm64" ], @@ -3292,9 +3312,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.26.0.tgz", - "integrity": "sha512-A/jvfCZ55EYPsqeaAt/yDAG4q5tt1ZboWMHEvKAH9Zl92DWvMIbnZe/f/eOXze65aJaaKbL+YeM0Hz4kLQvdwg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.28.0.tgz", + "integrity": "sha512-aI2plavbUDjCQB/sRbeUZWX9qp12GfYkYSJOrdYTL/C5D53bsE2/nBPuoiJKoWp5SN78v2Vr8ZPnB+/VbQ2pFA==", "cpu": [ "x64" ], @@ -3306,9 +3326,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.26.0.tgz", - "integrity": "sha512-paHF1bMXKDuizaMODm2bBTjRiHxESWiIyIdMugKeLnjuS1TCS54MF5+Y5Dx8Ui/1RBPVRE09i5OUlaLnv8OGnA==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.28.0.tgz", + "integrity": "sha512-WXveUPKtfqtaNvpf0iOb0M6xC64GzUX/OowbqfiCSXTdi/jLlOmH0Ba94/OkiY2yTGTwteo4/dsHRfh5bDCZ+w==", "cpu": [ "arm" ], @@ -3320,9 +3340,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.26.0.tgz", - "integrity": "sha512-cwxiHZU1GAs+TMxvgPfUDtVZjdBdTsQwVnNlzRXC5QzIJ6nhfB4I1ahKoe9yPmoaA/Vhf7m9dB1chGPpDRdGXg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.28.0.tgz", + "integrity": "sha512-yLc3O2NtOQR67lI79zsSc7lk31xjwcaocvdD1twL64PK1yNaIqCeWI9L5B4MFPAVGEVjH5k1oWSGuYX1Wutxpg==", "cpu": [ "arm" ], @@ -3334,9 +3354,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.26.0.tgz", - "integrity": "sha512-4daeEUQutGRCW/9zEo8JtdAgtJ1q2g5oHaoQaZbMSKaIWKDQwQ3Yx0/3jJNmpzrsScIPtx/V+1AfibLisb3AMQ==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.28.0.tgz", + "integrity": "sha512-+P9G9hjEpHucHRXqesY+3X9hD2wh0iNnJXX/QhS/J5vTdG6VhNYMxJ2rJkQOxRUd17u5mbMLHM7yWGZdAASfcg==", "cpu": [ "arm64" ], @@ -3348,9 +3368,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.26.0.tgz", - "integrity": "sha512-eGkX7zzkNxvvS05ROzJ/cO/AKqNvR/7t1jA3VZDi2vRniLKwAWxUr85fH3NsvtxU5vnUUKFHKh8flIBdlo2b3Q==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.28.0.tgz", + "integrity": "sha512-1xsm2rCKSTpKzi5/ypT5wfc+4bOGa/9yI/eaOLW0oMs7qpC542APWhl4A37AENGZ6St6GBMWhCCMM6tXgTIplw==", "cpu": [ "arm64" ], @@ -3362,9 +3382,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.26.0.tgz", - "integrity": "sha512-Odp/lgHbW/mAqw/pU21goo5ruWsytP7/HCC/liOt0zcGG0llYWKrd10k9Fj0pdj3prQ63N5yQLCLiE7HTX+MYw==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.28.0.tgz", + "integrity": "sha512-zgWxMq8neVQeXL+ouSf6S7DoNeo6EPgi1eeqHXVKQxqPy1B2NvTbaOUWPn/7CfMKL7xvhV0/+fq/Z/J69g1WAQ==", "cpu": [ "ppc64" ], @@ -3376,9 +3396,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.26.0.tgz", - "integrity": "sha512-MBR2ZhCTzUgVD0OJdTzNeF4+zsVogIR1U/FsyuFerwcqjZGvg2nYe24SAHp8O5sN8ZkRVbHwlYeHqcSQ8tcYew==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.28.0.tgz", + "integrity": "sha512-VEdVYacLniRxbRJLNtzwGt5vwS0ycYshofI7cWAfj7Vg5asqj+pt+Q6x4n+AONSZW/kVm+5nklde0qs2EUwU2g==", "cpu": [ "riscv64" ], @@ -3390,9 +3410,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.26.0.tgz", - "integrity": "sha512-YYcg8MkbN17fMbRMZuxwmxWqsmQufh3ZJFxFGoHjrE7bv0X+T6l3glcdzd7IKLiwhT+PZOJCblpnNlz1/C3kGQ==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.28.0.tgz", + "integrity": "sha512-LQlP5t2hcDJh8HV8RELD9/xlYtEzJkm/aWGsauvdO2ulfl3QYRjqrKW+mGAIWP5kdNCBheqqqYIGElSRCaXfpw==", "cpu": [ "s390x" ], @@ -3404,9 +3424,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.26.0.tgz", - "integrity": "sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.0.tgz", + "integrity": "sha512-Nl4KIzteVEKE9BdAvYoTkW19pa7LR/RBrT6F1dJCV/3pbjwDcaOq+edkP0LXuJ9kflW/xOK414X78r+K84+msw==", "cpu": [ "x64" ], @@ -3418,9 +3438,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.26.0.tgz", - "integrity": "sha512-+HJD2lFS86qkeF8kNu0kALtifMpPCZU80HvwztIKnYwym3KnA1os6nsX4BGSTLtS2QVAGG1P3guRgsYyMA0Yhg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.28.0.tgz", + "integrity": "sha512-eKpJr4vBDOi4goT75MvW+0dXcNUqisK4jvibY9vDdlgLx+yekxSm55StsHbxUsRxSTt3JEQvlr3cGDkzcSP8bw==", "cpu": [ "x64" ], @@ -3432,9 +3452,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.26.0.tgz", - "integrity": "sha512-WUQzVFWPSw2uJzX4j6YEbMAiLbs0BUysgysh8s817doAYhR5ybqTI1wtKARQKo6cGop3pHnrUJPFCsXdoFaimQ==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.28.0.tgz", + "integrity": "sha512-Vi+WR62xWGsE/Oj+mD0FNAPY2MEox3cfyG0zLpotZdehPFXwz6lypkGs5y38Jd/NVSbOD02aVad6q6QYF7i8Bg==", "cpu": [ "arm64" ], @@ -3446,9 +3466,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.26.0.tgz", - "integrity": "sha512-D4CxkazFKBfN1akAIY6ieyOqzoOoBV1OICxgUblWxff/pSjCA2khXlASUx7mK6W1oP4McqhgcCsu6QaLj3WMWg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.28.0.tgz", + "integrity": "sha512-kN/Vpip8emMLn/eOza+4JwqDZBL6MPNpkdaEsgUtW1NYN3DZvZqSQrbKzJcTL6hd8YNmFTn7XGWMwccOcJBL0A==", "cpu": [ "ia32" ], @@ -3460,9 +3480,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.26.0.tgz", - "integrity": "sha512-2x8MO1rm4PGEP0xWbubJW5RtbNLk3puzAMaLQd3B3JHVw4KcHlmXcO+Wewx9zCoo7EUFiMlu/aZbCJ7VjMzAag==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.28.0.tgz", + "integrity": "sha512-Bvno2/aZT6usSa7lRDL2+hMjVAGjuqaymF1ApZm31JXzniR/hvr14jpU+/z4X6Gt5BPlzosscyJZGUvguXIqeQ==", "cpu": [ "x64" ], @@ -3473,6 +3493,30 @@ "win32" ] }, + "node_modules/@sideway/address": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", + "integrity": "sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -3778,13 +3822,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz", - "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", + "version": "22.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", + "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@types/prop-types": { @@ -3879,17 +3923,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.14.0.tgz", - "integrity": "sha512-tqp8H7UWFaZj0yNO6bycd5YjMwxa6wIHOLZvWPkidwbgLCsBMetQoGj7DPuAlWa2yGO3H48xmPwjhsSPPCGU5w==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.17.0.tgz", + "integrity": "sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/type-utils": "8.14.0", - "@typescript-eslint/utils": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/type-utils": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -3913,16 +3957,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.14.0.tgz", - "integrity": "sha512-2p82Yn9juUJq0XynBXtFCyrBDb6/dJombnz6vbo6mgQEtWHfvHbQuEa9kAOVIt1c9YFwi7H6WxtPj1kg+80+RA==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.17.0.tgz", + "integrity": "sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "debug": "^4.3.4" }, "engines": { @@ -3942,14 +3986,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.14.0.tgz", - "integrity": "sha512-aBbBrnW9ARIDn92Zbo7rguLnqQ/pOrUguVpbUwzOhkFg2npFDwTgPGqFqE0H5feXcOoJOfX3SxlJaKEVtq54dw==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.17.0.tgz", + "integrity": "sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0" + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3960,14 +4004,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.14.0.tgz", - "integrity": "sha512-Xcz9qOtZuGusVOH5Uk07NGs39wrKkf3AxlkK79RBK6aJC1l03CobXjJbwBPSidetAOV+5rEVuiT1VSBUOAsanQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.17.0.tgz", + "integrity": "sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/utils": "8.14.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/utils": "8.17.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -3978,6 +4022,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -3985,9 +4032,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.14.0.tgz", - "integrity": "sha512-yjeB9fnO/opvLJFAsPNYlKPnEM8+z4og09Pk504dkqonT02AyL5Z9SSqlE0XqezS93v6CXn49VHvB2G7XSsl0g==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.17.0.tgz", + "integrity": "sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA==", "dev": true, "license": "MIT", "engines": { @@ -3999,14 +4046,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.14.0.tgz", - "integrity": "sha512-OPXPLYKGZi9XS/49rdaCbR5j/S14HazviBlUQFvSKz3npr3NikF+mrgK7CFVur6XEt95DZp/cmke9d5i3vtVnQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.17.0.tgz", + "integrity": "sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -4067,16 +4114,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.14.0.tgz", - "integrity": "sha512-OGqj6uB8THhrHj0Fk27DcHPojW7zKwKkPmHXHvQ58pLYp4hy8CSUdTKykKeh+5vFqTTVmjz0zCOOPKRovdsgHA==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.17.0.tgz", + "integrity": "sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0" + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4087,17 +4134,22 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.14.0.tgz", - "integrity": "sha512-vG0XZo8AdTH9OE6VFRwAZldNc7qtJ/6NLGWak+BtENuEUXGZgFpihILPiBvKXvJ2nFu27XNGC6rKiwuaoMbYzQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.17.0.tgz", + "integrity": "sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.17.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4107,29 +4159,16 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/@vitejs/plugin-react": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.3.tgz", - "integrity": "sha512-NooDe9GpHGqNns1i8XDERg0Vsg5SSYRhRxxyTGogUdkdNt47jal+fbuYi+Yfq6pzRCKXyoPcWisfxE6RIM3GKA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz", + "integrity": "sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.25.2", - "@babel/plugin-transform-react-jsx-self": "^7.24.7", - "@babel/plugin-transform-react-jsx-source": "^7.24.7", + "@babel/core": "^7.26.0", + "@babel/plugin-transform-react-jsx-self": "^7.25.9", + "@babel/plugin-transform-react-jsx-source": "^7.25.9", "@types/babel__core": "^7.20.5", "react-refresh": "^0.14.2" }, @@ -4137,7 +4176,7 @@ "node": "^14.18.0 || >=16.0.0" }, "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0" + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0" } }, "node_modules/abab": { @@ -4239,6 +4278,42 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/allure-cypress": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/allure-cypress/-/allure-cypress-3.0.6.tgz", + "integrity": "sha512-d+bIy2VJeP5iLskAZwrN7fLUgAJyXcAwIl9+hD1JDcxbU42clePWduQ0fa95qeIHGKOm+3TZbwodqT/PHoWKxg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "allure-js-commons": "3.0.6" + }, + "peerDependencies": { + "cypress": ">=12.17.4" + }, + "peerDependenciesMeta": { + "cypress": { + "optional": true + } + } + }, + "node_modules/allure-js-commons": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-3.0.6.tgz", + "integrity": "sha512-q3r3Cj3sG6hR7jH8SGkfNleLJK+yFAGwzyFDGzIfu+WLZ4yeFcBZHkWuq7QreRpxvsZWNby/38jhrj5yYFwQ2g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "md5": "^2.3.0" + }, + "peerDependencies": { + "allure-playwright": "3.0.6" + }, + "peerDependenciesMeta": { + "allure-playwright": { + "optional": true + } + } + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -4414,6 +4489,25 @@ "dev": true, "license": "MIT" }, + "node_modules/axios": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.8.tgz", + "integrity": "sha512-Uu0wb7KNqK2t5K+YQyVCLM76prD5sRFjKHbJYCP1J7JFGEQ6nN7HWn9+04LAeiJ3ji54lgS/gZCH1oxyrf1SPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -4797,9 +4891,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001680", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", - "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", + "version": "1.0.30001686", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001686.tgz", + "integrity": "sha512-Y7deg0Aergpa24M3qLC5xjNklnKnhsmSyR/V89dLZ1n0ucJIFNs7PgR2Yfa/Zf6W79SbBicgtGxZr2juHkEUIA==", "dev": true, "funding": [ { @@ -4851,6 +4945,16 @@ "node": ">=10" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, "node_modules/check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -5100,9 +5204,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", - "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -5114,6 +5218,16 @@ "node": ">= 8" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, "node_modules/css.escape": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", @@ -5168,9 +5282,9 @@ "license": "MIT" }, "node_modules/cypress": { - "version": "13.15.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.15.2.tgz", - "integrity": "sha512-ARbnUorjcCM3XiPwgHKuqsyr5W9Qn+pIIBPaoilnoBkLdSC2oLQjV1BUpnmc7KR+b7Avah3Ly2RMFnfxr96E/A==", + "version": "13.16.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.16.0.tgz", + "integrity": "sha512-g6XcwqnvzXrqiBQR/5gN+QsyRmKRhls1y5E42fyOvsmU7JuY+wM6uHJWj4ZPttjabzbnRvxcik2WemR8+xT6FA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5427,6 +5541,23 @@ "node": ">=12" } }, + "node_modules/dotenv": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", + "dev": true, + "license": "BSD-2-Clause" + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -5455,9 +5586,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.58", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.58.tgz", - "integrity": "sha512-al2l4r+24ZFL7WzyPTlyD0fC33LLzvxqLCwurtBibVPghRGO9hSTl+tis8t1kD7biPiH/en4U0I7o/nQbYeoVA==", + "version": "1.5.68", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.68.tgz", + "integrity": "sha512-FgMdJlma0OzUYlbrtZ4AeXjKxKPk6KT8WOP8BjcqxWtlg8qyJQjRzPJzUtUn5GBg1oQ26hFs7HOOHJMYiJRnvQ==", "dev": true, "license": "ISC" }, @@ -5636,27 +5767,27 @@ } }, "node_modules/eslint": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.14.0.tgz", - "integrity": "sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g==", + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", + "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.7.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.14.0", - "@eslint/plugin-kit": "^0.2.0", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.16.0", + "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.0", + "@humanwhocodes/retry": "^0.4.1", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.5", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.2.0", @@ -5675,8 +5806,7 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" @@ -5710,13 +5840,13 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.14.tgz", - "integrity": "sha512-aXvzCTK7ZBv1e7fahFuR3Z/fyQQSIQ711yPgYRj+Oj64tyTgO4iQIDmYXDBqvSWQ/FA4OSCsXOStlF+noU0/NA==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.16.tgz", + "integrity": "sha512-slterMlxAhov/DZO8NScf6mEeMBBXodFUolijDvrtTxyezyLoTQaa73FyYus/VbTdftd8wBgBxPMRk3poleXNQ==", "dev": true, "license": "MIT", "peerDependencies": { - "eslint": ">=7" + "eslint": ">=8.40" } }, "node_modules/eslint-scope": { @@ -6139,12 +6269,33 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true, "license": "ISC" }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -6366,9 +6517,9 @@ } }, "node_modules/globals": { - "version": "15.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.12.0.tgz", - "integrity": "sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ==", + "version": "15.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", + "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", "dev": true, "license": "MIT", "engines": { @@ -6379,13 +6530,16 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.1.0.tgz", + "integrity": "sha512-FQoVQnqcdk4hVM4JN1eromaun4iuS34oStkdlLENLdpULsuQcTyXj8w7ayhuUfPwEYZ1ZOooOTT6fdA9Vmx/RA==", "dev": true, "license": "MIT", "dependencies": { - "get-intrinsic": "^1.1.3" + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6436,11 +6590,14 @@ } }, "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.1.0.tgz", + "integrity": "sha512-QLdzI9IIO1Jg7f9GT1gXpPpXArAn6cS31R1eEZqz08Gc+uQ8/XiqHWt17Fiw+2p6oTTIq5GXEpQkAlA88YRl/Q==", "dev": true, "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7" + }, "engines": { "node": ">= 0.4" }, @@ -6449,9 +6606,9 @@ } }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "dev": true, "license": "MIT", "engines": { @@ -6718,6 +6875,13 @@ "dev": true, "license": "MIT" }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, + "license": "MIT" + }, "node_modules/is-core-module": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", @@ -8028,6 +8192,20 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/joi": { + "version": "17.13.3", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz", + "integrity": "sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^9.3.0", + "@hapi/topo": "^5.1.0", + "@sideway/address": "^4.1.5", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8538,6 +8716,18 @@ "tmpl": "1.0.5" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -8643,9 +8833,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -8706,9 +8896,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.13", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.13.tgz", - "integrity": "sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==", + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.16.tgz", + "integrity": "sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ==", "dev": true, "license": "MIT" }, @@ -9313,13 +9503,16 @@ "license": "MIT" }, "node_modules/psl": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.10.0.tgz", - "integrity": "sha512-KSKHEbjAnpUuAUserOq0FxGXCUrzC3WniuSJhvdbs102rL55266ZcHBqLWOsG30spQMlPdpy7icATiAQehg/iA==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", + "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", "dev": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/lupomontero" } }, "node_modules/pump": { @@ -9430,9 +9623,9 @@ } }, "node_modules/react-icons": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.3.0.tgz", - "integrity": "sha512-DnUk8aFbTyQPSkCfF8dbX6kQjXA9DktMeJqfjrg6cK9vwQVMxmcA3BfP4QoiztVmEHtwlTgLFsPuH2NskKT6eg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.4.0.tgz", + "integrity": "sha512-7eltJxgVt7X64oHh6wSWNwwbKTCtMfK35hcjvJS0yxEAhPM8oUKdS3+kqaW1vicIltw+kR2unHaa12S9pPALoQ==", "license": "MIT", "peerDependencies": { "react": "*" @@ -9588,16 +9781,16 @@ } }, "node_modules/regexpu-core": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.1.1.tgz", - "integrity": "sha512-k67Nb9jvwJcJmVpw0jPttR1/zVfnKf8Km0IPatrU/zJ5XeG3+Slx0xLXs9HByJSzXzrlz5EDvN6yLNMDc2qdnw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, "license": "MIT", "dependencies": { "regenerate": "^1.4.2", "regenerate-unicode-properties": "^10.2.0", "regjsgen": "^0.8.0", - "regjsparser": "^0.11.0", + "regjsparser": "^0.12.0", "unicode-match-property-ecmascript": "^2.0.0", "unicode-match-property-value-ecmascript": "^2.1.0" }, @@ -9613,9 +9806,9 @@ "license": "MIT" }, "node_modules/regjsparser": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.11.2.tgz", - "integrity": "sha512-3OGZZ4HoLJkkAZx/48mTXJNlmqTGOzc0o9OWQPuWpkOlXXPbyN6OafCcoXUnBqE2D3f/T5L+pWc1kdEmnfnRsA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -9704,9 +9897,9 @@ } }, "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", "dev": true, "license": "MIT", "engines": { @@ -9746,9 +9939,9 @@ "license": "MIT" }, "node_modules/rollup": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.26.0.tgz", - "integrity": "sha512-ilcl12hnWonG8f+NxU6BlgysVA0gvY2l8N0R84S1HcINbW20bvwuCngJkkInV6LXhwRpucsW5k1ovDwEdBVrNg==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.0.tgz", + "integrity": "sha512-G9GOrmgWHBma4YfCcX8PjH0qhXSdH8B4HDE2o4/jaxj93S4DPCIDoLcXz99eWMji4hB29UFCEd7B2gwGJDR9cQ==", "dev": true, "license": "MIT", "dependencies": { @@ -9762,24 +9955,24 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.26.0", - "@rollup/rollup-android-arm64": "4.26.0", - "@rollup/rollup-darwin-arm64": "4.26.0", - "@rollup/rollup-darwin-x64": "4.26.0", - "@rollup/rollup-freebsd-arm64": "4.26.0", - "@rollup/rollup-freebsd-x64": "4.26.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.26.0", - "@rollup/rollup-linux-arm-musleabihf": "4.26.0", - "@rollup/rollup-linux-arm64-gnu": "4.26.0", - "@rollup/rollup-linux-arm64-musl": "4.26.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.26.0", - "@rollup/rollup-linux-riscv64-gnu": "4.26.0", - "@rollup/rollup-linux-s390x-gnu": "4.26.0", - "@rollup/rollup-linux-x64-gnu": "4.26.0", - "@rollup/rollup-linux-x64-musl": "4.26.0", - "@rollup/rollup-win32-arm64-msvc": "4.26.0", - "@rollup/rollup-win32-ia32-msvc": "4.26.0", - "@rollup/rollup-win32-x64-msvc": "4.26.0", + "@rollup/rollup-android-arm-eabi": "4.28.0", + "@rollup/rollup-android-arm64": "4.28.0", + "@rollup/rollup-darwin-arm64": "4.28.0", + "@rollup/rollup-darwin-x64": "4.28.0", + "@rollup/rollup-freebsd-arm64": "4.28.0", + "@rollup/rollup-freebsd-x64": "4.28.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.28.0", + "@rollup/rollup-linux-arm-musleabihf": "4.28.0", + "@rollup/rollup-linux-arm64-gnu": "4.28.0", + "@rollup/rollup-linux-arm64-musl": "4.28.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.28.0", + "@rollup/rollup-linux-riscv64-gnu": "4.28.0", + "@rollup/rollup-linux-s390x-gnu": "4.28.0", + "@rollup/rollup-linux-x64-gnu": "4.28.0", + "@rollup/rollup-linux-x64-musl": "4.28.0", + "@rollup/rollup-win32-arm64-msvc": "4.28.0", + "@rollup/rollup-win32-ia32-msvc": "4.28.0", + "@rollup/rollup-win32-x64-msvc": "4.28.0", "fsevents": "~2.3.2" } }, @@ -10213,13 +10406,6 @@ "node": ">=8" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, "node_modules/throttleit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.1.tgz", @@ -10238,22 +10424,22 @@ "license": "MIT" }, "node_modules/tldts": { - "version": "6.1.61", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.61.tgz", - "integrity": "sha512-rv8LUyez4Ygkopqn+M6OLItAOT9FF3REpPQDkdMx5ix8w4qkuE7Vo2o/vw1nxKQYmJDV8JpAMJQr1b+lTKf0FA==", + "version": "6.1.65", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.65.tgz", + "integrity": "sha512-xU9gLTfAGsADQ2PcWee6Hg8RFAv0DnjMGVJmDnUmI8a9+nYmapMQix4afwrdaCtT+AqP4MaxEzu7cCrYmBPbzQ==", "dev": true, "license": "MIT", "dependencies": { - "tldts-core": "^6.1.61" + "tldts-core": "^6.1.65" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { - "version": "6.1.61", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.61.tgz", - "integrity": "sha512-In7VffkDWUPgwa+c9picLUxvb0RltVwTkSgMNFgvlGSWveCzGBemBqTsgJCL4EDFWZ6WH0fKTsot6yNhzy3ZzQ==", + "version": "6.1.65", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.65.tgz", + "integrity": "sha512-Uq5t0N0Oj4nQSbU8wFN1YYENvMthvwU13MQrMJRspYCGLSAZjAfoBOJki5IQpnBM/WFskxxC/gIOTwaedmHaSg==", "dev": true, "license": "MIT" }, @@ -10324,9 +10510,9 @@ } }, "node_modules/ts-api-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.0.tgz", - "integrity": "sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", "dev": true, "license": "MIT", "engines": { @@ -10462,9 +10648,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "license": "Apache-2.0", "bin": { @@ -10476,15 +10662,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.14.0.tgz", - "integrity": "sha512-K8fBJHxVL3kxMmwByvz8hNdBJ8a0YqKzKDX6jRlrjMuNXyd5T2V02HIq37+OiWXvUUOXgOOGiSSOh26Mh8pC3w==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.17.0.tgz", + "integrity": "sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.14.0", - "@typescript-eslint/parser": "8.14.0", - "@typescript-eslint/utils": "8.14.0" + "@typescript-eslint/eslint-plugin": "8.17.0", + "@typescript-eslint/parser": "8.17.0", + "@typescript-eslint/utils": "8.17.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -10493,6 +10679,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -10500,9 +10689,9 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT" }, @@ -10729,6 +10918,17 @@ } } }, + "node_modules/vite-plugin-env-compatible": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vite-plugin-env-compatible/-/vite-plugin-env-compatible-2.0.1.tgz", + "integrity": "sha512-DRrOZTg/W44ojVQQfGSMPEgYQGzp5TeIpt9cpaK35hTOC/b2D7Ffl8/RIgK8vQ0mlnDIUgETcA173bnMEkyzdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dotenv": "8.2.0", + "dotenv-expand": "5.1.0" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -10742,6 +10942,26 @@ "node": ">=14" } }, + "node_modules/wait-on": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-8.0.1.tgz", + "integrity": "sha512-1wWQOyR2LVVtaqrcIL2+OM+x7bkpmzVROa0Nf6FryXkS+er5Sa1kzFGjzZRqLnHa3n1rACFLeTwUqE1ETL9Mig==", + "dev": true, + "license": "MIT", + "dependencies": { + "axios": "^1.7.7", + "joi": "^17.13.3", + "lodash": "^4.17.21", + "minimist": "^1.2.8", + "rxjs": "^7.8.1" + }, + "bin": { + "wait-on": "bin/wait-on" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -10930,9 +11150,9 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", - "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "dev": true, "license": "ISC", "bin": { diff --git a/app/package.json b/app/frontend/package.json similarity index 88% rename from app/package.json rename to app/frontend/package.json index 1f8836fb..465e03f6 100644 --- a/app/package.json +++ b/app/frontend/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "vite", + "stg": "vite --mode staging", "test": "jest", "build": "tsc -b && vite build", "lint": "eslint .", @@ -34,7 +35,8 @@ "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", - "cypress": "^13.15.1", + "allure-cypress": "^3.0.6", + "cypress": "^13.15.2", "eslint": "^9.9.0", "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.9", @@ -47,6 +49,8 @@ "ts-jest": "^29.2.5", "typescript": "^5.5.3", "typescript-eslint": "^8.0.1", - "vite": "^5.4.1" + "vite": "^5.4.1", + "vite-plugin-env-compatible": "^2.0.1", + "wait-on": "^8.0.1" } } diff --git a/app/src/App.css b/app/frontend/src/App.css similarity index 100% rename from app/src/App.css rename to app/frontend/src/App.css diff --git a/app/src/App.test.tsx b/app/frontend/src/App.test.tsx similarity index 92% rename from app/src/App.test.tsx rename to app/frontend/src/App.test.tsx index 83dd3e54..76f1f143 100644 --- a/app/src/App.test.tsx +++ b/app/frontend/src/App.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import '@testing-library/jest-dom' import {render, screen} from '@testing-library/react'; import {MemoryRouter} from 'react-router-dom'; -import App from './App'; +import App from './App.tsx'; test('renders login page', () => { render( diff --git a/app/src/App.tsx b/app/frontend/src/App.tsx similarity index 62% rename from app/src/App.tsx rename to app/frontend/src/App.tsx index 42d11b56..7519d9e5 100644 --- a/app/src/App.tsx +++ b/app/frontend/src/App.tsx @@ -1,7 +1,7 @@ import React from 'react' import './App.css' -import {Providers} from "./components/application/Providers"; -import {RouteConfig} from "./components/application/RouteConfig"; +import {Providers} from "./components/application/Providers.tsx"; +import {RouteConfig} from "./components/application/RouteConfig.tsx"; export const App = () => { return ( diff --git a/app/src/components/application/ErrorBoundary.tsx b/app/frontend/src/components/application/ErrorBoundary.tsx similarity index 100% rename from app/src/components/application/ErrorBoundary.tsx rename to app/frontend/src/components/application/ErrorBoundary.tsx diff --git a/app/src/components/application/Home.tsx b/app/frontend/src/components/application/Home.tsx similarity index 100% rename from app/src/components/application/Home.tsx rename to app/frontend/src/components/application/Home.tsx diff --git a/app/src/components/application/Message.tsx b/app/frontend/src/components/application/Message.tsx similarity index 94% rename from app/src/components/application/Message.tsx rename to app/frontend/src/components/application/Message.tsx index 667fd22f..2ba0e8ef 100644 --- a/app/src/components/application/Message.tsx +++ b/app/frontend/src/components/application/Message.tsx @@ -1,4 +1,4 @@ -import ErrorBoundary from "./ErrorBoundary"; +import ErrorBoundary from "./ErrorBoundary.tsx"; import React from "react"; import {showErrorMessage} from "./utils"; import {ErrorScreen} from "../../views/application/ErrorScreen.tsx"; diff --git a/app/src/components/application/Providers.tsx b/app/frontend/src/components/application/Providers.tsx similarity index 81% rename from app/src/components/application/Providers.tsx rename to app/frontend/src/components/application/Providers.tsx index 1e38f7d7..a335faa0 100644 --- a/app/src/components/application/Providers.tsx +++ b/app/frontend/src/components/application/Providers.tsx @@ -1,5 +1,5 @@ import React from "react"; -import {AuthUserProvider} from "../../providers/AuthUser"; +import {AuthUserProvider} from "../../providers/AuthUser.tsx"; type Props = { children: React.ReactNode; diff --git a/app/src/components/application/RouteAuthGuard.tsx b/app/frontend/src/components/application/RouteAuthGuard.tsx similarity index 94% rename from app/src/components/application/RouteAuthGuard.tsx rename to app/frontend/src/components/application/RouteAuthGuard.tsx index 727fc76a..841d7b51 100644 --- a/app/src/components/application/RouteAuthGuard.tsx +++ b/app/frontend/src/components/application/RouteAuthGuard.tsx @@ -1,6 +1,6 @@ import React from "react"; import {Navigate, useLocation} from "react-router-dom"; -import {useAuthUserContext} from "../../providers/AuthUser"; +import {useAuthUserContext} from "../../providers/AuthUser.tsx"; import {RoleType} from "../../models"; type Props = { diff --git a/app/src/components/application/RouteConfig.tsx b/app/frontend/src/components/application/RouteConfig.tsx similarity index 75% rename from app/src/components/application/RouteConfig.tsx rename to app/frontend/src/components/application/RouteConfig.tsx index b354340e..d9094291 100644 --- a/app/src/components/application/RouteConfig.tsx +++ b/app/frontend/src/components/application/RouteConfig.tsx @@ -1,18 +1,19 @@ import {Route, Routes} from "react-router-dom"; import React from "react"; import {RouteAuthGuard} from "./RouteAuthGuard"; -import {Login} from "../system/Login.tsx"; -import {Logout} from "../system/Logout.tsx"; +import {Home} from "./Home.tsx"; import {User} from "../system/User.tsx"; +import {NotFound} from "../../views/application/NotFound.tsx"; import {RoleType} from "../../models"; +import {Login, Logout} from "../system/Auth.tsx"; import {Department} from "../master/Department.tsx"; import {Employee} from "../master/Employee.tsx"; -import {NotFound} from "../../views/application/NotFound.tsx"; -import {Home} from "./Home.tsx"; import {Product} from "../master/Product.tsx"; import {SiteLayout} from "../../views/SiteLayout.tsx"; import {ProductCategory} from "../master/ProductCategory.tsx"; -import {ProductDetail} from "../master/ProductDetail.tsx"; +import {ProductItem} from "../master/ProductItem.tsx"; +import {Audit} from "../system/Audit.tsx"; +import {Download} from "../system/Download.tsx"; export const RouteConfig: React.FC = () => { const ProductCategoryPage = () => { @@ -26,7 +27,7 @@ export const RouteConfig: React.FC = () => { const ProductDetailPage = () => { return ( - + ); } @@ -37,6 +38,10 @@ export const RouteConfig: React.FC = () => { } redirectPath="/login"/>}/> } redirectPath="/" allowedRoles={[RoleType.ADMIN]}/>}/> + } redirectPath="/" + allowedRoles={[RoleType.ADMIN, RoleType.USER]}/>}/> + } redirectPath="/" + allowedRoles={[RoleType.ADMIN, RoleType.USER]}/>}/> } redirectPath="/" allowedRoles={[RoleType.ADMIN]}/>}/> } redirectPath="/" @@ -45,7 +50,7 @@ export const RouteConfig: React.FC = () => { allowedRoles={[RoleType.ADMIN]}/>}/> } redirectPath="/" allowedRoles={[RoleType.ADMIN]}/>}/> - } redirectPath="/" + } redirectPath="/" allowedRoles={[RoleType.ADMIN]}/>}/> }/> }/> diff --git a/app/src/components/application/hooks.ts b/app/frontend/src/components/application/hooks.ts similarity index 58% rename from app/src/components/application/hooks.ts rename to app/frontend/src/components/application/hooks.ts index f3deec18..e358f1b5 100644 --- a/app/src/components/application/hooks.ts +++ b/app/frontend/src/components/application/hooks.ts @@ -39,7 +39,11 @@ export const useTab = () => { } export const useFetchEntities = < EntityType, - ServiceType extends { select: (page: number) => Promise } + ServiceType extends { + select: (page: number) => Promise<{ list: EntityType[], [key: string]: any }>; + search?: (criteria: CriteriaType, page: number) => Promise<{ list: EntityType[], [key: string]: any }>; + }, + CriteriaType = any >( setLoading: (loading: boolean) => void, setList: (list: EntityType[]) => void, @@ -49,22 +53,28 @@ export const useFetchEntities = < service: ServiceType, errorMessage: string ) => { - const load = async (page: number = 1): Promise => { + const load = async (page: number = 1, criteria?: CriteriaType): Promise => { setLoading(true); try { - const fetchedEntities = await service.select(page); - const {list, ...pagination} = fetchedEntities; + const fetchedEntities = criteria + ? await service.search?.(criteria, page) + : await service.select(page); + + if (!fetchedEntities || !Array.isArray(fetchedEntities.list)) { + throw new Error("取得されたデータの形式が正しくありません。"); + } + + const { list, ...pagination } = fetchedEntities; setList(list); - setPageNation(pagination); + setPageNation(pagination as PageNationType); setError(""); - } catch (error: any) { - showErrorMessage(`${errorMessage} ${error?.message}`, setError); + } catch (error) { + const message = error instanceof Error ? error.message : "不明なエラーが発生しました。"; + setError(message); + showErrorMessage(`${errorMessage} ${message}`, () => {}); } finally { setLoading(false); } }; - return { - load - }; -}; - + return { load }; +}; \ No newline at end of file diff --git a/app/src/components/application/utils.ts b/app/frontend/src/components/application/utils.ts similarity index 72% rename from app/src/components/application/utils.ts rename to app/frontend/src/components/application/utils.ts index 5fb839fb..3567e16f 100644 --- a/app/src/components/application/utils.ts +++ b/app/frontend/src/components/application/utils.ts @@ -11,6 +11,16 @@ export const convertToDateInputFormat = (dateString: string): string => { return `${year}-${month}-${day}`; }; +export const convertToDateTimeInputFormat = (dateString: string): string => { + const date = new Date(dateString); + const year = date.getFullYear(); + const month = ("0" + (date.getMonth() + 1)).slice(-2); + const day = ("0" + date.getDate()).slice(-2); + const hours = ("0" + date.getHours()).slice(-2); + const minutes = ("0" + date.getMinutes()).slice(-2); + return `${year}-${month}-${day}:${hours}:${minutes}`; +}; + export const toISOStringWithTimezone = (date: Date): string => { const pad = function (str: string): string { return ('0' + str).slice(-2); diff --git a/app/frontend/src/components/master/Department.tsx b/app/frontend/src/components/master/Department.tsx new file mode 100644 index 00000000..06b7c662 --- /dev/null +++ b/app/frontend/src/components/master/Department.tsx @@ -0,0 +1,415 @@ +import React, {useEffect, useState} from "react"; +import {useMessage} from "../application/Message.tsx"; +import {useModal} from "../application/hooks.ts"; +import {useDepartment, useEmployee, useFetchDepartments, useFetchEmployees} from "./hooks"; +import {showErrorMessage} from "../application/utils.ts"; +import { + DepartmentCriteriaType, + DepartmentIdType, + DepartmentType, + EmployeeCriteriaType, + EmployeeType +} from "../../models"; +import Modal from "react-modal"; +import {usePageNation} from "../../views/application/PageNation.tsx"; +import {SiteLayout} from "../../views/SiteLayout.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {EmployeeCollectionSelectView} from "../../views/master/employee/EmployeeSelect.tsx"; +import {DepartmentCollectionView} from "../../views/master/department/DepartmentCollection.tsx"; +import {DepartmentSingleView} from "../../views/master/department/DepartmentSingle.tsx"; +import {EmployeeCollectionAddListView} from "../../views/master/employee/EmployeeCollection.tsx"; +import {DepartmentSearchSingleView} from "../../views/master/department/DepartmentSearch.tsx"; + +export const Department: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError} = useMessage(); + const {pageNation, setPageNation, criteria, setCriteria} = usePageNation(); + const {pageNation: employeePageNation, setPageNation: setEmployeePageNation} = usePageNation(); + const {modalIsOpen, setModalIsOpen, isEditing, setIsEditing, editId, setEditId} = useModal(); + const {modalIsOpen: searchModalIsOpen, setModalIsOpen: setSearchModalIsOpen,} = useModal(); + const { + modalIsOpen: employeeModalIsOpen, + setModalIsOpen: setEmployeeModalIsOpen, + setIsEditing: setEmployeeIsEditing, + setEditId: setEmployeeEditId + } = useModal(); + + const { + initialDepartment, + departments, + setDepartments, + newDepartment, + setNewDepartment, + searchDepartmentCriteria, + setSearchDepartmentCriteria, + departmentService + } = useDepartment(); + + const fetchDepartments = useFetchDepartments( + setLoading, + setDepartments, + setPageNation, + setError, + showErrorMessage, + departmentService + ); + + const { + employees, + setEmployees, + employeeService + } = useEmployee(); + + const fetchEmployees = useFetchEmployees( + setLoading, + setEmployees, + setEmployeePageNation, + setError, + showErrorMessage, + employeeService + ); + + useEffect(() => { + fetchDepartments.load().then(() => { + fetchEmployees.load().then(() => { + }); + }); + }, []); + + const modalView = () => { + const editModal = () => { + const handleOpenModal = (department?: DepartmentType) => { + setMessage(""); + setError(""); + if (department) { + setNewDepartment(department); + setEditId(department.departmentId.deptCode.value); + setIsEditing(true); + } else { + setNewDepartment(initialDepartment); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return ( + + {singleView()} + + {isEditing && ( + !e.deleteFlag)} + handleAdd={employeeModal().handleOpenEmployeeModal} + handleDelete={employeeModal().handleDeleteEmployee} + /> + ) + } + + ) + } + + return { + editModalView, + handleOpenModal, + handleCloseModal, + } + } + + const employeeModal = () => { + const handleOpenEmployeeModal = () => { + setMessage(""); + setError(""); + setEmployeeIsEditing(true); + setEmployeeModalIsOpen(true); + }; + + const handleCloseEmployeeModal = () => { + setError(""); + setEmployeeModalIsOpen(false); + setEmployeeEditId(null); + }; + + const handleEmployeeCollectionSelect = (employee: EmployeeType) => { + const newEmployees = newDepartment.employees.filter((e) => e.empCode.value !== employee.empCode.value); + if (employee.empCode.value) { + newEmployees.push({ + ...employee, + addFlag: true, + deleteFlag: false + }); + } + setNewDepartment({ + ...newDepartment, + employees: newEmployees + }); + } + + const handleDeleteEmployee = (employee: EmployeeType) => { + const newEmployees = newDepartment.employees.filter((e) => e.empCode.value !== employee.empCode.value); + if (employee.empCode.value) { + newEmployees.push({ + ...employee, + addFlag: false, + deleteFlag: true + }); + } + setNewDepartment({ + ...newDepartment, + employees: newEmployees + }); + } + + const employeeModalView = () => { + return ( + + { + + } + + + ) + } + + return { + handleOpenEmployeeModal, + handleDeleteEmployee, + employeeModalView, + } + } + + const searchModal = () => { + const handleOpenSearchModal = () => { + setSearchModalIsOpen(true); + } + + const handleCloseSearchModal = () => { + setSearchModalIsOpen(false); + } + + const searchModalView = () => { + return ( + + { + { + if (!searchDepartmentCriteria) { + return; + } + setLoading(true); + try { + const result = await departmentService.search(searchDepartmentCriteria); + setDepartments(result ? result.list : []); + if (result.list.length === 0) { + showErrorMessage(`検索結果は0件です`, setError); + } else { + setCriteria(searchDepartmentCriteria); + setPageNation(result); + setMessage(""); + setError(""); + } + } catch (error: any) { + showErrorMessage(`実行履歴情報の検索に失敗しました: ${error?.message}`, setError); + } finally { + setLoading(false); + } + }} + handleClose={handleCloseSearchModal} + /> + } + + ) + } + + return { + searchModalView, + handleOpenSearchModal, + handleCloseSearchModal + } + } + + const init = () => ( + <> + {editModal().editModalView()} + {employeeModal().employeeModalView()} + {searchModal().searchModalView()} + + ) + + return { + editModal, + employeeModal, + searchModal, + init, + } + } + + const collectionView = () => { + const {handleOpenModal} = modalView().editModal(); + const {handleOpenSearchModal} = modalView().searchModal(); + + const handleDeleteDepartment = async (departmentId: DepartmentIdType) => { + try { + if (!window.confirm(`部門コード:${departmentId.deptCode.value} を削除しますか?`)) return; + await departmentService.destroy(departmentId.deptCode.value, departmentId.departmentStartDate.value); + await fetchDepartments.load(); + setMessage("部門を削除しました。"); + } catch (error: any) { + showErrorMessage(`部門の削除に失敗しました: ${error?.message}`, setError); + } + }; + + const handleCheckDepartment = (department: DepartmentType) => { + const newDepartments = departments.map((d) => { + if (d.departmentId.deptCode.value === department.departmentId.deptCode.value && d.departmentId.departmentStartDate.value === department.departmentId.departmentStartDate.value) { + return { + ...d, + checked: !d.checked + }; + } + return d; + }); + setDepartments(newDepartments); + } + + const handleCheckAllDepartment = () => { + const newDepartments = departments.map((d) => { + return { + ...d, + checked: !departments.every((d) => d.checked) + }; + }); + setDepartments(newDepartments); + } + + const handleDeleteCheckedCollection = async () => { + const checkedDepartments = departments.filter((d) => d.checked); + if (!checkedDepartments.length) { + setError("削除する部門を選択してください。"); + return; + } + + try { + if (!window.confirm("選択した部門を削除しますか?")) return; + await Promise.all(checkedDepartments.map((d) => departmentService.destroy(d.departmentId.deptCode.value, d.departmentId.departmentStartDate.value))); + await fetchDepartments.load(); + setMessage("選択した部門を削除しました。"); + } catch (error: any) { + showErrorMessage(`選択した部門の削除に失敗しました: ${error?.message}`, setError); + } + } + + return ( + + ); + }; + + const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + + const handleCreateOrUpdateDepartment = async () => { + const validateDepartment = (): boolean => { + if (!newDepartment.departmentId.deptCode.value.trim() || !newDepartment.departmentName.trim()) { + setError("部門コード、部門名は必須項目です。"); + return false; + } + return true; + }; + + if (!validateDepartment()) { + return; + } + + try { + if (isEditing && editId) { + await departmentService.update(newDepartment); + } else { + await departmentService.create(newDepartment); + } + setNewDepartment(initialDepartment); + await fetchDepartments.load(); + if (isEditing) { + setMessage("部門を更新しました。"); + } else { + setMessage("部門を作成しました。"); + } + handleCloseModal(); + } catch (error: any) { + showErrorMessage(`部門の作成に失敗しました: ${error?.message}`, setError); + } + }; + + return ( + + ); + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {modalView().init()} + {collectionView()} + + )} + + ); + }; + + return ( + + + + ); +}; diff --git a/app/frontend/src/components/master/Employee.tsx b/app/frontend/src/components/master/Employee.tsx new file mode 100644 index 00000000..3014b6b8 --- /dev/null +++ b/app/frontend/src/components/master/Employee.tsx @@ -0,0 +1,466 @@ +import React, {useEffect, useState} from 'react'; +import Modal from "react-modal"; +import {showErrorMessage} from "../application/utils.ts"; +import {useMessage} from "../application/Message.tsx"; +import {useModal} from "../application/hooks.ts"; +import {useDepartment, useEmployee, useFetchDepartments, useFetchEmployees} from "./hooks"; +import {usePageNation} from "../../views/application/PageNation.tsx"; +import {SiteLayout} from "../../views/SiteLayout.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {useFetchUsers, useUser} from "../system/hooks"; +import {DepartmentCollectionSelectView, DepartmentSelectView} from "../../views/master/department/DepartmentSelect.tsx"; +import {UserCollectionSelectView, UserSelectView} from "../../views/system/user/UserSelect.tsx"; +import {EmployeeCollectionView} from "../../views/master/employee/EmployeeCollection.tsx"; +import {EmployeeSingleView} from "../../views/master/employee/EmployeeSingle.tsx"; +import {EmployeeSearchSingleView} from "../../views/master/employee/EmployeeSearch.tsx"; +import {DepartmentCriteriaType, EmployeeCriteriaType, EmployeeType} from "../../models"; + +export const Employee: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError} = useMessage(); + const {pageNation, setPageNation, criteria, setCriteria} = usePageNation(); + const {pageNation: departmentPageNation, setPageNation: setDepartmentPageNation} = usePageNation(); + const {pageNation: userPageNation, setPageNation: setUserPageNation} = usePageNation(); + const {modalIsOpen, setModalIsOpen, isEditing, setIsEditing, editId, setEditId} = useModal(); + const { + modalIsOpen: departmentModalIsOpen, + setModalIsOpen: setDepartmentModalIsOpen + } = useModal(); + const { + modalIsOpen: userModalIsOpen, + setModalIsOpen: setUserModalIsOpen + } = useModal(); + const {modalIsOpen: searchModalIsOpen, setModalIsOpen: setSearchModalIsOpen,} = useModal(); + + const { + initialEmployee, + employees, + setEmployees, + newEmployee, + setNewEmployee, + searchEmployeeCriteria, + setSearchEmployeeCriteria, + employeeService + } = useEmployee(); + + const fetchEmployees = useFetchEmployees( + setLoading, + setEmployees, + setPageNation, + setError, + showErrorMessage, + employeeService + ); + + const { + departments, + setDepartments, + departmentService + } = useDepartment(); + + const fetchDepartments = useFetchDepartments( + setLoading, + setDepartments, + setDepartmentPageNation, + setError, + showErrorMessage, + departmentService + ); + + const { + users, + setUsers, + userService + } = useUser(); + + const fetchUsers = useFetchUsers( + setLoading, + setUsers, + setUserPageNation, + setError, + showErrorMessage, + userService + ); + + useEffect(() => { + fetchEmployees.load().then(() => { + fetchDepartments.load().then(() => { + fetchUsers.load().then(() => { + }); + }); + }); + }, []); + + const modalView = () => { + const editModal = () => { + const handleOpenModal = (employee?: EmployeeType) => { + setMessage(""); + setError(""); + if (employee) { + employee.loginPassword = ""; + setNewEmployee(employee); + setEditId(employee.empCode.value); + setIsEditing(true); + } else { + setNewEmployee(initialEmployee); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return( + + {singleView()} + + {departmentModal().departmentModalView()} + setDepartmentModalIsOpen(true)} + /> + + {employeeModal().employeeModalView()} + setUserModalIsOpen(true)} + /> + + ) + } + + return { + editModalView, + handleOpenModal, + handleCloseModal, + } + } + + const departmentModal = () => { + const departmentModalView = () => { + return ( + setDepartmentModalIsOpen(false)} + contentLabel="部門情報を入力" + className="modal" + overlayClassName="modal-overlay" + bodyOpenClassName="modal-open" + > + { + { + setNewEmployee({ + ...newEmployee, + department: department + }); + setDepartmentModalIsOpen(false); + }} + handleClose={() => setDepartmentModalIsOpen(false)} + pageNation={departmentPageNation} + fetchDepartments={fetchDepartments.load} + /> + } + + ) + } + + const departmentSearchModalView = () => { + return ( + setDepartmentModalIsOpen(false)} + contentLabel="部門情報を入力" + className="modal" + overlayClassName="modal-overlay" + bodyOpenClassName="modal-open" + > + { + { + setSearchEmployeeCriteria( + {...criteria, departmentCode: department.departmentId.deptCode.value} + ) + setDepartmentModalIsOpen(false); + }} + handleClose={() => setDepartmentModalIsOpen(false)} + pageNation={departmentPageNation} + fetchDepartments={fetchDepartments.load} + /> + } + + ) + } + + return { + departmentModalView, + departmentSearchModalView, + } + } + + const employeeModal = () => { + const employeeModalView = () => { + return ( + setUserModalIsOpen(false)} + contentLabel="ユーザー情報を入力" + className="modal" + overlayClassName="modal-overlay" + bodyOpenClassName="modal-open" + > + { + { + setNewEmployee({ + ...newEmployee, + user: user + }); + setUserModalIsOpen(false); + }} + handleClose={() => setUserModalIsOpen(false)} + pageNation={userPageNation} + fetchUsers={fetchUsers.load} + /> + } + + ) + } + + return { + employeeModalView, + } + } + + const searchModal = () => { + const handleOpenSearchModal = () => { + setSearchModalIsOpen(true); + } + + const handleCloseSearchModal = () => { + setSearchModalIsOpen(false); + } + + const searchModalView = () => { + return ( + + { + <> + { + if (!searchEmployeeCriteria) { + return; + } + setLoading(true); + try { + const result = await employeeService.search(searchEmployeeCriteria); + setEmployees(result ? result.list : []); + if (result.list.length === 0) { + showErrorMessage(`検索結果は0件です`, setError); + } else { + setCriteria(searchEmployeeCriteria); + setPageNation(result); + setMessage(""); + setError(""); + } + } catch (error: any) { + showErrorMessage(`実行履歴情報の検索に失敗しました: ${error?.message}`, setError); + } finally { + setLoading(false); + } + }} + handleClose={handleCloseSearchModal} + /> + + {departmentModal().departmentSearchModalView()} + setDepartmentModalIsOpen(true)} + /> + + } + + ) + } + + return { + searchModalView, + handleOpenSearchModal, + handleCloseSearchModal + } + } + + const init = () => ( + <> + {editModal().editModalView()} + {searchModal().searchModalView()} + + ) + + return { + editModal, + departmentModal, + searchModal, + init, + } + } + + const collectionView = () => { + const {handleOpenModal} = modalView().editModal(); + const {handleOpenSearchModal} = modalView().searchModal(); + + const handleDeleteEmployee = async (empCode: string) => { + try { + if (!window.confirm(`社員コード:${empCode} を削除しますか?`)) return; + await employeeService.destroy(empCode); + await fetchEmployees.load(); + setMessage("社員を削除しました。"); + } catch (error: any) { + showErrorMessage(`社員の削除に失敗しました: ${error?.message}`, setError); + } + }; + + const handleCheckEmployee = (employee: EmployeeType) => { + const newEmployee = employees.map((emp) => { + if (emp.empCode.value === employee.empCode.value) { + return { + ...emp, + checked: !emp.checked + }; + } + return emp; + }); + setEmployees(newEmployee); + } + + const handleCheckAllEmployees = () => { + const newEmployee = employees.map((emp) => { + return { + ...emp, + checked: !employees.every((emp) => emp.checked) + }; + }); + setEmployees(newEmployee); + } + + const handleDeleteCheckedEmployees = async () => { + if (!employees.some((emp) => emp.checked)) { + setError("削除する社員を選択してください。"); + return; + } + + try { + if (!window.confirm(`選択した社員を削除しますか?`)) return; + const checkedEmployees = employees.filter((emp) => emp.checked); + await Promise.all(checkedEmployees.map((emp) => employeeService.destroy(emp.empCode.value))); + await fetchEmployees.load(); + setMessage("選択した社員を削除しました。"); + } catch (error: any) { + showErrorMessage(`社員の削除に失敗しました: ${error?.message}`, setError); + } + } + + return ( + + ) + }; + + const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + + const handleCreateOrUpdateEmployee = async () => { + const validateEmployee = (): boolean => { + if (!newEmployee.empCode.value.trim() || !newEmployee.empName.firstName.trim() || !newEmployee.empName.lastName.trim()) { + setError("社員コード、姓、名は必須項目です。"); + return false; + } + if (!newEmployee.department) { + setError("部門は必須項目です。"); + return false; + } + return true; + }; + + if (!validateEmployee()) return; + + try { + if (isEditing && editId) { + await employeeService.update(newEmployee); + } else { + await employeeService.create(newEmployee); + } + setNewEmployee({...initialEmployee}); + await fetchEmployees.load(); + if (isEditing) { + setMessage("社員を更新しました。"); + } else { + setMessage("社員を作成しました。"); + } + handleCloseModal(); + } catch (error: any) { + showErrorMessage(`社員の作成に失敗しました: ${error?.message}`, setError); + } + }; + + return ( + + ) + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {modalView().init()} + {collectionView()} + + )} + + ); + }; + + return ( + + + + ); +}; diff --git a/app/src/components/master/Product.tsx b/app/frontend/src/components/master/Product.tsx similarity index 85% rename from app/src/components/master/Product.tsx rename to app/frontend/src/components/master/Product.tsx index 01d61f49..75480dd1 100644 --- a/app/src/components/master/Product.tsx +++ b/app/frontend/src/components/master/Product.tsx @@ -1,7 +1,7 @@ import React from "react"; import {useTab} from "../application/hooks.ts"; import {ProductCategory} from "./ProductCategory.tsx"; -import {ProductDetail} from "./ProductDetail.tsx"; +import {ProductItem} from "./ProductItem.tsx"; import {SiteLayout} from "../../views/SiteLayout.tsx"; export const Product: React.FC = () => { @@ -17,13 +17,13 @@ export const Product: React.FC = () => { 分類 - 詳細 + アイテム - + ); diff --git a/app/frontend/src/components/master/ProductCategory.tsx b/app/frontend/src/components/master/ProductCategory.tsx new file mode 100644 index 00000000..1b24d024 --- /dev/null +++ b/app/frontend/src/components/master/ProductCategory.tsx @@ -0,0 +1,405 @@ +import React, {useEffect, useState} from 'react'; +import {showErrorMessage} from "../application/utils.ts"; +import {useMessage} from "../application/Message.tsx"; +import {useModal} from "../application/hooks.ts"; +import {usePageNation} from "../../views/application/PageNation.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {ProductCategoryCriteriaType, ProductCategoryType, ProductType} from "../../models"; + +import {useFetchProductCategories, useFetchProducts, useProduct, useProductCategory} from "./hooks"; +import Modal from "react-modal"; +import {ProductCollectionAddListView} from "../../views/master/product/item/ProductCollection.tsx"; +import {ProductCollectionSelectView} from "../../views/master/product/item/ProductSelect.tsx"; +import {ProductCategorySearchSingleView} from "../../views/master/product/ProductCategorySearch.tsx"; +import {ProductCategoryCollectionView} from "../../views/master/product/category/ProductCategoryCollection.tsx"; +import {ProductCategorySingleView} from "../../views/master/product/category/ProductCategorySingle.tsx"; + +export const ProductCategory: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError} = useMessage(); + const {pageNation, setPageNation, criteria, setCriteria} = usePageNation(); + const {modalIsOpen: searchModalIsOpen, setModalIsOpen: setSearchModalIsOpen,} = useModal(); + + const { + modalIsOpen, + setModalIsOpen, + isEditing, + setIsEditing, + editId, + setEditId + } = useModal(); + + const { + modalIsOpen: productModalIsOpen, + setModalIsOpen: setProductModalIsOpen, + setIsEditing: setProductIsEditing, + setEditId: setProductEditId + } = useModal(); + + const { + initialProductCategory, + productCategories, + setProductCategories, + newProductCategory, + setNewProductCategory, + searchProductCategoryCriteria, + setSearchProductCategoryCriteria, + productCategoryService + } = useProductCategory(); + + const fetchProductCategories = useFetchProductCategories( + setLoading, + setProductCategories, + setPageNation, + setError, + showErrorMessage, + productCategoryService + ); + const { + products, + setProducts, + productService + } = useProduct(); + + const fetchProducts = useFetchProducts( + setLoading, + setProducts, + setPageNation, + setError, + showErrorMessage, + productService + ); + + useEffect(() => { + fetchProductCategories.load().then(() => { + fetchProducts.load().then(); + } + ); + }, []); + + const modalView = () => { + const editModal = () => { + const handleOpenModal = (productCategory?: ProductCategoryType) => { + setMessage(""); + setError(""); + if (productCategory) { + setNewProductCategory(productCategory); + setEditId(productCategory.productCategoryCode.value); + setIsEditing(true); + } else { + setNewProductCategory(initialProductCategory); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return ( + + {singleView()} + + {isEditing && ( + !e.deleteFlag)} + handleAdd={() => { + setMessage(""); + setError(""); + setProductIsEditing(true); + setProductModalIsOpen(true); + }} + handleDelete={(product: ProductType) => { + const newProducts = newProductCategory.products.filter((e) => e.productCode.value !== product.productCode.value); + if (product.productCode.value) { + newProducts.push({ + ...product, + addFlag: false, + deleteFlag: true + }); + } + setNewProductCategory({ + ...newProductCategory, + products: newProducts + }); + }} + /> + ) + } + + ) + } + + return { + handleOpenModal, + handleCloseModal, + editModalView + } + } + + const productModal = () => { + const handleCloseProductModal = () => { + setError(""); + setProductModalIsOpen(false); + setProductEditId(null); + } + + const productModalView = () => { + return ( + + { + { + const newProducts = newProductCategory.products.filter((e) => e.productCode.value !== product.productCode.value); + if (product.productCode.value) { + newProducts.push({ + ...product, + addFlag: true, + deleteFlag: false + }); + } + setNewProductCategory({ + ...newProductCategory, + products: newProducts + }); + }} + handleClose={handleCloseProductModal} + pageNation={pageNation} + fetchProducts={fetchProducts.load} + /> + } + + + ) + } + + return { + productModalView, + } + } + + const searchModal = () => { + const handleOpenSearchModal = () => { + setSearchModalIsOpen(true); + } + + const handleCloseSearchModal = () => { + setSearchModalIsOpen(false); + } + + const searchModalView = () => { + return ( + + { + { + if (!searchProductCategoryCriteria) { + return; + } + setLoading(true); + try { + const result = await productCategoryService.search(searchProductCategoryCriteria); + setProductCategories(result ? result.list : []); + if (result.list.length === 0) { + showErrorMessage(`検索結果は0件です`, setError); + } else { + setCriteria(searchProductCategoryCriteria); + setPageNation(result); + setMessage(""); + setError(""); + } + } catch (error: any) { + showErrorMessage(`実行履歴情報の検索に失敗しました: ${error?.message}`, setError); + } finally { + setLoading(false); + } + }} + handleClose={handleCloseSearchModal} + /> + } + + ) + } + + return { + searchModalView, + handleOpenSearchModal, + handleCloseSearchModal + } + } + + const init = () => { + return ( + <> + {editModal().editModalView()} + {productModal().productModalView()} + {searchModal().searchModalView()} + + ) + } + + return { + searchModal, + editModal, + init + } + } + + const collectionView = () => { + const {handleOpenModal} = modalView().editModal() + const {handleOpenSearchModal} = modalView().searchModal() + + const handleDeleteProductCategory = async (productCategoryCode: string) => { + try { + if (!window.confirm(`商品分類コード:${productCategoryCode} を削除しますか?`)) return; + await productCategoryService.destroy(productCategoryCode); + await fetchProductCategories.load(); + setMessage("商品分類を削除しました。"); + } catch (error: any) { + showErrorMessage(`商品分類の削除に失敗しました: ${error?.message}`, setError); + } + }; + + const handleCheckProductCategory = (productCategory: ProductCategoryType) => { + const newProductCategories = productCategories.map((cat) => { + if (cat.productCategoryCode.value === productCategory.productCategoryCode.value) { + return { + ...cat, + checked: !cat.checked + }; + } + return cat; + }); + setProductCategories(newProductCategories); + } + + const handleCheckAllProductCategories = () => { + const newProductCategories = productCategories.map((cat) => { + return { + ...cat, + checked: !productCategories.every((cat) => cat.checked) + }; + }); + setProductCategories(newProductCategories); + } + + const handleDeleteCheckedProductCategories = async () => { + if (!productCategories.some((cat) => cat.checked)) { + setError("削除する商品分類を選択してください。"); + return; + } + try { + if (!window.confirm(`選択した商品分類を削除しますか?`)) return; + const checkedProductCategories = productCategories.filter((cat) => cat.checked); + await Promise.all(checkedProductCategories.map((cat) => productCategoryService.destroy(cat.productCategoryCode.value))); + await fetchProductCategories.load(); + setMessage("選択した商品分類を削除しました。"); + } catch (error: any) { + showErrorMessage(`商品分類の削除に失敗しました: ${error?.message}`, setError); + } + } + + return ( + + ) + }; + + const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + + const handleCreateOrUpdateProductCategory = async () => { + const validateProductCategory = (): boolean => { + if (!newProductCategory.productCategoryCode.value.trim() || !newProductCategory.productCategoryName.trim()) { + setError("商品分類コード、カテゴリ名は必須項目です。"); + return false; + } + return true; + }; + if (!validateProductCategory()) return; + try { + if (isEditing && editId) { + await productCategoryService.update(newProductCategory); + } else { + await productCategoryService.create(newProductCategory); + } + setNewProductCategory({...initialProductCategory}); + await fetchProductCategories.load(); + if (isEditing) { + setMessage("商品分類を更新しました。"); + } else { + setMessage("商品分類を作成しました。"); + } + handleCloseModal(); + } catch (error: any) { + showErrorMessage(`商品分類の作成に失敗しました: ${error?.message}`, setError); + } + }; + + return ( + + ); + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {modalView().init()} + {collectionView()} + + + )} + + ); + }; + + return ( + + ); +}; diff --git a/app/frontend/src/components/master/ProductItem.tsx b/app/frontend/src/components/master/ProductItem.tsx new file mode 100644 index 00000000..0a77127d --- /dev/null +++ b/app/frontend/src/components/master/ProductItem.tsx @@ -0,0 +1,647 @@ +import React, {useEffect, useState} from 'react'; +import Modal from "react-modal"; +import {showErrorMessage} from "../application/utils.ts"; +import {useMessage} from "../application/Message.tsx"; +import {useModal, useTab} from "../application/hooks.ts"; +import {usePageNation} from "../../views/application/PageNation.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import { + useFetchBoms, + useFetchProductCategories, + useFetchProducts, + useFetchSubstitutes, + useProduct, + useProductCategory +} from "./hooks"; +import { + ProductCategoryCollectionSelectView, + ProductCategorySelectView +} from "../../views/master/product/ProductCategorySelect.tsx"; +import {ProductCategoryCriteriaType, ProductCriteriaType, ProductType} from "../../models"; +import {SubstituteProductCollectionAddListView} from "../../views/master/product/item/SubstituteProductCollection.tsx"; +import {BomCollectionAddListView} from "../../views/master/product/item/BomCollection.tsx"; +import { + CustomerSpecificSellingPriceCollectionAddListView +} from "../../views/master/product/item/CustomerSpecificSellingPriceCollection.tsx"; +import {ProductCollectionSelectView} from "../../views/master/product/item/ProductSelect.tsx"; +import {ProductSearchSingleView} from "../../views/master/product/ProductSearch.tsx"; +import {ProductCollectionView} from "../../views/master/product/item/ProductCollection.tsx"; +import {ProductSingleView} from "../../views/master/product/item/ProductSingle.tsx"; + +export const ProductItem: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError} = useMessage(); + const {pageNation, setPageNation, criteria, setCriteria} = usePageNation(); + const {pageNation: substitutePageNation, setPageNation: setSubstitutePageNation} = usePageNation(); + const {pageNation: bomPageNation, setPageNation: setBomPageNation} = usePageNation(); + const {pageNation: productCategoryPageNation, setPageNation: setProductCategoryPageNation} = usePageNation(); + + const {modalIsOpen: searchModalIsOpen, setModalIsOpen: setSearchModalIsOpen,} = useModal(); + + const { + modalIsOpen, + setModalIsOpen, + isEditing, + setIsEditing, + editId, + setEditId + } = useModal(); + + const { + modalIsOpen: productModalIsOpen, + setModalIsOpen: setProductModalIsOpen, + setIsEditing: setProductIsEditing, + setEditId: setProductEditId + } = useModal(); + + const { + modalIsOpen: bomModalIsOpen, + setModalIsOpen: setBomModalIsOpen, + setIsEditing: setBomIsEditing, + setEditId: setBomEditId + } = useModal(); + + const { + modalIsOpen: productCategoryModalIsOpen, + setModalIsOpen: setProductCategoryModalIsOpen + } = useModal(); + + const { + initialProduct, + products, + setProducts, + newProduct, + setNewProduct, + searchProductCriteria, + setSearchProductCriteria, + productService + } = useProduct(); + + const fetchProducts = useFetchProducts( + setLoading, + setProducts, + setPageNation, + setError, + showErrorMessage, + productService + ); + + const { + products: substitutes, + setProducts: setSubstitutes, + productService: substituteService + } = useProduct(); + + const fetchSubstitutes = useFetchSubstitutes( + setLoading, + setSubstitutes, + setSubstitutePageNation, + setError, + showErrorMessage, + substituteService + ); + + const { + products: boms, + setProducts: setBoms, + productService: bomService + } = useProduct(); + + const fetchBoms = useFetchBoms( + setLoading, + setBoms, + setBomPageNation, + setError, + showErrorMessage, + bomService + ); + + const { + productCategories, + setProductCategories, + productCategoryService + } = useProductCategory(); + + const fetchProductCategories = useFetchProductCategories( + setLoading, + setProductCategories, + setProductCategoryPageNation, + setError, + showErrorMessage, + productCategoryService + ); + + useEffect(() => { + (async () => { + try { + await Promise.all([ + fetchProducts.load(), + fetchSubstitutes.load(), + fetchBoms.load(), + fetchProductCategories.load() + ]); + } catch (error: any) { + showErrorMessage(`商品情報の取得に失敗しました: ${error?.message}`, setError); + } + })(); + }, []); + + const { + Tab, + TabList, + TabPanel, + Tabs, + } = useTab(); + + const modalView = () => { + const editModal = () => { + const handleOpenModal = (product?: ProductType) => { + setMessage(""); + setError(""); + if (product) { + setNewProduct(product); + setEditId(product.productCode.value); + setIsEditing(true); + } else { + setNewProduct(initialProduct); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return ( + + {singleView()} + + {substituteModal().substituteEditModalView()} + {bomModal().bomEditModalView()} + + {isEditing && ( + + + 代替品 + 部品表 + 顧客別販売単価 + + + { + setMessage(""); + setError(""); + setProductIsEditing(true); + setProductModalIsOpen(true); + }} + handleDelete={(product) => { + setNewProduct({ + ...newProduct, + substituteProduct: newProduct.substituteProduct.filter( + (substituteProduct) => substituteProduct.substituteProductCode !== product.substituteProductCode + ) + }); + }} + /> + + + { + setMessage(""); + setError(""); + setBomIsEditing(true); + setBomModalIsOpen(true); + }} + handleDelete={(product) => { + setNewProduct({ + ...newProduct, + boms: newProduct.boms.filter( + (bomProduct) => bomProduct.componentCode !== product.componentCode + ) + }); + }} + /> + + + { + setNewProduct({ + ...newProduct, + customerSpecificSellingPrices: newProduct.customerSpecificSellingPrices.concat({ + productCode: newProduct.productCode, + customerCode: "XXXX", + sellingPrice: { + amount: 0, + currency: "JPY" + } + }) + }); + }} + handleDelete={(price) => { + setNewProduct({ + ...newProduct, + customerSpecificSellingPrices: newProduct.customerSpecificSellingPrices.filter( + (sellingPrice) => sellingPrice.customerCode !== price.customerCode + ) + }); + }} + /> + + + ) + } + + ) + } + + return { + handleOpenModal, + handleCloseModal, + editModalView + } + } + + const substituteModal = () => { + const handleCloseProductModal = () => { + setError(""); + setProductModalIsOpen(false); + setProductEditId(null); + } + + const substituteEditModalView = () => { + return ( + + { + { + const newProducts = newProduct.substituteProduct.filter((e) => e.substituteProductCode.value !== product.productCode.value); + newProducts.push({ + productCode: newProduct.productCode, + substituteProductCode: product.productCode, + priority: 0 + }); + setNewProduct({ + ...newProduct, + substituteProduct: newProducts + }); + }} + handleClose={handleCloseProductModal} + pageNation={substitutePageNation} + fetchProducts={fetchSubstitutes.load} + /> + } + + + ) + } + + return { + substituteEditModalView + } + } + + const bomModal = () => { + const handleCloseBomModal = () => { + setError(""); + setBomModalIsOpen(false); + setBomEditId(null); + } + + const bomEditModalView = () => { + return ( + + { + { + const newProducts = newProduct.boms.filter((e) => e.productCode.value !== bom.productCode.value); + newProducts.push({ + productCode: newProduct.productCode, + componentCode: bom.productCode, + componentQuantity: { + amount: 1, + unit: "個" + } + }); + setNewProduct({ + ...newProduct, + boms: newProducts + }); + }} + handleClose={handleCloseBomModal} + pageNation={bomPageNation} + fetchProducts={fetchBoms.load} + /> + } + + + ) + } + + return { + bomEditModalView + } + } + + const productCategoryModal = () => { + const handleCloseProductModal = () => { + setError(""); + setProductModalIsOpen(false); + setProductEditId(null); + } + + const productCategorySearchModalView = () => { + return ( + + { + { + setSearchProductCriteria( + { + ...searchProductCriteria, + productCategoryCode: productCategory.productCategoryCode.value + } + ) + setProductCategoryModalIsOpen(false); + }} + handleClose={() => setProductCategoryModalIsOpen(false)} + pageNation={productCategoryPageNation} + fetchProductCategories={fetchProductCategories.load} + /> + } + + + ) + } + + return { + productCategorySearchModalView + } + } + + const searchModal = () => { + const handleOpenSearchModal = () => { + setSearchModalIsOpen(true); + } + + const handleCloseSearchModal = () => { + setSearchModalIsOpen(false); + } + + const searchModalView = () => { + return ( + + { + <> + { + if (!searchProductCriteria) { + return; + } + setLoading(true); + try { + const result = await productService.search(searchProductCriteria); + setProducts(result ? result.list : []); + if (result.list.length === 0) { + showErrorMessage(`検索結果は0件です`, setError); + } else { + setCriteria(searchProductCriteria); + setPageNation(result); + setMessage(""); + setError(""); + } + } catch (error: any) { + showErrorMessage(`実行履歴情報の検索に失敗しました: ${error?.message}`, setError); + } finally { + setLoading(false); + } + }} + handleClose={handleCloseSearchModal} + /> + + {productCategoryModal().productCategorySearchModalView()} + setProductCategoryModalIsOpen(true)} + /> + + } + + ) + } + + return { + searchModalView, + handleOpenSearchModal, + handleCloseSearchModal + } + } + + const init = () => { + return ( + <> + {editModal().editModalView()} + {searchModal().searchModalView()} + + ) + } + + return { + searchModal, + editModal, + init + } + } + + // TODO:顧客マスタの作成後に実装 + const collectionView = () => { + const {handleOpenModal} = modalView().editModal(); + const {handleOpenSearchModal} = modalView().searchModal(); + + const handleDeleteProduct = async (productCode: string) => { + try { + if (!window.confirm(`商品コード:${productCode} を削除しますか?`)) return; + await productService.destroy(productCode); + await fetchProducts.load(); + setMessage("商品を削除しました。"); + } catch (error: any) { + showErrorMessage(`商品の削除に失敗しました: ${error?.message}`, setError); + } + }; + + const handleCheckProduct = (product: ProductType) => { + const newProducts = products.map((prod) => { + if (prod.productCode.value === product.productCode.value) { + return { + ...prod, + checked: !prod.checked + }; + } + return prod; + }); + setProducts(newProducts); + } + + const handleCheckAllProducts = () => { + const newProducts = products.map((prod) => { + return { + ...prod, + checked: !products.every((prod) => prod.checked) + }; + }); + setProducts(newProducts); + } + + const handleDeleteCheckedProducts = async () => { + if (!products.some((prod) => prod.checked)) { + setError("削除する商品を選択してください。"); + return; + } + try { + if (!window.confirm(`選択した商品を削除しますか?`)) return; + const checkedProducts = products.filter((prod) => prod.checked); + await Promise.all(checkedProducts.map((prod) => productService.destroy(prod.productCode.value))); + await fetchProducts.load(); + setMessage("選択した商品を削除しました。"); + } catch (error: any) { + showErrorMessage(`商品の削除に失敗しました: ${error?.message}`, setError); + } + } + + return ( + + ) + }; + + const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + + const handleCreateOrUpdateProduct = async () => { + const validateProduct = (): boolean => { + if (!newProduct.productCode.value.trim() || !newProduct.productName.productFormalName.trim()) { + setError("商品コード、商品名は必須項目です。"); + return false; + } + //販売区分を選択してください + if (!newProduct.productType) { + setError("販売区分を選択してください。"); + return false; + } + if (!newProduct.taxType) { + setError("税区分を選択してください。"); + return false; + } + if (!newProduct.miscellaneousType) { + setError("雑区分を選択してください。"); + return false; + } + if (!newProduct.stockManagementTargetType) { + setError("在庫管理対象区分を選択してください。"); + return false; + } + if (!newProduct.stockAllocationType) { + setError("在庫引当区分を選択してください。"); + return false; + } + return true; + }; + if (!validateProduct()) return; + try { + if (isEditing && editId) { + await productService.update(newProduct); + } else { + await productService.create(newProduct); + } + setNewProduct({...initialProduct}); + await fetchProducts.load(); + setMessage(isEditing ? "商品を更新しました。" : "商品を作成しました。"); + handleCloseModal(); + } catch (error: any) { + showErrorMessage(`商品の作成に失敗しました: ${error?.message}`, setError); + } + }; + + return ( + + ); + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {modalView().init()} + {collectionView()} + + )} + + ); + }; + + return ( + + ); +}; diff --git a/app/frontend/src/components/master/hooks/department.ts b/app/frontend/src/components/master/hooks/department.ts new file mode 100644 index 00000000..7ac5e385 --- /dev/null +++ b/app/frontend/src/components/master/hooks/department.ts @@ -0,0 +1,49 @@ +import {useState} from "react"; +import { + DepartmentCriteriaType, + DepartmentType, + LowerType, + SlitYnType +} from "../../../models"; +import {DepartmentService, DepartmentServiceType} from "../../../services/master/department.ts"; +import {PageNationType} from "../../../views/application/PageNation.tsx"; +import {useFetchEntities} from "../../application/hooks.ts"; + +export const useDepartment = () => { + const initialDepartment = { + departmentId: {deptCode: {value: ""}, departmentStartDate: {value: ""}}, + endDate: {value: ""}, + departmentName: "", + layer: 0, + path: {value: ""}, + lowerType: LowerType.NO, + slitYn: SlitYnType.NO, + employees: [], + checked: false + }; + + const [departments, setDepartments] = useState([]); + const [newDepartment, setNewDepartment] = useState(initialDepartment); + const [searchDepartmentCriteria, setSearchDepartmentCriteria] = useState({}); + const departmentService = DepartmentService(); + + return { + initialDepartment, + departments, + newDepartment, + setNewDepartment, + searchDepartmentCriteria, + setSearchDepartmentCriteria, + setDepartments, + departmentService, + } +} + +export const useFetchDepartments = ( + setLoading: (loading: boolean) => void, + setList: (list: DepartmentType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: DepartmentServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, service, "部門情報の取得に失敗しました:"); diff --git a/app/frontend/src/components/master/hooks/employee.ts b/app/frontend/src/components/master/hooks/employee.ts new file mode 100644 index 00000000..7158b459 --- /dev/null +++ b/app/frontend/src/components/master/hooks/employee.ts @@ -0,0 +1,90 @@ +import {useState} from "react"; +import { + EmployeeCriteriaType, + EmployeeType, + LowerType, + SlitYnType +} from "../../../models"; +import {EmployeeService, EmployeeServiceType} from "../../../services/master/employee.ts"; +import {PageNationType} from "../../../views/application/PageNation.tsx"; +import {useFetchEntities} from "../../application/hooks.ts"; + +export const useEmployee = () => { + const initialEmployee: EmployeeType = { + empCode: {value: ""}, + empName: { + firstName: "", + lastName: "", + firstNameKana: "", + lastNameKana: "" + }, + loginPassword: "", + tel: { + value: "", + areaCode: "", + localExchange: "", + subscriberNumber: "" + }, + fax: { + value: "", + areaCode: "", + localExchange: "", + subscriberNumber: "" + }, + occuCode: { + value: "" + }, + approvalCode: "", + department: { + departmentId: {deptCode: {value: ""}, departmentStartDate: {value: ""}}, + endDate: {value: ""}, + departmentName: "", + layer: 0, + path: {value: ""}, + lowerType: LowerType.NO, + slitYn: SlitYnType.NO, + employees: [], + checked: false + }, + user: { + userId: {value: ""}, + name: { + firstName: "", + lastName: "" + }, + password: { + value: "" + }, + roleName: "" + }, + addFlag: false, + deleteFlag: false, + checked: false + }; + + const [employees, setEmployees] = useState([]); + const [newEmployee, setNewEmployee] = useState(initialEmployee); + const [searchEmployeeCriteria, setSearchEmployeeCriteria] = useState({}); + + const employeeService = EmployeeService(); + + return { + initialEmployee, + employees, + newEmployee, + setNewEmployee, + setEmployees, + searchEmployeeCriteria, + setSearchEmployeeCriteria, + employeeService, + }; +} + +export const useFetchEmployees = ( + setLoading: (loading: boolean) => void, + setList: (list: EmployeeType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: EmployeeServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, service, "社員情報の取得に失敗しました:"); diff --git a/app/frontend/src/components/master/hooks/index.ts b/app/frontend/src/components/master/hooks/index.ts new file mode 100644 index 00000000..b0de351e --- /dev/null +++ b/app/frontend/src/components/master/hooks/index.ts @@ -0,0 +1,3 @@ +export * from './department'; +export * from './employee'; +export * from './product'; \ No newline at end of file diff --git a/app/frontend/src/components/master/hooks/product.ts b/app/frontend/src/components/master/hooks/product.ts new file mode 100644 index 00000000..a0a33be4 --- /dev/null +++ b/app/frontend/src/components/master/hooks/product.ts @@ -0,0 +1,122 @@ +import {useState} from "react"; +import {ProductCategoryCriteriaType, ProductCategoryType, ProductCriteriaType, ProductType} from "../../../models"; +import {ProductCategoryService, ProductCategoryServiceType} from "../../../services/master/product_category.ts"; +import {PageNationType} from "../../../views/application/PageNation.tsx"; +import {useFetchEntities} from "../../application/hooks.ts"; +import {ProductService, ProductServiceType} from "../../../services/master/product.ts"; + +export const useProductCategory = () => { + const initialProductCategory: ProductCategoryType = { + productCategoryCode: {value: ""}, + productCategoryName: "", + productCategoryHierarchy: 0, + productCategoryPath: "", + lowestLevelDivision: 0, + products: [], + checked: false + }; + + const [productCategories, setProductCategories] = useState([]); + const [newProductCategory, setNewProductCategory] = useState(initialProductCategory); + const [searchProductCategoryCriteria, setSearchProductCategoryCriteria] = useState({}); + const productCategoryService = ProductCategoryService(); + + return { + initialProductCategory, + productCategories, + newProductCategory, + setNewProductCategory, + setProductCategories, + searchProductCategoryCriteria, + setSearchProductCategoryCriteria, + productCategoryService + }; +}; + +export const useFetchProductCategories = ( + setLoading: (loading: boolean) => void, + setList: (list: ProductCategoryType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: ProductCategoryServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, service, "商品分類情報の取得に失敗しました:"); + +export const useProduct = () => { + const initialProduct: ProductType = { + productCode: { + value: "", + businessType: "", + itemType: "", + livestockType: "", + serialNumber: 0, + }, + productName: { + productFormalName: "", + productAbbreviation: "", + productNameKana: "", + }, + productType: "", + sellingPrice: {amount: 0, currency: ""}, + purchasePrice: {amount: 0, currency: ""}, + costOfSales: {amount: 0, currency: ""}, + taxType: "", + productCategoryCode: {value: ""}, + miscellaneousType: "", + stockManagementTargetType: "", + stockAllocationType: "", + supplierCode: { + value: "", + branchNumber: 0, + }, + substituteProduct: [], + boms: [], + customerSpecificSellingPrices: [], + checked: false, + addFlag: false, + deleteFlag: false, + }; + + const [products, setProducts] = useState([]); + const [newProduct, setNewProduct] = useState(initialProduct); + const [searchProductCriteria, setSearchProductCriteria] = useState({}); + const productService = ProductService(); + + return { + initialProduct, + products, + newProduct, + setNewProduct, + setProducts, + searchProductCriteria, + setSearchProductCriteria, + productService + }; +}; + +export const useFetchProducts = ( + setLoading: (loading: boolean) => void, + setList: (list: ProductType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: ProductServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, service, "商品情報の取得に失敗しました:"); + +export const useFetchBoms = ( + setLoading: (loading: boolean) => void, + setList: (list: ProductType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: ProductServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, {select: service.selectBoms}, "部品情報の取得に失敗しました:"); + +export const useFetchSubstitutes = ( + setLoading: (loading: boolean) => void, + setList: (list: ProductType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: ProductServiceType +) => useFetchEntities(setLoading, setList, setPageNation, setError, showErrorMessage, service, "代替商品情報の取得に失敗しました:"); \ No newline at end of file diff --git a/app/frontend/src/components/system/Audit.tsx b/app/frontend/src/components/system/Audit.tsx new file mode 100644 index 00000000..effe70dd --- /dev/null +++ b/app/frontend/src/components/system/Audit.tsx @@ -0,0 +1,281 @@ +import React, {useEffect, useState} from "react"; +import {useMessage} from "../application/Message.tsx"; +import {usePageNation} from "../../views/application/PageNation.tsx"; +import {useModal} from "../application/hooks.ts"; +import {AuditType, AuditCriteriaType} from "../../models/system/audit.ts"; +import {SiteLayout} from "../../views/SiteLayout.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {AuditCollectionView} from "../../views/system/audit/AuditCollection.tsx"; +import {AuditSingleView} from "../../views/system/audit/AuditSingle.tsx"; +import {AuditSearchSingleView} from "../../views/system/audit/AuditSearch.tsx"; +import {useAudit, useFetchAudits} from "./hooks"; + +export const Audit: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError, showErrorMessage} = useMessage(); + const {pageNation, setPageNation, criteria, setCriteria} = usePageNation(); + const {modalIsOpen, setModalIsOpen, isEditing, setIsEditing, setEditId, Modal} = useModal(); + const {modalIsOpen: searchModalIsOpen, setModalIsOpen: setSearchModalIsOpen,} = useModal(); + const { + initialAudit, + audits, + setAudits, + newAudit, + setNewAudit, + searchAuditCriteria, + setSearchAuditCriteria, + auditService + } = useAudit(); + const fetchAudits = useFetchAudits( + setLoading, + setAudits, + setPageNation, + setError, + showErrorMessage, + auditService + ); + + useEffect(() => { + fetchAudits.load().then(() => { + }); + }, []); + + + const modalView = () => { + const editModal = () => { + const handleOpenModal = (audit?: AuditType) => { + setMessage(""); + setError(""); + if (audit) { + setNewAudit(audit); + setIsEditing(true); + } else { + setNewAudit(initialAudit); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return ( + + {singleView()} + + ); + } + + return { + editModalView, + handleOpenModal, + handleCloseModal + } + } + + const searchModal = () => { + const handleOpenSearchModal = () => { + setSearchModalIsOpen(true); + } + + const handleCloseSearchModal = () => { + setSearchModalIsOpen(false); + } + + const searchModalView = () => { + return ( + + { + { + if (!searchAuditCriteria) { + return; + } + setLoading(true); + try { + const fetchedAudit = await auditService.search(searchAuditCriteria); + setAudits(fetchedAudit ? fetchedAudit.list : []); + if (fetchedAudit.list.length === 0) { + showErrorMessage(`検索結果は0件です`, setError); + } else { + setCriteria(searchAuditCriteria); + setPageNation(fetchedAudit); + setMessage(""); + setError(""); + } + } catch (error: any) { + showErrorMessage(`実行履歴情報の検索に失敗しました: ${error?.message}`, setError); + } finally { + setLoading(false); + } + }} + handleClose={handleCloseSearchModal} + /> + } + + ) + } + + return { + searchModalView, + handleOpenSearchModal, + handleCloseSearchModal + } + } + + const init = () => { + return ( + <> + {editModal().editModalView()} + {searchModal().searchModalView()} + + ) + } + + return { + editModal, + searchModal, + init + } + } + + const collectionView = () => { + const {handleOpenModal} = modalView().editModal(); + const {handleOpenSearchModal} = modalView().searchModal(); + + const handleCheckAudit = (audit: AuditType) => { + const newAudit = audits.map((d) => { + if (d.id === audit.id) { + return { + ...d, + checked: !d.checked + }; + } + return d; + }); + setAudits(newAudit); + } + + const handleCheckAllAudit = () => { + const newAudits = audits.map((d) => { + return { + ...d, + checked: !audits.every((d) => d.checked) + }; + }); + setAudits(newAudits); + } + + const handleDeleteAudit = async (auditId: number) => { + try { + if (!window.confirm(`実行履歴ID:${auditId} を削除しますか?`)) return; + await auditService.destroy(auditId); + await fetchAudits.load(pageNation?.pageNum, searchAuditCriteria); + setMessage("アプリケーション実行履歴情報を削除しました。"); + } catch (error: any) { + showErrorMessage(`アプリケーション実行履歴情報の削除に失敗しました: ${error?.message}`, setError); + } + }; + + const handleDeleteCheckedCollection = async () => { + const checkedAudits = audits.filter((d) => d.checked); + if (!checkedAudits.length) { + setError("削除する履歴を選択してください。"); + return; + } + + try { + if (!window.confirm("選択した履歴を削除しますか?")) return; + await Promise.all(checkedAudits.map((d) => auditService.destroy(d.id))); + await fetchAudits.load(pageNation?.pageNum, searchAuditCriteria); + setMessage("選択した履歴を削除しました。"); + } catch (error: any) { + showErrorMessage(`選択した履歴の削除に失敗しました: ${error?.message}`, setError); + } + } + + return ( + + ); + }; + + const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + + return ( + + ); + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {modalView().init()} + {collectionView()} + + )} + + ); + }; + + return ( + + + + ); +}; \ No newline at end of file diff --git a/app/src/components/system/Login.tsx b/app/frontend/src/components/system/Auth.tsx similarity index 74% rename from app/src/components/system/Login.tsx rename to app/frontend/src/components/system/Auth.tsx index d3d0bc8b..c2ebfe06 100644 --- a/app/src/components/system/Login.tsx +++ b/app/frontend/src/components/system/Auth.tsx @@ -1,9 +1,9 @@ import React, {useEffect, useState} from "react"; import {useLocation, useNavigate} from "react-router-dom"; -import {CustomLocation, DataType, RoleType, UserType} from "../../models"; -import {AuthUserContextType, useAuthUserContext} from "../../providers/AuthUser"; -import AuthService from "../../services/auth"; -import {LoginSingleView} from "../../views/system/Login.tsx"; +import {AuthUserContextType, useAuthUserContext} from "../../providers/AuthUser.tsx"; +import AuthService from "../../services/system/auth.ts"; +import {LoginSingleView} from "../../views/system/auth/Login.tsx"; +import {CustomLocation, DataType, UserType} from "../../models"; const DEFAULT_USER_ID = "U000003"; const DEFAULT_PASSWORD = "a234567Z"; @@ -35,7 +35,7 @@ export const Login: React.FC = () => { const user: UserType = { userId: data.userId, token: data.accessToken, - roles: data.roles as RoleType[], + roles: data.roles, }; authUser.signIn(user, () => { navigate(fromPathName, {replace: true}); @@ -56,3 +56,20 @@ export const Login: React.FC = () => { /> ); } + +export const Logout: React.FC = () => { + const authUser: AuthUserContextType = useAuthUserContext(); + const navigate = useNavigate(); + + const handleSignOut = () => { + authUser.signOut(() => { + navigate("/login"); + }); + }; + + React.useEffect(() => { + handleSignOut(); + }, []); + + return null; +}; diff --git a/app/frontend/src/components/system/Download.tsx b/app/frontend/src/components/system/Download.tsx new file mode 100644 index 00000000..2f66bbe1 --- /dev/null +++ b/app/frontend/src/components/system/Download.tsx @@ -0,0 +1,90 @@ +import React, {useState} from "react"; +import {useMessage} from "../application/Message.tsx"; +import {DownloadService} from "../../services/system/download.ts"; +import {DownloadTarget} from "../../models/system/download.ts"; +import {SiteLayout} from "../../views/SiteLayout.tsx"; +import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {SingleView} from "../../views/system/download/DownloadSingle.tsx"; +import {getKeyBySymbol, getSymbolByValue} from "../../models/utils.ts"; + +export const Download: React.FC = () => { + const Content: React.FC = () => { + const [loading, setLoading] = useState(false); + const {message, setMessage, error, setError, showErrorMessage} = useMessage(); + const [selectedTarget, setSelectedTarget] = useState(null); + const downloadService = DownloadService(); + + const handleDownload = async () => { + if (!selectedTarget) { + setError("ダウンロード対象を選択してください。"); + return; + } + setLoading(true); + setMessage(""); + setError(""); + + try { + const condition = { target: selectedTarget }; + const downloadCount = await downloadService.count(condition); + const isProceed = confirm(`${downloadCount}件ダウンロードします。よろしいですか?`); + if (!isProceed) return; + + const blob = await downloadService.download(condition); + const currentDate = new Date().toISOString().split("T")[0]; + const symbol = getSymbolByValue(DownloadTarget, selectedTarget); + const symbolName = getKeyBySymbol(DownloadTarget, symbol?.toString() as DownloadTarget) ?? "unknown"; + const downloadFileName = `${symbolName}-${currentDate}.csv`; + + const url = window.URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = downloadFileName; + a.click(); + window.URL.revokeObjectURL(url); + + setMessage(`${symbolName} データをダウンロードしました。`); + } catch (error: any) { + showErrorMessage( + `ダウンロードに失敗しました: ${error?.message}`, + setError + ); + } finally { + setLoading(false); + } + }; + + const singleView = () => { + return ( + + ); + }; + + return ( + <> + {loading ? ( + + ) : ( + <> + {singleView()} + + )} + + ); + }; + + return ( + + + + ); +}; diff --git a/app/src/components/system/User.tsx b/app/frontend/src/components/system/User.tsx similarity index 66% rename from app/src/components/system/User.tsx rename to app/frontend/src/components/system/User.tsx index f2283717..e7240c88 100644 --- a/app/src/components/system/User.tsx +++ b/app/frontend/src/components/system/User.tsx @@ -1,13 +1,13 @@ import React, {useEffect, useState} from "react"; -import {UserAccountType} from "../../models"; -import {useMessage} from "../application/Message"; import {useModal} from "../application/hooks"; import {useFetchUsers, useUser} from "./hooks"; import {usePageNation} from "../../views/application/PageNation.tsx"; import LoadingIndicator from "../../views/application/LoadingIndicatior.tsx"; +import {useMessage} from "../application/Message"; import {SiteLayout} from "../../views/SiteLayout.tsx"; -import {UserCollectionView} from "../../views/system/UserCollection.tsx"; -import {UserSingleView} from "../../views/system/UserSingle.tsx"; +import {UserAccountType} from "../../models"; +import {UserCollectionView} from "../../views/system/user/UserCollection.tsx"; +import {UserSingleView} from "../../views/system/user/UserSingle.tsx"; export const User: React.FC = () => { const Content: React.FC = () => { @@ -40,28 +40,67 @@ export const User: React.FC = () => { }); }, []); - const handleOpenModal = (user?: UserAccountType) => { - setMessage(""); - setError(""); - if (user) { - user.password = {value: ""}; - setNewUser(user); - setEditId(user.userId.value); - setIsEditing(true); - } else { - setNewUser(initialUser); - setIsEditing(false); + const modalView = () => { + const editModal = () => { + const handleOpenModal = (user?: UserAccountType) => { + setMessage(""); + setError(""); + if (user) { + user.password = {value: ""}; + setNewUser(user); + setEditId(user.userId.value); + setIsEditing(true); + } else { + setNewUser(initialUser); + setIsEditing(false); + } + setModalIsOpen(true); + }; + + const handleCloseModal = () => { + setError(""); + setModalIsOpen(false); + setEditId(null); + }; + + const editModalView = () => { + return ( + + {singleView()} + + + ) + } + + return { + handleOpenModal, + handleCloseModal, + editModalView + } } - setModalIsOpen(true); - }; - const handleCloseModal = () => { - setError(""); - setModalIsOpen(false); - setEditId(null); - }; + const init = () => ( + <> + {editModal().editModalView()} + + ) + + return{ + editModal, + init + } + } const collectionView = () => { + const {handleOpenModal} = modalView().editModal(); + const handleSearchUser = async () => { if (!searchUserId.trim()) { return; @@ -91,35 +130,20 @@ export const User: React.FC = () => { }; return ( - <> - - {singleView()} - - - ) } const singleView = () => { + const {handleCloseModal} = modalView().editModal(); + const handleCreateOrUpdateUser = async () => { const validateUser = (): boolean => { if (!newUser.userId.value.trim() || !newUser.name?.firstName?.trim() || !newUser.name?.lastName?.trim() || !newUser.roleName?.trim()) { @@ -168,7 +192,10 @@ export const User: React.FC = () => { {loading ? ( ) : ( - collectionView() + <> + {modalView().init()} + {collectionView()} + )} ); diff --git a/app/frontend/src/components/system/hooks/audit.ts b/app/frontend/src/components/system/hooks/audit.ts new file mode 100644 index 00000000..3e702726 --- /dev/null +++ b/app/frontend/src/components/system/hooks/audit.ts @@ -0,0 +1,85 @@ +import { + ApplicationExecutionHistoryType, + ApplicationExecutionProcessFlag, + ApplicationExecutionProcessType, AuditCriteriaType, AuditType +} from "../../../models/system/audit.ts"; +import {useState} from "react"; +import {AuditService, AuditServiceType} from "../../../services/system/audit.ts"; +import {PageNationType} from "../../../views/application/PageNation.tsx"; + +export const useAudit = () => { + const initialAudit = { + id: 0, + process: { + processType: ApplicationExecutionProcessType.その他, + name: "", + code: "" + }, + type: ApplicationExecutionHistoryType.同期, + processStart: new Date().toISOString(), + processEnd: new Date().toISOString(), + processFlag: ApplicationExecutionProcessFlag.未実行, + processDetails: null, + user: { + userId: { value: "" }, + name: { firstName: "", lastName: "" }, + password: { value: "" }, + roleName: "" + }, + checked: false + }; + + const initialSearchAuditCriteria = {} + + + const [audits, setAudits] = useState([]); + const [newAudit, setNewAudit] = useState(initialAudit); + const [searchAuditCriteria, setSearchAuditCriteria] = useState(initialSearchAuditCriteria); + const auditService = AuditService(); + + return { + initialAudit, + initialSearchAuditCriteria, + audits, + setAudits, + newAudit, + setNewAudit, + searchAuditCriteria, + setSearchAuditCriteria, + auditService + }; +}; + +export const useFetchAudits = ( + setLoading: (loading: boolean) => void, + setList: (list: AuditType[]) => void, + setPageNation: (pageNation: PageNationType) => void, + setError: (error: string) => void, + showErrorMessage: (message: string, callback: (error: string) => void) => void, + service: AuditServiceType) => { + + const load = async (page: number = 1, criteria?: AuditCriteriaType): Promise => { + const ERROR_MESSAGE = "アプリケーション実行履歴情報の取得に失敗しました:"; + setLoading(true); + + try { + const fetchAudits = async (criteria?: AuditCriteriaType, page: number = 1) => { + return criteria ? service.search(criteria, page) : service.select(page); + }; + + const { list, ...pagination } = await fetchAudits(criteria, page); + + setList(list); + setPageNation(pagination); + setError(""); + } catch (error: any) { + showErrorMessage(`${ERROR_MESSAGE} ${error?.message}`, setError); + } finally { + setLoading(false); + } + }; + + return { + load + }; +}; diff --git a/app/frontend/src/components/system/hooks/index.ts b/app/frontend/src/components/system/hooks/index.ts new file mode 100644 index 00000000..b7213411 --- /dev/null +++ b/app/frontend/src/components/system/hooks/index.ts @@ -0,0 +1,2 @@ +export * from './user'; +export * from './audit'; \ No newline at end of file diff --git a/app/src/components/system/hooks.ts b/app/frontend/src/components/system/hooks/user.ts similarity index 88% rename from app/src/components/system/hooks.ts rename to app/frontend/src/components/system/hooks/user.ts index 7a142785..7128ebd7 100644 --- a/app/src/components/system/hooks.ts +++ b/app/frontend/src/components/system/hooks/user.ts @@ -1,7 +1,7 @@ import {useState} from "react"; -import {UserAccountType} from "../../models"; -import {UserService, UserServiceType} from "../../services/user"; -import {PageNationType} from "../../views/application/PageNation.tsx"; +import {UserAccountType} from "../../../models"; +import {UserService, UserServiceType} from "../../../services/system/user.ts"; +import {PageNationType} from "../../../views/application/PageNation.tsx"; export const useUser = () => { const initialUser = { diff --git a/app/frontend/src/env.ts b/app/frontend/src/env.ts new file mode 100644 index 00000000..a66bd9f5 --- /dev/null +++ b/app/frontend/src/env.ts @@ -0,0 +1,34 @@ +const Env = (() => { + const isProduction = (): boolean => process.env.NODE_ENV === "production"; + const isStaging = (): boolean => process.env.VITE_MODE === "staging"; + const prdApiUrl = ((): string => { + if (isProduction()) { + return process.env.VITE_APP_API_URL as string; + } + return "" as string + })(); + const devApiUrl = ((): string => { + if (isStaging()) { + return process.env.VITE_STAGING_API_URL as string; + } + return "http://localhost:8080/api" as string + })(); + const currentEnv = (): string => { + if (isProduction()) { + return "Production"; + } + if (isStaging()) { + return "Staging"; + } + return "Development"; + } + + return { + isProduction, + prdApiUrl, + devApiUrl, + currentEnv + }; +})(); + +export default Env; \ No newline at end of file diff --git a/app/src/main.tsx b/app/frontend/src/main.tsx similarity index 100% rename from app/src/main.tsx rename to app/frontend/src/main.tsx diff --git a/app/src/models/application.ts b/app/frontend/src/models/application.ts similarity index 100% rename from app/src/models/application.ts rename to app/frontend/src/models/application.ts diff --git a/app/frontend/src/models/index.ts b/app/frontend/src/models/index.ts new file mode 100644 index 00000000..76da1eaa --- /dev/null +++ b/app/frontend/src/models/index.ts @@ -0,0 +1,7 @@ +export * from './application.ts'; +export * from './system/user.ts'; +export * from './application'; +export * from './system/user.ts'; +export * from './master/department.ts'; +export * from './master/employee.ts'; +export * from './master/product.ts'; diff --git a/app/src/models/department.ts b/app/frontend/src/models/master/department.ts similarity index 64% rename from app/src/models/department.ts rename to app/frontend/src/models/master/department.ts index c310e228..787da044 100644 --- a/app/src/models/department.ts +++ b/app/frontend/src/models/master/department.ts @@ -1,5 +1,6 @@ -import {EmployeeResourceType, EmployeeType} from './employee'; -import {toISOStringWithTimezone} from "../components/application/utils.ts"; +import {EmployeeResourceType, EmployeeType} from "./employee.ts"; +import {PageNationType} from "../../views/application/PageNation.tsx"; +import {toISOStringWithTimezone} from "../../components/application/utils.ts"; export type DepartmentIdType = { deptCode: { value: string }; @@ -18,6 +19,10 @@ export type DepartmentType = { checked: boolean; } +export type DepartmentFetchType = { + list: DepartmentType[]; +} & PageNationType; + export type DepartmentResourceType = { departmentCode: string; startDate: string; @@ -30,6 +35,13 @@ export type DepartmentResourceType = { employees: EmployeeResourceType[]; } +export type DepartmentCriteriaType = { + departmentCode?: string; + departmentName?: string; + startDate?: string; + endDate?: string; +} + export const LowerType = { YES: "LOWER", NO: "NOT_LOWER", @@ -67,3 +79,21 @@ export const mapToDepartmentResource = (department: DepartmentType): DepartmentR })) }; }; + +export const mapToDepartmentCriteriaResource = (criteria: DepartmentCriteriaType) => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + type Resource = { + departmentCode?: string; + departmentName?: string; + startDate?: string; + endDate?: string; + }; + const resource: Resource = { + ...(isEmpty(criteria.departmentCode) ? {} : { departmentCode: criteria.departmentCode }), + ...(isEmpty(criteria.departmentName) ? {} : { departmentName: criteria.departmentName }), + ...(isEmpty(criteria.startDate) ? {} : { startDate: toISOStringWithTimezone(new Date(criteria.startDate))}), + ...(isEmpty(criteria.endDate) ? {} : { endDate: toISOStringWithTimezone(new Date(criteria.endDate))}), + }; + + return resource; +}; diff --git a/app/src/models/employee.ts b/app/frontend/src/models/master/employee.ts similarity index 52% rename from app/src/models/employee.ts rename to app/frontend/src/models/master/employee.ts index e4662174..37f119b4 100644 --- a/app/src/models/employee.ts +++ b/app/frontend/src/models/master/employee.ts @@ -1,6 +1,7 @@ -import {DepartmentType} from './department'; -import {UserAccountType} from './user'; -import {toISOStringWithTimezone} from "../components/application/utils.ts"; +import {DepartmentType} from './department.ts'; +import {toISOStringWithTimezone} from "../../components/application/utils.ts"; +import {PageNationType} from "../../views/application/PageNation.tsx"; +import {UserAccountType} from "../system/user.ts"; export type EmployeeType = { empCode: { value: string }; @@ -34,6 +35,10 @@ export type EmployeeType = { checked: boolean; } +export type EmployeeFetchType = { + list: EmployeeType[]; +} & PageNationType; + export type EmployeeResourceType = { empCode: string; empName: string; @@ -48,6 +53,17 @@ export type EmployeeResourceType = { deleteFlag: boolean; } +export type EmployeeCriteriaType = { + empCode?: string; + empNameFirst?: string; + empNameLast?: string; + empNameFirstKana?: string; + empNameLastKana?: string; + phoneNumber?: string; + faxNumber?: string; + departmentCode?: string; +} + export const mapToEmployeeResource = (employee: EmployeeType): EmployeeResourceType => { return { empCode: employee.empCode.value, @@ -63,3 +79,17 @@ export const mapToEmployeeResource = (employee: EmployeeType): EmployeeResourceT deleteFlag: employee.deleteFlag }; }; + +export const mapToEmployeeCriteriaResource = (criteria: EmployeeCriteriaType) : EmployeeCriteriaType => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + return { + ...(isEmpty(criteria.empCode) ? {} : {employeeCode: criteria.empCode}), + ...(isEmpty(criteria.empNameFirst) ? {} : {employeeFirstName: criteria.empNameFirst}), + ...(isEmpty(criteria.empNameLast) ? {} : {employeeLastName: criteria.empNameLast}), + ...(isEmpty(criteria.empNameFirstKana) ? {} : {employeeFirstNameKana: criteria.empNameFirstKana}), + ...(isEmpty(criteria.empNameLastKana) ? {} : {employeeLastNameKana: criteria.empNameLastKana}), + ...(isEmpty(criteria.phoneNumber) ? {} : {phoneNumber: criteria.phoneNumber}), + ...(isEmpty(criteria.faxNumber) ? {} : {faxNumber: criteria.faxNumber}), + ...(isEmpty(criteria.departmentCode) ? {} : {departmentCode: criteria.departmentCode}), + }; +} \ No newline at end of file diff --git a/app/src/models/product.ts b/app/frontend/src/models/master/product.ts similarity index 64% rename from app/src/models/product.ts rename to app/frontend/src/models/master/product.ts index 472bd695..61623cdd 100644 --- a/app/src/models/product.ts +++ b/app/frontend/src/models/master/product.ts @@ -1,3 +1,5 @@ +import {PageNationType} from "../../views/application/PageNation.tsx"; + type ProductCodeType = { value: string; businessType: string; @@ -39,6 +41,10 @@ export type BomType = { componentQuantity: QuantityType; } +export type BomFetchType = { + list: BomType[]; +} & PageNationType; + export type CustomerSpecificSellingPriceType = { productCode: ProductCodeType; customerCode: string; @@ -86,6 +92,10 @@ export enum StockAllocationEnumType { 未引当 = "未引当", 引当済 = "引当済" } +export type ProductFetchType = { + list: ProductType[]; +} & PageNationType; + export type ProductResourceType = { productCode: string; productFormalName: string; @@ -109,6 +119,20 @@ export type ProductResourceType = { deleteFlag: boolean; } +export type ProductCriteriaType = { + productCode?: string; + productFormalName?: string; + productAbbreviation?: string; + productNameKana?: string; + productCategoryCode?: string; + supplierCode?: string; + productType?: string; + taxType?: string; + miscellaneousType?: string; + stockManagementTargetType?: string; + stockAllocationType?: string; +} + type ProductCategoryCode = { value: string; }; @@ -123,6 +147,10 @@ export type ProductCategoryType = { checked: boolean; }; +export type ProductCategoryFetchType = { + list: ProductCategoryType[]; +} & PageNationType; + export type ProductCategoryResourceType = { productCategoryCode: string; productCategoryName?: string; @@ -132,6 +160,12 @@ export type ProductCategoryResourceType = { products?: ProductResourceType[]; }; +export type ProductCategoryCriteriaType = { + productCategoryCode?: string; + productCategoryName?: string; + productCategoryPath?: string; +} + export const mapToProductResource = (product: ProductType): ProductResourceType => { return { productCode: product.productCode.value, @@ -157,6 +191,23 @@ export const mapToProductResource = (product: ProductType): ProductResourceType }; } +export const mapToProductCriteriaResource = (criteria: ProductCriteriaType): ProductCriteriaType => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + return { + ...(isEmpty(criteria.productCode) ? {} : {productCode: criteria.productCode}), + ...(isEmpty(criteria.productFormalName) ? {} : {productFormalName: criteria.productFormalName}), + ...(isEmpty(criteria.productAbbreviation) ? {} : {productAbbreviation: criteria.productAbbreviation}), + ...(isEmpty(criteria.productNameKana) ? {} : {productNameKana: criteria.productNameKana}), + ...(isEmpty(criteria.productCategoryCode) ? {} : {productCategoryCode: criteria.productCategoryCode}), + ...(isEmpty(criteria.supplierCode) ? {} : {supplierCode: criteria.supplierCode}), + ...(isEmpty(criteria.productType) ? {} : {productType: criteria.productType}), + ...(isEmpty(criteria.taxType) ? {} : {taxType: criteria.taxType}), + ...(isEmpty(criteria.miscellaneousType) ? {} : {miscellaneousType: criteria.miscellaneousType}), + ...(isEmpty(criteria.stockManagementTargetType) ? {} : {stockManagementTargetType: criteria.stockManagementTargetType}), + ...(isEmpty(criteria.stockAllocationType) ? {} : {stockAllocationType: criteria.stockAllocationType}) + }; +} + export const mapToProductCategoryResource = (productCategory: ProductCategoryType): ProductCategoryResourceType => { return { productCategoryCode: productCategory.productCategoryCode.value, @@ -167,3 +218,12 @@ export const mapToProductCategoryResource = (productCategory: ProductCategoryTyp products: productCategory.products.map(product => mapToProductResource(product)) }; } + +export const mapToProductCategoryCriteriaResource = (criteria: ProductCategoryCriteriaType): ProductCategoryCriteriaType => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + return { + ...(isEmpty(criteria.productCategoryCode) ? {} : {productCategoryCode: criteria.productCategoryCode}), + ...(isEmpty(criteria.productCategoryName) ? {} : {productCategoryName: criteria.productCategoryName}), + ...(isEmpty(criteria.productCategoryPath) ? {} : {productCategoryPath: criteria.productCategoryPath}) + }; +} diff --git a/app/frontend/src/models/system/audit.ts b/app/frontend/src/models/system/audit.ts new file mode 100644 index 00000000..66f6194a --- /dev/null +++ b/app/frontend/src/models/system/audit.ts @@ -0,0 +1,80 @@ +import {PageNationType} from "../../views/application/PageNation.tsx"; +import {UserAccountType} from "./user.ts"; + +export enum ApplicationExecutionProcessType { + ユーザー登録 = "ユーザー登録", + ユーザー更新 = "ユーザー更新", + ユーザー削除 = "ユーザー削除", + 部門登録 = "部門登録", + 部門更新 = "部門更新", + 部門削除 = "部門削除", + 社員登録 = "社員登録", + 社員更新 = "社員更新", + 社員削除 = "社員削除", + 商品分類登録 = "商品分類登録", + 商品分類更新 = "商品分類更新", + 商品分類削除 = "商品分類削除", + データダウンロード = "データダウンロード", + その他 = "その他", +} + +export enum ApplicationExecutionHistoryType { + 同期 = "同期", + 非同期 = "非同期", +} + +export enum ApplicationExecutionProcessFlag { + 実行中 = "実行中", + 実行済 = "実行済", + エラー = "エラー", + 未実行 = "未実行", +} + +type Process = { + processType: ApplicationExecutionProcessType; + name: string; + code: string; +}; + +export type AuditCriteriaType = { + processType?: ApplicationExecutionProcessType; + processFlag?: ApplicationExecutionProcessFlag; + type?: ApplicationExecutionHistoryType; +} + +export type AuditType = { + id: number; + process: Process; + type: ApplicationExecutionHistoryType; + processStart: string; // ISO 8601フォーマットの日時文字列 + processEnd: string; + processFlag: ApplicationExecutionProcessFlag; + processDetails: string | null; + user: UserAccountType; + checked: boolean; +}; + +export type AuditFetchType = { + list: AuditType[]; +} & PageNationType; + +export const mapToCriteriaResource = (criteria: AuditCriteriaType) => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + type Resource = { + process?: { + processType?: string; + }; + processFlag?: string; + type?: string; + }; + const resource: Resource = { + ...(isEmpty(criteria.processFlag) ? {} : { processFlag: criteria.processFlag }), + process: { + ...(isEmpty(criteria.processType) ? {} : { processType: criteria.processType }), + }, + ...(isEmpty(criteria.type) ? {} : { type: criteria.type }), + }; + + return resource; +}; + diff --git a/app/frontend/src/models/system/download.ts b/app/frontend/src/models/system/download.ts new file mode 100644 index 00000000..d2b59e21 --- /dev/null +++ b/app/frontend/src/models/system/download.ts @@ -0,0 +1,28 @@ +export enum DownloadTarget { + 部門 = "0", + 社員 = "1", + 商品分類 = "2", + 商品 = "3" +} + +export type DownloadConditionType = { + target: DownloadTarget; +}; + +export const mapToDownloadResource = (condition: DownloadConditionType) => { + const isEmpty = (value: unknown) => value === "" || value === null || value === undefined; + + type Resource = { + target: string; + }; + + if (isEmpty(condition.target)) { + throw new Error("Target is required."); + } + + const resource: Resource = { + target: condition.target, + }; + + return resource; +}; diff --git a/app/src/models/user.ts b/app/frontend/src/models/system/user.ts similarity index 87% rename from app/src/models/user.ts rename to app/frontend/src/models/system/user.ts index fea79755..a542901b 100644 --- a/app/src/models/user.ts +++ b/app/frontend/src/models/system/user.ts @@ -1,3 +1,5 @@ +import {PageNationType} from "../../views/application/PageNation.tsx"; + export type UserType = { userId: string; token: string; @@ -28,6 +30,10 @@ export enum RoleNameEnumType { ROLE_USER = 'USER' } +export type UserFetchType = { + list: UserAccountType[]; +} & PageNationType; + export type UserAccountResourceType = { userId: string; password: string | undefined; diff --git a/app/frontend/src/models/utils.ts b/app/frontend/src/models/utils.ts new file mode 100644 index 00000000..ef0fab6e --- /dev/null +++ b/app/frontend/src/models/utils.ts @@ -0,0 +1,27 @@ +// ジェネリクスを使用した汎用的な値からシンボルを取得する関数 +export const getSymbolByValue = >( + obj: T, + value: T[keyof T] +): T[keyof T] | undefined => { + const entries = Object.entries(obj) as [keyof T, T[keyof T]][]; + for (const [key, val] of entries) { + if (val === value) { + return obj[key]; + } + } + return undefined; // 該当する値がない場合 +}; + +// ジェネリクスを使用した汎用的なシンボルからキー名を取得する関数 +export const getKeyBySymbol = >( + obj: T, + symbol: T[keyof T] +): keyof T | undefined => { + const entries = Object.entries(obj) as [keyof T, T[keyof T]][]; + for (const [key, val] of entries) { + if (val === symbol) { + return key; + } + } + return undefined; // 該当するキーがない場合 +}; \ No newline at end of file diff --git a/app/src/providers/AuthUser.tsx b/app/frontend/src/providers/AuthUser.tsx similarity index 100% rename from app/src/providers/AuthUser.tsx rename to app/frontend/src/providers/AuthUser.tsx diff --git a/app/src/services/config.ts b/app/frontend/src/services/config.ts similarity index 63% rename from app/src/services/config.ts rename to app/frontend/src/services/config.ts index 128b4f4a..8c28c077 100644 --- a/app/src/services/config.ts +++ b/app/frontend/src/services/config.ts @@ -1,8 +1,8 @@ +import Env from "../env.ts"; + const Config = () => { let config: { apiUrl: string, authHeader: string }; - - const isProduction = () => process.env.NODE_ENV === "production"; - const getApiUrl = () => isProduction() ? "https://case-study-sales-api-50defd76b8c9.herokuapp.com/api" : "http://localhost:8080/api"; + const getApiUrl = () => Env.isProduction() ? Env.prdApiUrl : Env.devApiUrl; const user = window.localStorage.getItem("user"); if (user) { config = {apiUrl: getApiUrl(), authHeader: "Bearer " + JSON.parse(user).token}; diff --git a/app/src/services/department.ts b/app/frontend/src/services/master/department.ts similarity index 66% rename from app/src/services/department.ts rename to app/frontend/src/services/master/department.ts index d0c22326..4bba701d 100644 --- a/app/src/services/department.ts +++ b/app/frontend/src/services/master/department.ts @@ -1,30 +1,29 @@ -import Config from "./config"; -import Utils from "./utils"; -import {DepartmentType, mapToDepartmentResource} from "../models"; -import {toISOStringWithTimezone} from "../components/application/utils.ts"; +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import { + DepartmentCriteriaType, + DepartmentFetchType, + DepartmentType, + mapToDepartmentCriteriaResource, + mapToDepartmentResource +} from "../../models"; +import {toISOStringWithTimezone} from "../../components/application/utils.ts"; export interface DepartmentServiceType { - select: (page?: number, pageSize?: number) => Promise; + select: (page?: number, pageSize?: number) => Promise; find: (deptCode: string, departmentStartDate: string) => Promise; create: (department: DepartmentType) => Promise; update: (department: DepartmentType) => Promise; destroy: (deptCode: string, departmentStartDate: string) => Promise; - search: (pageSize: number, code: string, page: number) => Promise; + search: (criteria:DepartmentCriteriaType, page?: number, pageSize?: number) => Promise; } export const DepartmentService = () => { const config = Config(); const apiUtils = Utils.apiUtils; const endPoint = `${config.apiUrl}/departments`; - const select = async (page?: number, pageSize?: number): Promise => { - let url = endPoint; - if (pageSize && page) { - url = url + "?pageSize=" + pageSize + "&page=" + page; - } else if (pageSize) { - url = url + "?pageSize=" + pageSize; - } else if (page) { - url = url + "?page=" + page; - } + const select = async (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(endPoint, page, pageSize); return await apiUtils.fetchGet(url); }; @@ -44,9 +43,9 @@ export const DepartmentService = () => { return await apiUtils.fetchPut(url, mapToDepartmentResource(department)); }; - const search = async (pageSize = 10, code: string, page = 1): Promise => { - const url = `${endPoint}/search?pageSize=${pageSize}&code=${code}&page=${page}`; - return await apiUtils.fetchGet(url); + const search = (criteria: DepartmentCriteriaType, page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/search`, page, pageSize); + return apiUtils.fetchPost(url, mapToDepartmentCriteriaResource(criteria)); }; const destroy = async (deptCode: string, departmentStartDate: string): Promise => { diff --git a/app/src/services/employee.ts b/app/frontend/src/services/master/employee.ts similarity index 61% rename from app/src/services/employee.ts rename to app/frontend/src/services/master/employee.ts index 719de84d..8b3dce65 100644 --- a/app/src/services/employee.ts +++ b/app/frontend/src/services/master/employee.ts @@ -1,14 +1,20 @@ -import Config from "./config"; -import Utils from "./utils"; -import {EmployeeType, mapToEmployeeResource} from "../models"; +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import { + EmployeeCriteriaType, + EmployeeFetchType, + EmployeeType, + mapToEmployeeCriteriaResource, + mapToEmployeeResource +} from "../../models"; export interface EmployeeServiceType { - select: (page?: number, pageSize?: number) => Promise; + select: (page?: number, pageSize?: number) => Promise; find: (empCode: string) => Promise; create: (employee: EmployeeType) => Promise; update: (employee: EmployeeType) => Promise; destroy: (empCode: string) => Promise; - search: (pageSize: number, empName: string, page: number) => Promise; + search: (criteria:EmployeeCriteriaType, page?: number, pageSize?: number) => Promise; } export const EmployeeService = () => { const config = Config(); @@ -16,15 +22,8 @@ export const EmployeeService = () => { const endPoint = `${config.apiUrl}/employees`; - const select = async (page?: number, pageSize?: number): Promise => { - let url = endPoint; - if (pageSize && page) { - url = url + "?pageSize=" + pageSize + "&page=" + page; - } else if (pageSize) { - url = url + "?pageSize=" + pageSize; - } else if (page) { - url = url + "?page=" + page; - } + const select = async (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(endPoint, page, pageSize); return await apiUtils.fetchGet(url); }; @@ -42,9 +41,9 @@ export const EmployeeService = () => { return await apiUtils.fetchPut(url, mapToEmployeeResource(employee)); }; - const search = async (pageSize = 10, empName: string, page = 1): Promise => { - const url = `${endPoint}/search?pageSize=${pageSize}&empName=${encodeURIComponent(empName)}&page=${page}`; - return await apiUtils.fetchGet(url); + const search = (criteria: EmployeeCriteriaType, page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/search`, page, pageSize); + return apiUtils.fetchPost(url, mapToEmployeeCriteriaResource(criteria)); }; const destroy = async (empCode: string): Promise => { diff --git a/app/src/services/product.ts b/app/frontend/src/services/master/product.ts similarity index 54% rename from app/src/services/product.ts rename to app/frontend/src/services/master/product.ts index ad7a0451..5f66270d 100644 --- a/app/src/services/product.ts +++ b/app/frontend/src/services/master/product.ts @@ -1,15 +1,21 @@ -import Config from "./config"; -import Utils from "./utils"; -import {mapToProductResource, ProductType} from "../models"; +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import { + mapToProductCriteriaResource, + mapToProductResource, + ProductCriteriaType, + ProductFetchType, + ProductType +} from "../../models"; export interface ProductServiceType { - select: (page?: number, pageSize?: number) => Promise; - selectBoms: (page?: number, pageSize?: number) => Promise; + select: (page?: number, pageSize?: number) => Promise; + selectBoms: (page?: number, pageSize?: number) => Promise; find: (productCode: string) => Promise; create: (product: ProductType) => Promise; update: (product: ProductType) => Promise; destroy: (productCode: string) => Promise; - search: (pageSize: number, productName: string, page: number) => Promise; + search: (criteria:ProductCriteriaType, page?: number, pageSize?: number) => Promise; } export const ProductService = (): ProductServiceType => { @@ -17,27 +23,13 @@ export const ProductService = (): ProductServiceType => { const apiUtils = Utils.apiUtils; const endPoint = `${config.apiUrl}/products`; - const select = async (page?: number, pageSize?: number): Promise => { - let url = endPoint; - if (pageSize && page) { - url = url + "?pageSize=" + pageSize + "&page=" + page; - } else if (pageSize) { - url = url + "?pageSize=" + pageSize; - } else if (page) { - url = url + "?page=" + page; - } + const select = async (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(endPoint, page, pageSize); return await apiUtils.fetchGet(url); }; - const selectBoms = async (page?: number, pageSize?: number): Promise => { - let url = endPoint + "/boms"; - if (pageSize && page) { - url = url + "?pageSize=" + pageSize + "&page=" + page; - } else if (pageSize) { - url = url + "?pageSize=" + pageSize; - } else if (page) { - url = url + "?page=" + page; - } + const selectBoms = async (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/boms`, page, pageSize); return await apiUtils.fetchGet(url); }; @@ -55,16 +47,16 @@ export const ProductService = (): ProductServiceType => { return await apiUtils.fetchPut(url, mapToProductResource(product)); }; + const search = (criteria: ProductCriteriaType, page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/search`, page, pageSize); + return apiUtils.fetchPost(url, mapToProductCriteriaResource(criteria)); + }; + const destroy = async (productCode: string): Promise => { const url = `${endPoint}/${productCode}`; await apiUtils.fetchDelete(url); }; - const search = async (pageSize = 10, productName: string, page = 1): Promise => { - const url = `${endPoint}/search?pageSize=${pageSize}&productName=${encodeURIComponent(productName)}&page=${page}`; - return await apiUtils.fetchGet(url); - }; - return { select, selectBoms, diff --git a/app/src/services/product_category.ts b/app/frontend/src/services/master/product_category.ts similarity index 62% rename from app/src/services/product_category.ts rename to app/frontend/src/services/master/product_category.ts index 40d00891..af2fe8ae 100644 --- a/app/src/services/product_category.ts +++ b/app/frontend/src/services/master/product_category.ts @@ -1,14 +1,20 @@ -import Config from "./config"; -import Utils from "./utils"; -import {mapToProductCategoryResource, ProductCategoryType} from "../models"; +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import { + mapToProductCategoryCriteriaResource, + mapToProductCategoryResource, + ProductCategoryCriteriaType, + ProductCategoryFetchType, + ProductCategoryType +} from "../../models"; export interface ProductCategoryServiceType { - select: (page?: number, pageSize?: number) => Promise; + select: (page?: number, pageSize?: number) => Promise; find: (categoryCode: string) => Promise; create: (category: ProductCategoryType) => Promise; update: (category: ProductCategoryType) => Promise; destroy: (categoryCode: string) => Promise; - search: (pageSize: number, categoryName: string, page: number) => Promise; + search: (criteria:ProductCategoryCriteriaType, page?: number, pageSize?: number) => Promise; } export const ProductCategoryService = (): ProductCategoryServiceType => { @@ -16,15 +22,8 @@ export const ProductCategoryService = (): ProductCategoryServiceType => { const apiUtils = Utils.apiUtils; const endPoint = `${config.apiUrl}/product/categories`; - const select = async (page?: number, pageSize?: number): Promise => { - let url = endPoint; - if (pageSize && page) { - url = url + "?pageSize=" + pageSize + "&page=" + page; - } else if (pageSize) { - url = url + "?pageSize=" + pageSize; - } else if (page) { - url = url + "?page=" + page; - } + const select = async (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(endPoint, page, pageSize); return await apiUtils.fetchGet(url); }; @@ -42,16 +41,16 @@ export const ProductCategoryService = (): ProductCategoryServiceType => { return await apiUtils.fetchPut(url, mapToProductCategoryResource(category)); }; + const search = (criteria: ProductCategoryCriteriaType, page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/search`, page, pageSize); + return apiUtils.fetchPost(url, mapToProductCategoryCriteriaResource(criteria)); + }; + const destroy = async (categoryCode: string): Promise => { const url = `${endPoint}/${categoryCode}`; await apiUtils.fetchDelete(url); }; - const search = async (pageSize = 10, categoryName: string, page = 1): Promise => { - const url = `${endPoint}/search?pageSize=${pageSize}&categoryName=${encodeURIComponent(categoryName)}&page=${page}`; - return await apiUtils.fetchGet(url); - }; - return { select, find, diff --git a/app/frontend/src/services/system/audit.ts b/app/frontend/src/services/system/audit.ts new file mode 100644 index 00000000..f7ea10b9 --- /dev/null +++ b/app/frontend/src/services/system/audit.ts @@ -0,0 +1,41 @@ +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import {AuditFetchType, AuditType, mapToCriteriaResource, AuditCriteriaType} from "../../models/system/audit.ts"; + +export interface AuditServiceType { + select: (page?: number, pageSize?: number) => Promise; + find: (id: number) => Promise; + destroy: (id: number) => Promise; + search: (criteria: AuditCriteriaType, page?: number, pageSize?: number) => Promise; +} + +export const AuditService = (): AuditServiceType => { + const config = Config(); + const apiUtils = Utils.apiUtils; + const endPoint = `${config.apiUrl}/audits`; + + const select = (page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(endPoint, page, pageSize); + return apiUtils.fetchGet(url); + }; + + const find = (id: number): Promise => { + return apiUtils.fetchGet(`${endPoint}/${id}`); + }; + + const destroy = (id: number): Promise => { + return apiUtils.fetchDelete(`${endPoint}/${id}`); + }; + + const search = (criteria: AuditCriteriaType, page?: number, pageSize?: number): Promise => { + const url = Utils.buildUrlWithPaging(`${endPoint}/search`, page, pageSize); + return apiUtils.fetchPost(url, mapToCriteriaResource(criteria)); + }; + + return { + select, + find, + destroy, + search, + }; +}; \ No newline at end of file diff --git a/app/src/services/auth.ts b/app/frontend/src/services/system/auth.ts similarity index 90% rename from app/src/services/auth.ts rename to app/frontend/src/services/system/auth.ts index 4bd43f0c..aff349c0 100644 --- a/app/src/services/auth.ts +++ b/app/frontend/src/services/system/auth.ts @@ -1,5 +1,5 @@ -import Config from "./config"; -import {APIResponse} from "../models"; +import Config from "../config.ts"; +import {APIResponse} from "../../models"; const AuthService = () => { const config = Config(); diff --git a/app/frontend/src/services/system/download.ts b/app/frontend/src/services/system/download.ts new file mode 100644 index 00000000..1989409a --- /dev/null +++ b/app/frontend/src/services/system/download.ts @@ -0,0 +1,31 @@ +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import {DownloadConditionType, mapToDownloadResource} from "../../models/system/download.ts"; + +export interface DownloadServiceType { + download: (condition: DownloadConditionType) => Promise; + count: (condition: DownloadConditionType) => Promise; +} + +export const DownloadService = (): DownloadServiceType => { + const config = Config(); + const apiUtils = Utils.apiUtils; + const endPoint = `${config.apiUrl}/downloads`; + + const download = (condition: DownloadConditionType): Promise => { + const url = `${endPoint}/download`; + const resource = mapToDownloadResource(condition); + return apiUtils.fetchPostDownload(url, resource); + }; + + const count = (condition: DownloadConditionType): Promise => { + const url = `${endPoint}/count`; + const resource = mapToDownloadResource(condition); + return apiUtils.fetchPost(url, resource); + }; + + return { + download, + count, + }; +}; \ No newline at end of file diff --git a/app/src/services/user.ts b/app/frontend/src/services/system/user.ts similarity index 61% rename from app/src/services/user.ts rename to app/frontend/src/services/system/user.ts index f3e947df..e45c0696 100644 --- a/app/src/services/user.ts +++ b/app/frontend/src/services/system/user.ts @@ -1,14 +1,14 @@ -import Config from "./config"; -import Utils from "./utils"; -import {mapToUserAccountResource, UserAccountType} from "../models"; +import Config from "../config.ts"; +import Utils from "../utils.ts"; +import {mapToUserAccountResource, UserAccountType, UserFetchType} from "../../models"; export interface UserServiceType { - select: (page?: number, pageSize?: number) => Promise; - find: (userId: String) => Promise; - create: (user: UserAccountType) => Promise; - update: (user: UserAccountType) => Promise; - destroy: (userId: String) => Promise; - search: (pageSize: number, code: string, page: number) => Promise; + select: (page?: number, pageSize?: number) => Promise; + find: (userId: string) => Promise; + create: (user: UserAccountType) => Promise; + update: (user: UserAccountType) => Promise; + destroy: (userId: string) => Promise; + search: (code: string, page: number, pageSize: number) => Promise; } export const UserService = () => { const config = Config(); @@ -28,7 +28,7 @@ export const UserService = () => { return await apiUtils.fetchGet(url); }; - const find = async (userId: String) => { + const find = async (userId: string) => { const url = `${endPoint}/${userId}`; return await apiUtils.fetchGet(url); }; @@ -42,13 +42,13 @@ export const UserService = () => { return await apiUtils.fetchPut(url, mapToUserAccountResource(user)); }; - const search = async (pageSize = 10, code: string, page = 1): Promise => { - let url = `${endPoint}/search?pageSize=${pageSize}&code=${code}&page=${page}`; + const search = async (code: string, page = 1, pageSize = 10): Promise => { + const url = `${endPoint}/search?pageSize=${pageSize}&code=${code}&page=${page}`; return await apiUtils.fetchGet(url); }; - const destroy = async (userId: String) => { + const destroy = async (userId: string) => { const url = `${endPoint}/${userId}`; return await apiUtils.fetchDelete(url); }; diff --git a/app/src/services/utils.ts b/app/frontend/src/services/utils.ts similarity index 76% rename from app/src/services/utils.ts rename to app/frontend/src/services/utils.ts index 9181d505..1577e677 100644 --- a/app/src/services/utils.ts +++ b/app/frontend/src/services/utils.ts @@ -1,4 +1,4 @@ -import Config from "./config"; +import Config from "./config.ts"; const Utils = (() => { const apiUtils = (() => { @@ -115,17 +115,49 @@ const Utils = (() => { } }; + const fetchPostDownload = async (url: string, body: any): Promise => { + const config = Config(); + try { + const res = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", + "Authorization": config.authHeader + }, + body: JSON.stringify(body) + }); + if (!res.ok) { + return res.blob().then(e => { + throw e; + }); + } + return await res.blob(); + } catch (err) { + console.log(err); + throw err; + } + }; + return { fetchGet, fetchPost, fetchPut, fetchDelete, - fetchGetDownload + fetchGetDownload, + fetchPostDownload }; })(); + const buildUrlWithPaging = (baseUrl: string, page?: number, pageSize?: number): string => { + const params = new URLSearchParams(); + if (pageSize) params.append("pageSize", pageSize.toString()); + if (page) params.append("page", page.toString()); + return params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl; + }; + return { apiUtils, + buildUrlWithPaging }; })(); diff --git a/app/frontend/src/views/Common.tsx b/app/frontend/src/views/Common.tsx new file mode 100644 index 00000000..3b0bee4d --- /dev/null +++ b/app/frontend/src/views/Common.tsx @@ -0,0 +1,168 @@ +import React from "react"; +import {DepartmentCriteriaType} from "../models"; + +export const SingleViewHeaderItem: React.FC<{ title: string, subtitle: string }> = ({title, subtitle}) => ( +
+

{title}

+

{subtitle}

+
+); + +export const SingleViewHeaderActions: React.FC<{ + isEditing: boolean, + handleCreateOrUpdateUser: () => void, + handleCloseModal: () => void +}> = ({isEditing, handleCreateOrUpdateUser, handleCloseModal}) => ( +
+
+ + +
+
+); + +interface FormItemProps { + label: string; + children: React.ReactNode; +} + +export const FormItem = ({label, children}: FormItemProps) => ( +
+ + {children} +
+); + +interface FormSelectProps { + id: string; + label: string; + className?: string; + value?: T; + options: { [key: string]: T }; + onChange: (value: T) => void; + disabled?: boolean; +} + +export const FormSelect = ({ + id, + label, + className, + value, + options, + onChange, + disabled, // 受け取り + }: FormSelectProps) => ( + + + +); + +interface FormInputProps { + label: string; + id: string; + type: string; + className: string; + placeholder?: string; + value: string | number | undefined; + onChange: (e: React.ChangeEvent) => void; + disabled?: boolean; +} + +export const FormInput: React.FC = ({ + label, + id, + type, + className, + placeholder, + value, + onChange, + disabled, + }) => { + return ( + + + + ); +}; + +interface FormTextareaProps { + label: string; + id: string; + className?: string; + placeholder?: string; + value: string; + onChange: (event: React.ChangeEvent) => void; + disabled?: boolean; +} + +export const FormTextarea: React.FC = ({ + label, + id, + className, + placeholder, + value, + onChange, + disabled, + }) => { + return ( + +