@k2works/claude-code-booster 3.6.1 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +42 -42
- package/bin/claude-code-booster +90 -90
- package/lib/assets/.claude/README.md +258 -239
- package/lib/assets/.claude/agent-memory/xp-programmer/MEMORY.md +6 -0
- package/lib/assets/.claude/agent-memory/xp-programmer/project_cargo_tracker.md +11 -0
- package/lib/assets/.claude/agent-memory/xp-programmer/project_ddd_patterns.md +27 -0
- package/lib/assets/.claude/agent-memory/xp-programmer/project_us07_route_assignment.md +19 -0
- package/lib/assets/.claude/scripts/generate-inception-deck.mjs +911 -911
- package/lib/assets/.claude/settings.json +11 -11
- package/lib/assets/.claude/skills/ai-agent-guidelines/SKILL.md +111 -111
- package/lib/assets/.claude/skills/analyzing-architecture/SKILL.md +83 -83
- package/lib/assets/.claude/skills/analyzing-business/SKILL.md +95 -95
- package/lib/assets/.claude/skills/analyzing-data-model/SKILL.md +77 -77
- package/lib/assets/.claude/skills/analyzing-domain-model/SKILL.md +117 -117
- package/lib/assets/.claude/skills/analyzing-inception-deck/SKILL.md +84 -84
- package/lib/assets/.claude/skills/analyzing-non-functional/SKILL.md +95 -95
- package/lib/assets/.claude/skills/analyzing-operation/SKILL.md +95 -95
- package/lib/assets/.claude/skills/analyzing-requirements/SKILL.md +91 -91
- package/lib/assets/.claude/skills/analyzing-tech-stack/SKILL.md +101 -101
- package/lib/assets/.claude/skills/analyzing-test-strategy/SKILL.md +89 -89
- package/lib/assets/.claude/skills/analyzing-ui-design/SKILL.md +80 -80
- package/lib/assets/.claude/skills/analyzing-usecases/SKILL.md +72 -72
- package/lib/assets/.claude/skills/creating-adr/SKILL.md +113 -113
- package/lib/assets/.claude/skills/developing-backend/SKILL.md +100 -100
- package/lib/assets/.claude/skills/developing-frontend/SKILL.md +93 -93
- package/lib/assets/.claude/skills/developing-release/SKILL.md +120 -120
- package/lib/assets/.claude/skills/generating-bmc/SKILL.md +97 -0
- package/lib/assets/.claude/skills/generating-slides/SKILL.md +94 -94
- package/lib/assets/.claude/skills/git-commit/SKILL.md +81 -81
- package/lib/assets/.claude/skills/killing-processes/SKILL.md +44 -44
- package/lib/assets/.claude/skills/operating-backup/SKILL.md +59 -59
- package/lib/assets/.claude/skills/operating-cicd/SKILL.md +54 -54
- package/lib/assets/.claude/skills/operating-deploy/SKILL.md +67 -67
- package/lib/assets/.claude/skills/operating-docs/SKILL.md +219 -219
- package/lib/assets/.claude/skills/operating-provision/SKILL.md +77 -77
- package/lib/assets/.claude/skills/operating-setup/SKILL.md +63 -63
- package/lib/assets/.claude/skills/orchestrating-analysis/SKILL.md +104 -104
- package/lib/assets/.claude/skills/orchestrating-development/SKILL.md +162 -162
- package/lib/assets/.claude/skills/orchestrating-operation/SKILL.md +158 -158
- package/lib/assets/.claude/skills/orchestrating-project/SKILL.md +144 -144
- package/lib/assets/.claude/skills/planning-releases/SKILL.md +119 -119
- package/lib/assets/.claude/skills/syncing-github-project/SKILL.md +151 -151
- package/lib/assets/.claude/skills/tracking-progress/SKILL.md +91 -91
- package/lib/assets/.claude/skills/validating-iteration-plan/SKILL.md +215 -215
- package/lib/assets/.devcontainer/devcontainer.json +34 -34
- package/lib/assets/.env.example +17 -17
- package/lib/assets/.gitattributes +4 -4
- package/lib/assets/.github/workflows/docker-publish.yml +77 -77
- package/lib/assets/.github/workflows/mkdocs.yml +39 -39
- package/lib/assets/AGENTS.md +94 -94
- package/lib/assets/CLAUDE.md +1 -0
- package/lib/assets/README.md +254 -254
- package/lib/assets/docker-compose.yml +33 -33
- package/lib/assets/docs/adr/index.md +10 -10
- package/lib/assets/docs/article/functional-desgin-ppp/all/01-immutability-and-data-transformation.md +475 -475
- package/lib/assets/docs/article/functional-desgin-ppp/all/02-function-composition.md +519 -519
- package/lib/assets/docs/article/functional-desgin-ppp/all/03-polymorphism.md +537 -537
- package/lib/assets/docs/article/functional-desgin-ppp/all/04-data-validation.md +300 -300
- package/lib/assets/docs/article/functional-desgin-ppp/all/05-property-based-testing.md +320 -320
- package/lib/assets/docs/article/functional-desgin-ppp/all/06-tdd-and-functional.md +498 -498
- package/lib/assets/docs/article/functional-desgin-ppp/all/07-composite-pattern.md +298 -298
- package/lib/assets/docs/article/functional-desgin-ppp/all/08-decorator-pattern.md +291 -291
- package/lib/assets/docs/article/functional-desgin-ppp/all/09-adapter-pattern.md +336 -336
- package/lib/assets/docs/article/functional-desgin-ppp/all/10-strategy-pattern.md +303 -303
- package/lib/assets/docs/article/functional-desgin-ppp/all/11-command-pattern.md +286 -286
- package/lib/assets/docs/article/functional-desgin-ppp/all/12-visitor-pattern.md +322 -322
- package/lib/assets/docs/article/functional-desgin-ppp/all/13-abstract-factory-pattern.md +319 -319
- package/lib/assets/docs/article/functional-desgin-ppp/all/14-abstract-server-pattern.md +365 -365
- package/lib/assets/docs/article/functional-desgin-ppp/all/15-gossiping-bus-drivers.md +156 -156
- package/lib/assets/docs/article/functional-desgin-ppp/all/16-payroll-system.md +178 -178
- package/lib/assets/docs/article/functional-desgin-ppp/all/17-video-rental-system.md +312 -312
- package/lib/assets/docs/article/functional-desgin-ppp/all/18-concurrency-system.md +287 -287
- package/lib/assets/docs/article/functional-desgin-ppp/all/19-wa-tor-simulation.md +286 -286
- package/lib/assets/docs/article/functional-desgin-ppp/all/20-pattern-interactions.md +274 -274
- package/lib/assets/docs/article/functional-desgin-ppp/all/21-best-practices.md +294 -294
- package/lib/assets/docs/article/functional-desgin-ppp/all/22-oo-to-fp-migration.md +337 -337
- package/lib/assets/docs/article/functional-desgin-ppp/all/index.md +388 -388
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/01-immutability-and-data-transformation.md +273 -273
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/02-function-composition.md +380 -380
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/03-polymorphism.md +384 -384
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/04-clojure-spec.md +350 -350
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/05-property-based-testing.md +352 -352
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/06-tdd-in-functional.md +383 -383
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/07-composite-pattern.md +529 -529
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/08-decorator-pattern.md +395 -395
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/09-adapter-pattern.md +399 -399
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/10-strategy-pattern.md +485 -485
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/11-command-pattern.md +566 -566
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/12-visitor-pattern.md +567 -567
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/13-abstract-factory-pattern.md +475 -475
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/14-abstract-server-pattern.md +462 -462
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/15-gossiping-bus-drivers.md +325 -325
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/16-payroll-system.md +401 -401
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/17-video-rental-system.md +450 -450
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/18-concurrency-system.md +475 -475
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/19-wator-simulation.md +739 -739
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/20-pattern-interactions.md +567 -567
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/21-best-practices.md +518 -518
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/22-oo-to-fp-migration.md +532 -532
- package/lib/assets/docs/article/functional-desgin-ppp/clojure/index.md +241 -241
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/01-immutability-and-data-transformation.md +383 -383
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/02-function-composition.md +374 -374
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/03-polymorphism.md +375 -375
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/04-data-validation.md +195 -195
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/05-property-based-testing.md +268 -268
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/06-tdd-and-fp.md +294 -294
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/07-effects-and-pure-functions.md +164 -164
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/08-error-handling-strategies.md +168 -168
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/09-io-and-external-systems.md +254 -254
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/10-concurrency-patterns.md +269 -269
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/11-command-pattern.md +148 -148
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/12-visitor-pattern.md +176 -176
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/13-abstract-factory-pattern.md +604 -604
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/14-abstract-server-pattern.md +729 -729
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/15-gossiping-bus-drivers.md +291 -291
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/16-payroll-system.md +420 -420
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/17-video-rental-system.md +319 -319
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/18-concurrency-system.md +466 -466
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/19-wator-simulation.md +523 -523
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/20-pattern-interactions.md +287 -287
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/21-best-practices.md +340 -340
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/22-oo-to-fp-migration.md +395 -395
- package/lib/assets/docs/article/functional-desgin-ppp/elixir/index.md +248 -248
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/01-immutability-and-data-transformation.md +384 -384
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/02-function-composition.md +452 -452
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/03-polymorphism.md +495 -495
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/04-data-validation.md +416 -416
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/05-property-based-testing.md +382 -382
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/06-tdd-functional.md +687 -687
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/07-composite-pattern.md +442 -442
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/08-decorator-pattern.md +479 -479
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/09-adapter-pattern.md +479 -479
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/10-strategy-pattern.md +427 -427
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/11-command-pattern.md +428 -428
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/12-visitor-pattern.md +339 -339
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/13-abstract-factory-pattern.md +309 -309
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/14-abstract-server-pattern.md +596 -596
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/15-gossiping-bus-drivers.md +355 -355
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/16-payroll-system.md +350 -350
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/17-video-rental-system.md +414 -414
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/18-concurrency-system.md +367 -367
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/19-wator-simulation.md +403 -403
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/20-pattern-interactions.md +291 -291
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/21-best-practices.md +324 -324
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/22-oo-to-fp-migration.md +332 -332
- package/lib/assets/docs/article/functional-desgin-ppp/fsharp/index.md +274 -274
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/01-immutability-and-data-transformation.md +298 -298
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/02-function-composition.md +304 -304
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/03-polymorphism.md +362 -362
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/04-data-validation.md +257 -257
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/05-property-based-testing.md +254 -254
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/06-tdd-functional.md +283 -283
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/07-composite-pattern.md +395 -395
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/08-decorator-pattern.md +319 -319
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/09-adapter-pattern.md +382 -382
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/10-strategy-pattern.md +287 -287
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/11-command-pattern.md +303 -303
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/12-visitor-pattern.md +326 -326
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/13-abstract-factory-pattern.md +332 -332
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/14-abstract-server-pattern.md +379 -379
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/15-gossiping-bus-drivers.md +177 -177
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/16-payroll-system.md +219 -219
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/17-video-rental-system.md +244 -244
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/18-concurrency-system.md +363 -363
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/19-wator-simulation.md +438 -438
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/20-pattern-interactions.md +325 -325
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/21-best-practices.md +403 -403
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/22-oo-to-fp-migration.md +469 -469
- package/lib/assets/docs/article/functional-desgin-ppp/haskell/index.md +174 -174
- package/lib/assets/docs/article/functional-desgin-ppp/index.md +90 -90
- package/lib/assets/docs/article/functional-desgin-ppp/rust/01-immutability-and-data-transformation.md +450 -450
- package/lib/assets/docs/article/functional-desgin-ppp/rust/02-function-composition.md +463 -463
- package/lib/assets/docs/article/functional-desgin-ppp/rust/03-polymorphism.md +425 -425
- package/lib/assets/docs/article/functional-desgin-ppp/rust/04-data-validation.md +273 -273
- package/lib/assets/docs/article/functional-desgin-ppp/rust/05-property-based-testing.md +247 -247
- package/lib/assets/docs/article/functional-desgin-ppp/rust/06-tdd-and-functional.md +841 -841
- package/lib/assets/docs/article/functional-desgin-ppp/rust/07-composite-pattern.md +384 -384
- package/lib/assets/docs/article/functional-desgin-ppp/rust/08-decorator-pattern.md +383 -383
- package/lib/assets/docs/article/functional-desgin-ppp/rust/09-adapter-pattern.md +339 -339
- package/lib/assets/docs/article/functional-desgin-ppp/rust/10-strategy-pattern.md +331 -331
- package/lib/assets/docs/article/functional-desgin-ppp/rust/11-command-pattern.md +356 -356
- package/lib/assets/docs/article/functional-desgin-ppp/rust/12-visitor-pattern.md +379 -379
- package/lib/assets/docs/article/functional-desgin-ppp/rust/13-abstract-factory-pattern.md +361 -361
- package/lib/assets/docs/article/functional-desgin-ppp/rust/14-abstract-server-pattern.md +392 -392
- package/lib/assets/docs/article/functional-desgin-ppp/rust/15-gossiping-bus-drivers.md +300 -300
- package/lib/assets/docs/article/functional-desgin-ppp/rust/16-payroll-system.md +297 -297
- package/lib/assets/docs/article/functional-desgin-ppp/rust/17-video-rental-system.md +304 -304
- package/lib/assets/docs/article/functional-desgin-ppp/rust/18-concurrency-system.md +315 -315
- package/lib/assets/docs/article/functional-desgin-ppp/rust/19-wator-simulation.md +311 -311
- package/lib/assets/docs/article/functional-desgin-ppp/rust/20-pattern-interactions.md +304 -304
- package/lib/assets/docs/article/functional-desgin-ppp/rust/21-best-practices.md +336 -336
- package/lib/assets/docs/article/functional-desgin-ppp/rust/22-oo-to-fp-migration.md +349 -349
- package/lib/assets/docs/article/functional-desgin-ppp/rust/index.md +243 -243
- package/lib/assets/docs/article/functional-desgin-ppp/scala/01-immutability-and-data-transformation.md +328 -328
- package/lib/assets/docs/article/functional-desgin-ppp/scala/02-function-composition.md +348 -348
- package/lib/assets/docs/article/functional-desgin-ppp/scala/03-polymorphism.md +357 -357
- package/lib/assets/docs/article/functional-desgin-ppp/scala/04-data-validation.md +364 -364
- package/lib/assets/docs/article/functional-desgin-ppp/scala/05-property-based-testing.md +515 -515
- package/lib/assets/docs/article/functional-desgin-ppp/scala/06-tdd-functional.md +557 -557
- package/lib/assets/docs/article/functional-desgin-ppp/scala/07-composite-pattern.md +363 -363
- package/lib/assets/docs/article/functional-desgin-ppp/scala/08-decorator-pattern.md +327 -327
- package/lib/assets/docs/article/functional-desgin-ppp/scala/09-adapter-pattern.md +517 -517
- package/lib/assets/docs/article/functional-desgin-ppp/scala/10-strategy-pattern.md +441 -441
- package/lib/assets/docs/article/functional-desgin-ppp/scala/11-command-pattern.md +407 -407
- package/lib/assets/docs/article/functional-desgin-ppp/scala/12-visitor-pattern.md +379 -379
- package/lib/assets/docs/article/functional-desgin-ppp/scala/13-abstract-factory-pattern.md +398 -398
- package/lib/assets/docs/article/functional-desgin-ppp/scala/14-abstract-server-pattern.md +476 -476
- package/lib/assets/docs/article/functional-desgin-ppp/scala/15-gossiping-bus-drivers.md +391 -391
- package/lib/assets/docs/article/functional-desgin-ppp/scala/16-payroll-system.md +342 -342
- package/lib/assets/docs/article/functional-desgin-ppp/scala/17-video-rental-system.md +324 -324
- package/lib/assets/docs/article/functional-desgin-ppp/scala/18-concurrency-system.md +730 -730
- package/lib/assets/docs/article/functional-desgin-ppp/scala/19-wator-simulation.md +624 -624
- package/lib/assets/docs/article/functional-desgin-ppp/scala/20-pattern-interactions.md +512 -512
- package/lib/assets/docs/article/functional-desgin-ppp/scala/21-best-practices.md +433 -433
- package/lib/assets/docs/article/functional-desgin-ppp/scala/22-oo-to-fp-migration.md +688 -688
- package/lib/assets/docs/article/functional-desgin-ppp/scala/index.md +243 -243
- package/lib/assets/docs/article/getting-start-tdd/clojure/01-todo-list-and-first-test.md +166 -166
- package/lib/assets/docs/article/getting-start-tdd/clojure/02-fake-it-and-triangulation.md +162 -162
- package/lib/assets/docs/article/getting-start-tdd/clojure/03-obvious-implementation-and-refactoring.md +135 -135
- package/lib/assets/docs/article/getting-start-tdd/clojure/04-version-control-and-conventional-commits.md +88 -88
- package/lib/assets/docs/article/getting-start-tdd/clojure/05-package-management-and-static-analysis.md +299 -299
- package/lib/assets/docs/article/getting-start-tdd/clojure/06-task-runner-and-ci-cd.md +241 -241
- package/lib/assets/docs/article/getting-start-tdd/clojure/07-protocols-and-records.md +131 -131
- package/lib/assets/docs/article/getting-start-tdd/clojure/08-multimethods-and-design-patterns.md +130 -130
- package/lib/assets/docs/article/getting-start-tdd/clojure/09-namespaces-and-module-design.md +127 -127
- package/lib/assets/docs/article/getting-start-tdd/clojure/10-higher-order-functions-and-composition.md +114 -114
- package/lib/assets/docs/article/getting-start-tdd/clojure/11-persistent-data-and-pipeline.md +138 -138
- package/lib/assets/docs/article/getting-start-tdd/clojure/12-error-handling-and-spec.md +161 -161
- package/lib/assets/docs/article/getting-start-tdd/clojure/index.md +65 -65
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter01.md +232 -232
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter02.md +244 -244
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter03.md +202 -202
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter04.md +92 -92
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter05.md +256 -256
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter06.md +195 -195
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter07.md +214 -214
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter08.md +249 -249
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter09.md +174 -174
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter10.md +166 -166
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter11.md +192 -192
- package/lib/assets/docs/article/getting-start-tdd/csharp/chapter12.md +211 -211
- package/lib/assets/docs/article/getting-start-tdd/csharp/index.md +83 -83
- package/lib/assets/docs/article/getting-start-tdd/elixir/01-todo-list-and-first-test.md +87 -87
- package/lib/assets/docs/article/getting-start-tdd/elixir/02-fake-it-and-triangulation.md +95 -95
- package/lib/assets/docs/article/getting-start-tdd/elixir/03-obvious-implementation-and-refactoring.md +109 -109
- package/lib/assets/docs/article/getting-start-tdd/elixir/04-version-control-and-conventional-commits.md +96 -96
- package/lib/assets/docs/article/getting-start-tdd/elixir/05-package-management-and-static-analysis.md +88 -88
- package/lib/assets/docs/article/getting-start-tdd/elixir/06-task-runner-and-ci-cd.md +71 -71
- package/lib/assets/docs/article/getting-start-tdd/elixir/07-structs-and-protocols.md +110 -110
- package/lib/assets/docs/article/getting-start-tdd/elixir/08-pattern-matching-and-guards.md +108 -108
- package/lib/assets/docs/article/getting-start-tdd/elixir/09-module-design-and-behaviours.md +104 -104
- package/lib/assets/docs/article/getting-start-tdd/elixir/10-higher-order-functions-and-pipeline.md +178 -178
- package/lib/assets/docs/article/getting-start-tdd/elixir/11-stream-and-lazy-evaluation.md +142 -142
- package/lib/assets/docs/article/getting-start-tdd/elixir/12-error-handling-and-with.md +145 -145
- package/lib/assets/docs/article/getting-start-tdd/elixir/index.md +35 -35
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter01.md +202 -202
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter02.md +246 -246
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter03.md +218 -218
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter04.md +179 -179
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter05.md +267 -267
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter06.md +190 -190
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter07.md +161 -161
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter08.md +175 -175
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter09.md +222 -222
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter10.md +189 -189
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter11.md +212 -212
- package/lib/assets/docs/article/getting-start-tdd/fsharp/chapter12.md +215 -215
- package/lib/assets/docs/article/getting-start-tdd/fsharp/index.md +71 -71
- package/lib/assets/docs/article/getting-start-tdd/go/01-todo-list-and-first-test.md +213 -213
- package/lib/assets/docs/article/getting-start-tdd/go/02-fake-it-and-triangulation.md +302 -302
- package/lib/assets/docs/article/getting-start-tdd/go/03-obvious-implementation-and-refactoring.md +339 -339
- package/lib/assets/docs/article/getting-start-tdd/go/04-version-control-and-conventional-commits.md +112 -112
- package/lib/assets/docs/article/getting-start-tdd/go/05-package-management-and-static-analysis.md +272 -272
- package/lib/assets/docs/article/getting-start-tdd/go/06-task-runner-and-ci-cd.md +233 -233
- package/lib/assets/docs/article/getting-start-tdd/go/07-encapsulation-and-polymorphism.md +394 -394
- package/lib/assets/docs/article/getting-start-tdd/go/08-design-patterns.md +422 -422
- package/lib/assets/docs/article/getting-start-tdd/go/09-solid-principles-and-module-design.md +400 -400
- package/lib/assets/docs/article/getting-start-tdd/go/10-higher-order-functions-and-composition.md +226 -226
- package/lib/assets/docs/article/getting-start-tdd/go/11-immutable-data-and-pipeline.md +296 -296
- package/lib/assets/docs/article/getting-start-tdd/go/12-error-handling-and-type-safety.md +411 -411
- package/lib/assets/docs/article/getting-start-tdd/go/index.md +83 -83
- package/lib/assets/docs/article/getting-start-tdd/haskell/01-todo-list-and-first-test.md +279 -279
- package/lib/assets/docs/article/getting-start-tdd/haskell/02-fake-it-and-triangulation.md +337 -337
- package/lib/assets/docs/article/getting-start-tdd/haskell/03-obvious-implementation-and-refactoring.md +257 -257
- package/lib/assets/docs/article/getting-start-tdd/haskell/04-version-control-and-conventional-commits.md +182 -182
- package/lib/assets/docs/article/getting-start-tdd/haskell/05-package-management-and-static-analysis.md +313 -313
- package/lib/assets/docs/article/getting-start-tdd/haskell/06-task-runner-and-ci-cd.md +309 -309
- package/lib/assets/docs/article/getting-start-tdd/haskell/07-algebraic-data-types-and-type-classes.md +412 -412
- package/lib/assets/docs/article/getting-start-tdd/haskell/08-pattern-matching-and-guards.md +390 -390
- package/lib/assets/docs/article/getting-start-tdd/haskell/09-module-design-and-smart-constructors.md +461 -461
- package/lib/assets/docs/article/getting-start-tdd/haskell/10-higher-order-functions-and-currying.md +434 -434
- package/lib/assets/docs/article/getting-start-tdd/haskell/11-function-composition-and-point-free.md +392 -392
- package/lib/assets/docs/article/getting-start-tdd/haskell/12-monad-and-error-handling.md +631 -631
- package/lib/assets/docs/article/getting-start-tdd/haskell/index.md +49 -49
- package/lib/assets/docs/article/getting-start-tdd/index.md +93 -93
- package/lib/assets/docs/article/getting-start-tdd/integration/01-language-overview.md +375 -375
- package/lib/assets/docs/article/getting-start-tdd/integration/02-test-framework-comparison.md +349 -349
- package/lib/assets/docs/article/getting-start-tdd/integration/03-tdd-pattern-comparison.md +445 -445
- package/lib/assets/docs/article/getting-start-tdd/integration/04-type-system-comparison.md +409 -409
- package/lib/assets/docs/article/getting-start-tdd/integration/05-dev-environment-comparison.md +330 -330
- package/lib/assets/docs/article/getting-start-tdd/integration/06-learning-roadmap.md +290 -290
- package/lib/assets/docs/article/getting-start-tdd/integration/index.md +69 -69
- package/lib/assets/docs/article/getting-start-tdd/java/01-todo-list-and-first-test.md +234 -234
- package/lib/assets/docs/article/getting-start-tdd/java/02-fake-it-and-triangulation.md +261 -261
- package/lib/assets/docs/article/getting-start-tdd/java/03-obvious-implementation-and-refactoring.md +185 -185
- package/lib/assets/docs/article/getting-start-tdd/java/04-version-control-and-conventional-commits.md +115 -115
- package/lib/assets/docs/article/getting-start-tdd/java/05-package-management-and-static-analysis.md +382 -382
- package/lib/assets/docs/article/getting-start-tdd/java/06-task-runner-and-ci-cd.md +272 -272
- package/lib/assets/docs/article/getting-start-tdd/java/07-encapsulation-and-polymorphism.md +626 -626
- package/lib/assets/docs/article/getting-start-tdd/java/08-design-patterns.md +393 -393
- package/lib/assets/docs/article/getting-start-tdd/java/09-solid-principles-and-module-design.md +310 -310
- package/lib/assets/docs/article/getting-start-tdd/java/10-higher-order-functions-and-composition.md +188 -188
- package/lib/assets/docs/article/getting-start-tdd/java/11-immutable-data-and-pipeline.md +167 -167
- package/lib/assets/docs/article/getting-start-tdd/java/12-error-handling-and-type-safety.md +205 -205
- package/lib/assets/docs/article/getting-start-tdd/java/index.md +61 -61
- package/lib/assets/docs/article/getting-start-tdd/node/01-todo-list-and-first-test.md +244 -244
- package/lib/assets/docs/article/getting-start-tdd/node/02-fake-it-and-triangulation.md +262 -262
- package/lib/assets/docs/article/getting-start-tdd/node/03-obvious-implementation-and-refactoring.md +169 -169
- package/lib/assets/docs/article/getting-start-tdd/node/04-version-control-and-conventional-commits.md +112 -112
- package/lib/assets/docs/article/getting-start-tdd/node/05-package-management-and-static-analysis.md +314 -314
- package/lib/assets/docs/article/getting-start-tdd/node/06-task-runner-and-ci-cd.md +235 -235
- package/lib/assets/docs/article/getting-start-tdd/node/07-encapsulation-and-polymorphism.md +327 -327
- package/lib/assets/docs/article/getting-start-tdd/node/08-design-patterns.md +322 -322
- package/lib/assets/docs/article/getting-start-tdd/node/09-solid-principles-and-module-design.md +285 -285
- package/lib/assets/docs/article/getting-start-tdd/node/10-higher-order-functions-and-composition.md +199 -199
- package/lib/assets/docs/article/getting-start-tdd/node/11-immutable-data-and-pipeline.md +207 -207
- package/lib/assets/docs/article/getting-start-tdd/node/12-error-handling-and-type-safety.md +295 -295
- package/lib/assets/docs/article/getting-start-tdd/node/index.md +56 -56
- package/lib/assets/docs/article/getting-start-tdd/php/01-todo-list-and-first-test.md +259 -259
- package/lib/assets/docs/article/getting-start-tdd/php/02-fake-it-and-triangulation.md +200 -200
- package/lib/assets/docs/article/getting-start-tdd/php/03-obvious-implementation-and-refactoring.md +248 -248
- package/lib/assets/docs/article/getting-start-tdd/php/04-version-control-and-conventional-commits.md +141 -141
- package/lib/assets/docs/article/getting-start-tdd/php/05-package-management-and-static-analysis.md +410 -410
- package/lib/assets/docs/article/getting-start-tdd/php/06-task-runner-and-ci-cd.md +321 -321
- package/lib/assets/docs/article/getting-start-tdd/php/07-encapsulation-and-polymorphism.md +372 -372
- package/lib/assets/docs/article/getting-start-tdd/php/08-design-patterns.md +453 -453
- package/lib/assets/docs/article/getting-start-tdd/php/09-solid-principles-and-module-design.md +460 -460
- package/lib/assets/docs/article/getting-start-tdd/php/10-higher-order-functions-and-composition.md +182 -182
- package/lib/assets/docs/article/getting-start-tdd/php/11-immutable-data-and-pipeline.md +266 -266
- package/lib/assets/docs/article/getting-start-tdd/php/12-error-handling-and-type-safety.md +308 -308
- package/lib/assets/docs/article/getting-start-tdd/php/index.md +84 -84
- package/lib/assets/docs/article/getting-start-tdd/python/01-todo-list-and-first-test.md +201 -201
- package/lib/assets/docs/article/getting-start-tdd/python/02-fake-it-and-triangulation.md +247 -247
- package/lib/assets/docs/article/getting-start-tdd/python/03-obvious-implementation-and-refactoring.md +199 -199
- package/lib/assets/docs/article/getting-start-tdd/python/04-version-control-and-conventional-commits.md +87 -87
- package/lib/assets/docs/article/getting-start-tdd/python/05-package-management-and-static-analysis.md +274 -274
- package/lib/assets/docs/article/getting-start-tdd/python/06-task-runner-and-ci-cd.md +190 -190
- package/lib/assets/docs/article/getting-start-tdd/python/07-encapsulation-and-polymorphism.md +208 -208
- package/lib/assets/docs/article/getting-start-tdd/python/08-design-patterns.md +172 -172
- package/lib/assets/docs/article/getting-start-tdd/python/09-solid-principles-and-module-design.md +130 -130
- package/lib/assets/docs/article/getting-start-tdd/python/10-higher-order-functions-and-composition.md +122 -122
- package/lib/assets/docs/article/getting-start-tdd/python/11-immutable-data-and-pipeline.md +116 -116
- package/lib/assets/docs/article/getting-start-tdd/python/12-error-handling-and-type-safety.md +126 -126
- package/lib/assets/docs/article/getting-start-tdd/python/index.md +55 -55
- package/lib/assets/docs/article/getting-start-tdd/ruby/01-todo-list-and-first-test.md +231 -231
- package/lib/assets/docs/article/getting-start-tdd/ruby/02-fake-it-and-triangulation.md +238 -238
- package/lib/assets/docs/article/getting-start-tdd/ruby/03-obvious-implementation-and-refactoring.md +228 -228
- package/lib/assets/docs/article/getting-start-tdd/ruby/04-version-control-and-conventional-commits.md +112 -112
- package/lib/assets/docs/article/getting-start-tdd/ruby/05-package-management-and-static-analysis.md +287 -287
- package/lib/assets/docs/article/getting-start-tdd/ruby/06-task-runner-and-ci-cd.md +248 -248
- package/lib/assets/docs/article/getting-start-tdd/ruby/07-encapsulation-and-polymorphism.md +279 -279
- package/lib/assets/docs/article/getting-start-tdd/ruby/08-design-patterns.md +329 -329
- package/lib/assets/docs/article/getting-start-tdd/ruby/09-solid-principles-and-module-design.md +196 -196
- package/lib/assets/docs/article/getting-start-tdd/ruby/10-higher-order-functions-and-composition.md +175 -175
- package/lib/assets/docs/article/getting-start-tdd/ruby/11-immutable-data-and-pipeline.md +237 -237
- package/lib/assets/docs/article/getting-start-tdd/ruby/12-error-handling-and-type-safety.md +398 -398
- package/lib/assets/docs/article/getting-start-tdd/ruby/index.md +83 -83
- package/lib/assets/docs/article/getting-start-tdd/rust/01-todo-list-and-first-test.md +211 -211
- package/lib/assets/docs/article/getting-start-tdd/rust/02-fake-it-and-triangulation.md +264 -264
- package/lib/assets/docs/article/getting-start-tdd/rust/03-obvious-implementation-and-refactoring.md +233 -233
- package/lib/assets/docs/article/getting-start-tdd/rust/04-version-control-and-conventional-commits.md +92 -92
- package/lib/assets/docs/article/getting-start-tdd/rust/05-package-management-and-static-analysis.md +212 -212
- package/lib/assets/docs/article/getting-start-tdd/rust/06-task-runner-and-ci-cd.md +164 -164
- package/lib/assets/docs/article/getting-start-tdd/rust/07-encapsulation-and-polymorphism.md +142 -142
- package/lib/assets/docs/article/getting-start-tdd/rust/08-design-patterns.md +145 -145
- package/lib/assets/docs/article/getting-start-tdd/rust/09-solid-principles-and-module-design.md +110 -110
- package/lib/assets/docs/article/getting-start-tdd/rust/10-higher-order-functions-and-composition.md +94 -94
- package/lib/assets/docs/article/getting-start-tdd/rust/11-immutable-data-and-pipeline.md +105 -105
- package/lib/assets/docs/article/getting-start-tdd/rust/12-error-handling-and-type-safety.md +112 -112
- package/lib/assets/docs/article/getting-start-tdd/rust/index.md +83 -83
- package/lib/assets/docs/article/getting-start-tdd/scala/01-todo-list-and-first-test.md +111 -111
- package/lib/assets/docs/article/getting-start-tdd/scala/02-fake-it-and-triangulation.md +107 -107
- package/lib/assets/docs/article/getting-start-tdd/scala/03-obvious-implementation-and-refactoring.md +99 -99
- package/lib/assets/docs/article/getting-start-tdd/scala/04-version-control-and-conventional-commits.md +123 -123
- package/lib/assets/docs/article/getting-start-tdd/scala/05-package-management-and-static-analysis.md +196 -196
- package/lib/assets/docs/article/getting-start-tdd/scala/06-task-runner-and-ci-cd.md +186 -186
- package/lib/assets/docs/article/getting-start-tdd/scala/07-case-classes-and-traits.md +139 -139
- package/lib/assets/docs/article/getting-start-tdd/scala/08-pattern-matching-and-sealed-traits.md +106 -106
- package/lib/assets/docs/article/getting-start-tdd/scala/09-packages-and-module-design.md +75 -75
- package/lib/assets/docs/article/getting-start-tdd/scala/10-higher-order-functions-and-composition.md +104 -104
- package/lib/assets/docs/article/getting-start-tdd/scala/11-collections-and-lazy-evaluation.md +94 -94
- package/lib/assets/docs/article/getting-start-tdd/scala/12-error-handling-and-type-safety.md +92 -92
- package/lib/assets/docs/article/getting-start-tdd/scala/index.md +65 -65
- package/lib/assets/docs/article/grokking-concurrency/all/index.md +404 -404
- package/lib/assets/docs/article/grokking-concurrency/all/part-1-ch02-sequential.md +554 -554
- package/lib/assets/docs/article/grokking-concurrency/all/part-2-ch04-05-threads.md +469 -469
- package/lib/assets/docs/article/grokking-concurrency/all/part-3-ch06-multitasking.md +520 -520
- package/lib/assets/docs/article/grokking-concurrency/all/part-4-ch07-parallel-patterns.md +420 -420
- package/lib/assets/docs/article/grokking-concurrency/all/part-5-ch08-09-synchronization.md +510 -510
- package/lib/assets/docs/article/grokking-concurrency/all/part-6-ch10-11-nonblocking-io.md +435 -435
- package/lib/assets/docs/article/grokking-concurrency/all/part-7-ch12-async.md +465 -465
- package/lib/assets/docs/article/grokking-concurrency/all/part-8-ch13-mapreduce.md +377 -377
- package/lib/assets/docs/article/grokking-concurrency/clojure/index.md +116 -116
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-1.md +108 -108
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-2.md +101 -101
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-3.md +122 -122
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-4.md +123 -123
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-5.md +118 -118
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-6.md +89 -89
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-7.md +100 -100
- package/lib/assets/docs/article/grokking-concurrency/clojure/part-8.md +120 -120
- package/lib/assets/docs/article/grokking-concurrency/csharp/index.md +101 -101
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-1.md +97 -97
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-2.md +123 -123
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-3.md +101 -101
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-4.md +112 -112
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-5.md +99 -99
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-6.md +61 -61
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-7.md +84 -84
- package/lib/assets/docs/article/grokking-concurrency/csharp/part-8.md +92 -92
- package/lib/assets/docs/article/grokking-concurrency/fsharp/index.md +65 -65
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-1.md +80 -80
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-2.md +103 -103
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-3.md +94 -94
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-4.md +110 -110
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-5.md +104 -104
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-6.md +93 -93
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-7.md +121 -121
- package/lib/assets/docs/article/grokking-concurrency/fsharp/part-8.md +107 -107
- package/lib/assets/docs/article/grokking-concurrency/haskell/index.md +248 -248
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-1.md +96 -96
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-2.md +96 -96
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-3.md +91 -91
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-4.md +106 -106
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-5.md +99 -99
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-6.md +95 -95
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-7.md +111 -111
- package/lib/assets/docs/article/grokking-concurrency/haskell/part-8.md +118 -118
- package/lib/assets/docs/article/grokking-concurrency/index.md +66 -66
- package/lib/assets/docs/article/grokking-concurrency/java/index.md +102 -102
- package/lib/assets/docs/article/grokking-concurrency/java/part-1.md +308 -308
- package/lib/assets/docs/article/grokking-concurrency/java/part-2.md +334 -334
- package/lib/assets/docs/article/grokking-concurrency/java/part-3.md +221 -221
- package/lib/assets/docs/article/grokking-concurrency/java/part-4.md +213 -213
- package/lib/assets/docs/article/grokking-concurrency/java/part-5.md +112 -112
- package/lib/assets/docs/article/grokking-concurrency/java/part-6.md +69 -69
- package/lib/assets/docs/article/grokking-concurrency/java/part-7.md +101 -101
- package/lib/assets/docs/article/grokking-concurrency/java/part-8.md +101 -101
- package/lib/assets/docs/article/grokking-concurrency/python/index.md +313 -313
- package/lib/assets/docs/article/grokking-concurrency/python/part-1.md +239 -239
- package/lib/assets/docs/article/grokking-concurrency/python/part-2.md +418 -418
- package/lib/assets/docs/article/grokking-concurrency/python/part-3.md +227 -227
- package/lib/assets/docs/article/grokking-concurrency/python/part-4.md +299 -299
- package/lib/assets/docs/article/grokking-concurrency/python/part-5.md +315 -315
- package/lib/assets/docs/article/grokking-concurrency/python/part-6.md +297 -297
- package/lib/assets/docs/article/grokking-concurrency/python/part-7.md +314 -314
- package/lib/assets/docs/article/grokking-concurrency/python/part-8.md +360 -360
- package/lib/assets/docs/article/grokking-concurrency/rust/index.md +270 -270
- package/lib/assets/docs/article/grokking-concurrency/rust/part-1.md +108 -108
- package/lib/assets/docs/article/grokking-concurrency/rust/part-2.md +120 -120
- package/lib/assets/docs/article/grokking-concurrency/rust/part-3.md +126 -126
- package/lib/assets/docs/article/grokking-concurrency/rust/part-4.md +175 -175
- package/lib/assets/docs/article/grokking-concurrency/rust/part-5.md +158 -158
- package/lib/assets/docs/article/grokking-concurrency/rust/part-6.md +94 -94
- package/lib/assets/docs/article/grokking-concurrency/rust/part-7.md +133 -133
- package/lib/assets/docs/article/grokking-concurrency/rust/part-8.md +155 -155
- package/lib/assets/docs/article/grokking-concurrency/scala/index.md +69 -69
- package/lib/assets/docs/article/grokking-concurrency/scala/part-1.md +78 -78
- package/lib/assets/docs/article/grokking-concurrency/scala/part-2.md +112 -112
- package/lib/assets/docs/article/grokking-concurrency/scala/part-3.md +93 -93
- package/lib/assets/docs/article/grokking-concurrency/scala/part-4.md +110 -110
- package/lib/assets/docs/article/grokking-concurrency/scala/part-5.md +119 -119
- package/lib/assets/docs/article/grokking-concurrency/scala/part-6.md +83 -83
- package/lib/assets/docs/article/grokking-concurrency/scala/part-7.md +131 -131
- package/lib/assets/docs/article/grokking-concurrency/scala/part-8.md +129 -129
- package/lib/assets/docs/article/grokkingfp/all/index.md +368 -368
- package/lib/assets/docs/article/grokkingfp/all/part-1-ch01-fp-introduction.md +530 -530
- package/lib/assets/docs/article/grokkingfp/all/part-1-ch02-pure-functions.md +923 -923
- package/lib/assets/docs/article/grokkingfp/all/part-2-ch03-immutable-data.md +1128 -1128
- package/lib/assets/docs/article/grokkingfp/all/part-2-ch04-higher-order-functions.md +1104 -1104
- package/lib/assets/docs/article/grokkingfp/all/part-2-ch05-flatmap.md +1026 -1026
- package/lib/assets/docs/article/grokkingfp/all/part-3-ch06-option.md +785 -785
- package/lib/assets/docs/article/grokkingfp/all/part-3-ch07-either-adt.md +871 -871
- package/lib/assets/docs/article/grokkingfp/all/part-4-ch08-io-monad.md +972 -972
- package/lib/assets/docs/article/grokkingfp/all/part-4-ch09-streams.md +926 -926
- package/lib/assets/docs/article/grokkingfp/all/part-5-ch10-concurrency.md +870 -870
- package/lib/assets/docs/article/grokkingfp/all/part-6-ch11-application.md +715 -715
- package/lib/assets/docs/article/grokkingfp/all/part-6-ch12-testing.md +626 -626
- package/lib/assets/docs/article/grokkingfp/all/writing-plan.md +712 -712
- package/lib/assets/docs/article/grokkingfp/clojure/index.md +276 -276
- package/lib/assets/docs/article/grokkingfp/clojure/part-1.md +667 -667
- package/lib/assets/docs/article/grokkingfp/clojure/part-2.md +643 -643
- package/lib/assets/docs/article/grokkingfp/clojure/part-3.md +620 -620
- package/lib/assets/docs/article/grokkingfp/clojure/part-4.md +697 -697
- package/lib/assets/docs/article/grokkingfp/clojure/part-5.md +751 -751
- package/lib/assets/docs/article/grokkingfp/clojure/part-6.md +721 -721
- package/lib/assets/docs/article/grokkingfp/csharp/index.md +246 -246
- package/lib/assets/docs/article/grokkingfp/csharp/part-1.md +811 -811
- package/lib/assets/docs/article/grokkingfp/csharp/part-2.md +971 -971
- package/lib/assets/docs/article/grokkingfp/csharp/part-3.md +981 -981
- package/lib/assets/docs/article/grokkingfp/csharp/part-4.md +949 -949
- package/lib/assets/docs/article/grokkingfp/csharp/part-5.md +947 -947
- package/lib/assets/docs/article/grokkingfp/csharp/part-6.md +739 -739
- package/lib/assets/docs/article/grokkingfp/elixir/index.md +203 -203
- package/lib/assets/docs/article/grokkingfp/elixir/part-1.md +712 -712
- package/lib/assets/docs/article/grokkingfp/elixir/part-2.md +838 -838
- package/lib/assets/docs/article/grokkingfp/elixir/part-3.md +985 -985
- package/lib/assets/docs/article/grokkingfp/elixir/part-4.md +974 -974
- package/lib/assets/docs/article/grokkingfp/elixir/part-5.md +1286 -1286
- package/lib/assets/docs/article/grokkingfp/elixir/part-6.md +1049 -1049
- package/lib/assets/docs/article/grokkingfp/fsharp/index.md +210 -210
- package/lib/assets/docs/article/grokkingfp/fsharp/part-1.md +714 -714
- package/lib/assets/docs/article/grokkingfp/fsharp/part-2.md +961 -961
- package/lib/assets/docs/article/grokkingfp/fsharp/part-3.md +972 -972
- package/lib/assets/docs/article/grokkingfp/fsharp/part-4.md +832 -832
- package/lib/assets/docs/article/grokkingfp/fsharp/part-5.md +911 -911
- package/lib/assets/docs/article/grokkingfp/fsharp/part-6.md +922 -922
- package/lib/assets/docs/article/grokkingfp/haskell/index.md +234 -234
- package/lib/assets/docs/article/grokkingfp/haskell/part-1.md +591 -591
- package/lib/assets/docs/article/grokkingfp/haskell/part-2.md +866 -866
- package/lib/assets/docs/article/grokkingfp/haskell/part-3.md +915 -915
- package/lib/assets/docs/article/grokkingfp/haskell/part-4.md +878 -878
- package/lib/assets/docs/article/grokkingfp/haskell/part-5.md +845 -845
- package/lib/assets/docs/article/grokkingfp/haskell/part-6.md +844 -844
- package/lib/assets/docs/article/grokkingfp/index.md +143 -143
- package/lib/assets/docs/article/grokkingfp/java/index.md +211 -211
- package/lib/assets/docs/article/grokkingfp/java/part-1.md +648 -648
- package/lib/assets/docs/article/grokkingfp/java/part-2.md +675 -675
- package/lib/assets/docs/article/grokkingfp/java/part-3.md +672 -672
- package/lib/assets/docs/article/grokkingfp/java/part-4.md +771 -771
- package/lib/assets/docs/article/grokkingfp/java/part-5.md +959 -959
- package/lib/assets/docs/article/grokkingfp/java/part-6.md +1328 -1328
- package/lib/assets/docs/article/grokkingfp/python/index.md +258 -258
- package/lib/assets/docs/article/grokkingfp/python/part-1.md +443 -443
- package/lib/assets/docs/article/grokkingfp/python/part-2.md +958 -958
- package/lib/assets/docs/article/grokkingfp/python/part-3.md +1004 -1004
- package/lib/assets/docs/article/grokkingfp/python/part-4.md +765 -765
- package/lib/assets/docs/article/grokkingfp/python/part-5.md +747 -747
- package/lib/assets/docs/article/grokkingfp/python/part-6.md +861 -861
- package/lib/assets/docs/article/grokkingfp/ruby/index.md +330 -330
- package/lib/assets/docs/article/grokkingfp/ruby/part-1.md +755 -755
- package/lib/assets/docs/article/grokkingfp/ruby/part-2.md +938 -938
- package/lib/assets/docs/article/grokkingfp/ruby/part-3.md +946 -946
- package/lib/assets/docs/article/grokkingfp/ruby/part-4.md +921 -921
- package/lib/assets/docs/article/grokkingfp/ruby/part-5.md +908 -908
- package/lib/assets/docs/article/grokkingfp/ruby/part-6.md +1412 -1412
- package/lib/assets/docs/article/grokkingfp/rust/index.md +242 -242
- package/lib/assets/docs/article/grokkingfp/rust/part-1.md +634 -634
- package/lib/assets/docs/article/grokkingfp/rust/part-2.md +1060 -1060
- package/lib/assets/docs/article/grokkingfp/rust/part-3.md +994 -994
- package/lib/assets/docs/article/grokkingfp/rust/part-4.md +573 -573
- package/lib/assets/docs/article/grokkingfp/rust/part-5.md +705 -705
- package/lib/assets/docs/article/grokkingfp/rust/part-6.md +508 -508
- package/lib/assets/docs/article/grokkingfp/scala/index.md +171 -171
- package/lib/assets/docs/article/grokkingfp/scala/part-1.md +543 -543
- package/lib/assets/docs/article/grokkingfp/scala/part-2.md +946 -946
- package/lib/assets/docs/article/grokkingfp/scala/part-3.md +919 -919
- package/lib/assets/docs/article/grokkingfp/scala/part-4.md +742 -742
- package/lib/assets/docs/article/grokkingfp/scala/part-5.md +722 -722
- package/lib/assets/docs/article/grokkingfp/scala/part-6.md +867 -867
- package/lib/assets/docs/article/grokkingfp/typescript/index.md +273 -273
- package/lib/assets/docs/article/grokkingfp/typescript/part-1.md +561 -561
- package/lib/assets/docs/article/grokkingfp/typescript/part-2.md +1129 -1129
- package/lib/assets/docs/article/grokkingfp/typescript/part-3.md +842 -842
- package/lib/assets/docs/article/grokkingfp/typescript/part-4.md +1087 -1087
- package/lib/assets/docs/article/grokkingfp/typescript/part-5.md +717 -717
- package/lib/assets/docs/article/grokkingfp/typescript/part-6.md +982 -982
- package/lib/assets/docs/article/practical-database-design/index.md +121 -121
- package/lib/assets/docs/article/practical-database-design/part1/chapter01.md +288 -288
- package/lib/assets/docs/article/practical-database-design/part1/chapter02.md +518 -518
- package/lib/assets/docs/article/practical-database-design/part1/chapter03.md +557 -557
- package/lib/assets/docs/article/practical-database-design/part2/chapter04.md +924 -924
- package/lib/assets/docs/article/practical-database-design/part2/chapter05.md +1627 -1627
- package/lib/assets/docs/article/practical-database-design/part2/chapter06.md +2716 -2716
- package/lib/assets/docs/article/practical-database-design/part2/chapter07.md +2082 -2082
- package/lib/assets/docs/article/practical-database-design/part2/chapter08.md +2105 -2105
- package/lib/assets/docs/article/practical-database-design/part2/chapter09.md +2031 -2031
- package/lib/assets/docs/article/practical-database-design/part2/chapter10.md +1387 -1387
- package/lib/assets/docs/article/practical-database-design/part2/chapter11.md +1677 -1677
- package/lib/assets/docs/article/practical-database-design/part2/chapter12.md +1417 -1417
- package/lib/assets/docs/article/practical-database-design/part2/chapter13.md +1434 -1434
- package/lib/assets/docs/article/practical-database-design/part3/chapter14.md +667 -667
- package/lib/assets/docs/article/practical-database-design/part3/chapter15.md +1625 -1625
- package/lib/assets/docs/article/practical-database-design/part3/chapter16.md +1915 -1915
- package/lib/assets/docs/article/practical-database-design/part3/chapter17.md +1708 -1708
- package/lib/assets/docs/article/practical-database-design/part3/chapter18.md +2095 -2095
- package/lib/assets/docs/article/practical-database-design/part3/chapter19.md +1123 -1123
- package/lib/assets/docs/article/practical-database-design/part3/chapter20.md +1031 -1031
- package/lib/assets/docs/article/practical-database-design/part3/chapter21.md +1382 -1382
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter14-orm.md +991 -991
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter15-orm.md +1300 -1300
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter16-orm.md +1166 -1166
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter17-orm.md +1584 -1584
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter18-orm.md +1183 -1183
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter19-orm.md +1016 -1016
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter20-orm.md +1753 -1753
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter21-orm.md +1447 -1447
- package/lib/assets/docs/article/practical-database-design/part3-orm/chapter22-orm.md +1878 -1878
- package/lib/assets/docs/article/practical-database-design/part4/chapter22.md +965 -965
- package/lib/assets/docs/article/practical-database-design/part4/chapter23.md +2069 -2069
- package/lib/assets/docs/article/practical-database-design/part4/chapter24.md +2439 -2439
- package/lib/assets/docs/article/practical-database-design/part4/chapter25.md +3661 -3661
- package/lib/assets/docs/article/practical-database-design/part4/chapter26.md +2916 -2916
- package/lib/assets/docs/article/practical-database-design/part4/chapter27.md +3105 -3105
- package/lib/assets/docs/article/practical-database-design/part4/chapter28.md +2697 -2697
- package/lib/assets/docs/article/practical-database-design/part4/chapter29.md +2544 -2544
- package/lib/assets/docs/article/practical-database-design/part4/chapter30.md +2180 -2180
- package/lib/assets/docs/article/practical-database-design/part4/chapter31.md +1192 -1192
- package/lib/assets/docs/article/practical-database-design/part4/chapter32.md +2101 -2101
- package/lib/assets/docs/article/practical-database-design/part5/chapter33.md +1032 -1032
- package/lib/assets/docs/article/practical-database-design/part5/chapter34.md +1609 -1609
- package/lib/assets/docs/article/practical-database-design/part5/chapter35.md +1453 -1453
- package/lib/assets/docs/article/practical-database-design/part5/chapter36.md +1292 -1292
- package/lib/assets/docs/article/practical-database-design/part5/chapter37.md +1470 -1470
- package/lib/assets/docs/article/practical-database-design/part5/chapter38.md +1698 -1698
- package/lib/assets/docs/article/practical-database-design/part5/chapter39.md +2334 -2334
- package/lib/assets/docs/article/practical-database-design/study/study2-1.md +1693 -1693
- package/lib/assets/docs/article/practical-database-design/study/study2-2.md +1347 -1347
- package/lib/assets/docs/article/practical-database-design/study/study2-3.md +2044 -2044
- package/lib/assets/docs/article/practical-database-design/study/study2-4.md +2229 -2229
- package/lib/assets/docs/article/practical-database-design/study/study2-5.md +2418 -2418
- package/lib/assets/docs/article/practical-database-design/study/study3-1.md +2205 -2205
- package/lib/assets/docs/article/practical-database-design/study/study3-2.md +2221 -2221
- package/lib/assets/docs/article/practical-database-design/study/study3-3.md +2253 -2253
- package/lib/assets/docs/article/practical-database-design/study/study3-4.md +2106 -2106
- package/lib/assets/docs/article/practical-database-design/study/study3-5.md +2507 -2507
- package/lib/assets/docs/article/practical-database-design/study/study4-1.md +2587 -2587
- package/lib/assets/docs/article/practical-database-design/study/study4-2.md +2075 -2075
- package/lib/assets/docs/article/practical-database-design/study/study4-3.md +1805 -1805
- package/lib/assets/docs/article/practical-database-design/study/study4-4.md +1895 -1895
- package/lib/assets/docs/article/practical-database-design/study/study4-5.md +2878 -2878
- package/lib/assets/docs/assets/css/extra.css +29 -29
- package/lib/assets/docs/assets/js/extra.js +44 -44
- package/lib/assets/docs/development/index.md +39 -39
- package/lib/assets/docs/operation/index.md +11 -11
- package/lib/assets/docs/reference/CodexCLIMCP/343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/351/226/213/347/231/272/343/203/225/343/203/255/343/203/274.md +532 -532
- package/lib/assets/docs/reference/CodexCLIMCP/343/202/265/343/203/274/343/203/220/343/203/274/350/250/255/345/256/232/346/211/213/351/240/206.md +341 -341
- package/lib/assets/docs/reference/Java/343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/347/222/260/345/242/203/346/247/213/347/257/211/343/202/254/343/202/244/343/203/211.md +581 -581
- package/lib/assets/docs/reference/SonarQube/343/203/255/343/203/274/343/202/253/343/203/253/347/222/260/345/242/203/343/202/273/343/203/203/343/203/210/343/202/242/343/203/203/343/203/227/346/211/213/351/240/206/346/233/270.md +642 -642
- package/lib/assets/docs/reference/TypeScript/343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/347/222/260/345/242/203/346/247/213/347/257/211/343/202/254/343/202/244/343/203/211.md +465 -465
- package/lib/assets/docs/reference/UI/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +450 -450
- package/lib/assets/docs/reference/images/Ansoff.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/BrandBasicStrategy.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/BrandCategorization.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/BrandRecurutementStrategy.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/BrandValue.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/BusinessActivitiy.svg +3 -3
- package/lib/assets/docs/reference/images/HRM.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/MarketingStructure.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/OrganizationElemnts.svg +3 -3
- package/lib/assets/docs/reference/images/PPM.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/PositioningMap.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/ProductLayer.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/ProductMix.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/SWOT.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/TargetMarket.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/ThreeGenericStrategies.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/VRIO.drawio.svg +3 -3
- package/lib/assets/docs/reference/images/ValueChain.drawio.svg +3 -3
- package/lib/assets/docs/reference/index.md +52 -52
- package/lib/assets/docs/reference//343/202/210/343/201/204/343/202/275/343/203/225/343/203/210/343/202/246/343/202/247/343/202/242/343/201/250/343/201/257.md +250 -250
- package/lib/assets/docs/reference//343/202/242/343/203/274/343/202/255/343/203/206/343/202/257/343/203/201/343/203/243/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +2216 -2216
- package/lib/assets/docs/reference//343/202/244/343/203/263/343/203/225/343/203/251/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +1878 -1878
- package/lib/assets/docs/reference//343/202/250/343/202/257/343/202/271/343/203/210/343/203/252/343/203/274/343/203/240/343/203/227/343/203/255/343/202/260/343/203/251/343/203/237/343/203/263/343/202/260.md +550 -550
- package/lib/assets/docs/reference//343/202/263/343/203/274/343/203/207/343/202/243/343/203/263/343/202/260/343/201/250/343/203/206/343/202/271/343/203/210/343/202/254/343/202/244/343/203/211.md +705 -705
- package/lib/assets/docs/reference//343/203/206/343/202/271/343/203/210/346/210/246/347/225/245/343/202/254/343/202/244/343/203/211.md +1313 -1313
- package/lib/assets/docs/reference//343/203/207/343/203/274/343/202/277/343/203/242/343/203/207/343/203/253/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +311 -311
- package/lib/assets/docs/reference//343/203/211/343/203/241/343/202/244/343/203/263/343/203/242/343/203/207/343/203/253/350/250/255/350/250/210/343/202/254/343/202/244/343/203/211.md +599 -599
- package/lib/assets/docs/reference//343/203/223/343/202/270/343/203/215/343/202/271/343/202/242/343/203/274/343/202/255/343/203/206/343/202/257/343/203/201/343/203/243/345/210/206/346/236/220/343/202/254/343/202/244/343/203/211.md +528 -528
- package/lib/assets/docs/reference//343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271/344/275/234/346/210/220/343/202/254/343/202/244/343/203/211.md +689 -689
- package/lib/assets/docs/reference//343/203/252/343/203/252/343/203/274/343/202/271/343/202/254/343/202/244/343/203/211.md +461 -461
- package/lib/assets/docs/reference//343/203/252/343/203/252/343/203/274/343/202/271/343/203/273/343/202/244/343/203/206/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263/350/250/210/347/224/273/343/202/254/343/202/244/343/203/211.md +580 -580
- package/lib/assets/docs/reference//343/203/255/343/202/270/343/202/253/343/203/253/343/202/267/343/203/263/343/202/255/343/203/263/343/202/260.md +1367 -1367
- package/lib/assets/docs/reference//344/274/201/346/245/255/347/265/214/345/226/266/350/253/226.md +2637 -2637
- package/lib/assets/docs/reference//347/222/260/345/242/203/345/244/211/346/225/260/347/256/241/347/220/206/343/202/254/343/202/244/343/203/211.md +665 -665
- package/lib/assets/docs/reference//350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +1248 -1248
- package/lib/assets/docs/reference//350/250/200/350/252/236/345/210/245/351/226/213/347/231/272/343/202/254/343/202/244/343/203/211.md +518 -518
- package/lib/assets/docs/reference//351/201/213/345/226/266/347/256/241/347/220/206.md +1482 -1482
- package/lib/assets/docs/reference//351/201/213/347/224/250/343/202/271/343/202/257/343/203/252/343/203/227/343/203/210/344/275/234/346/210/220/343/202/254/343/202/244/343/203/211.md +421 -421
- package/lib/assets/docs/reference//351/201/213/347/224/250/350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +392 -392
- package/lib/assets/docs/reference//351/226/213/347/231/272/343/202/254/343/202/244/343/203/211.md +299 -299
- package/lib/assets/docs/reference//351/235/236/346/251/237/350/203/275/350/246/201/344/273/266/345/256/232/347/276/251/343/202/254/343/202/244/343/203/211.md +1236 -1236
- package/lib/assets/docs/review/index.md +5 -5
- package/lib/assets/docs/strategy/index.md +1 -1
- package/lib/assets/docs/template/ADR.md +30 -30
- package/lib/assets/docs/template/AWS/343/202/271/343/203/206/343/203/274/343/202/270/343/203/263/343/202/260/347/222/260/345/242/203/343/202/273/343/203/203/343/203/210/343/202/242/343/203/203/343/203/227/346/211/213/351/240/206/346/233/270.md +1366 -1366
- package/lib/assets/docs/template/AWS/343/203/227/343/203/255/343/203/200/343/202/257/343/202/267/343/203/247/343/203/263/347/222/260/345/242/203/343/202/273/343/203/203/343/203/210/343/202/242/343/203/203/343/203/227/346/211/213/351/240/206/346/233/270.md +634 -634
- package/lib/assets/docs/template/README.md +50 -50
- package/lib/assets/docs/template/index.md +23 -23
- package/lib/assets/docs/template//343/201/276/343/201/232/343/201/223/343/202/214/343/202/222/350/252/255/343/202/202/343/201/206/343/203/252/343/202/271/343/203/210.md +12 -12
- package/lib/assets/docs/template//343/202/242/343/203/227/343/203/252/343/202/261/343/203/274/343/202/267/343/203/247/343/203/263/351/226/213/347/231/272/347/222/260/345/242/203/343/202/273/343/203/203/343/203/210/343/202/242/343/203/203/343/203/227/346/211/213/351/240/206/346/233/270.md +547 -547
- package/lib/assets/docs/template//343/202/244/343/203/206/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263/345/256/214/344/272/206/345/240/261/345/221/212/346/233/270.md +58 -58
- package/lib/assets/docs/template//343/202/244/343/203/263/343/202/273/343/203/227/343/202/267/343/203/247/343/203/263/343/203/207/343/203/203/343/202/255.md +13 -13
- package/lib/assets/docs/template//343/203/223/343/202/270/343/203/215/343/202/271/343/202/242/343/203/274/343/202/255/343/203/206/343/202/257/343/203/201/343/203/243.md +379 -379
- package/lib/assets/docs/template//344/274/201/346/245/255/345/210/206/346/236/220.md +573 -573
- package/lib/assets/docs/template//345/256/214/345/205/250/345/275/242/345/274/217/343/201/256/343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271.md +69 -69
- package/lib/assets/docs/template//350/246/201/344/273/266/345/256/232/347/276/251.md +669 -669
- package/lib/assets/docs/template//350/250/255/350/250/210.md +173 -173
- package/lib/assets/docs/template//351/226/213/347/231/272/347/222/260/345/242/203/343/202/273/343/203/203/343/203/210/343/202/242/343/203/203/343/203/227/346/211/213/351/240/206/346/233/270.md +688 -688
- package/lib/assets/gulpfile.js +25 -25
- package/lib/assets/mkdocs.yml +136 -136
- package/lib/assets/ops/docker/mkdoc/Dockerfile +19 -19
- package/lib/assets/ops/scripts/journal.js +180 -180
- package/lib/assets/ops/scripts/mkdocs.js +82 -82
- package/lib/assets/ops/scripts/release.js +431 -431
- package/lib/assets/ops/scripts/sonar_local.js +726 -726
- package/lib/assets/ops/scripts/ssh.js +190 -190
- package/lib/assets/ops/scripts/vault.js +299 -299
- package/lib/assets/package-lock.json +1653 -1653
- package/lib/assets/package.json +40 -40
- package/lib/gulpfile.js +37 -37
- package/package.json +41 -41
|
@@ -1,1300 +1,1300 @@
|
|
|
1
|
-
# 第15章:勘定科目の設計(ORM版)
|
|
2
|
-
|
|
3
|
-
財務会計システムの根幹となる勘定科目マスタを Spring Data JPA で設計します。本章では、TDD(テスト駆動開発)を用いて勘定科目マスタ、勘定科目構成マスタ、課税取引マスタを JPA エンティティとして実装していきます。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 15.1 勘定科目マスタの設計
|
|
8
|
-
|
|
9
|
-
### 勘定科目の区分体系
|
|
10
|
-
|
|
11
|
-
勘定科目は複数の区分で分類されます。これらの区分を正しく理解することが、財務会計システム設計の基礎となります。
|
|
12
|
-
|
|
13
|
-
```plantuml
|
|
14
|
-
@startuml
|
|
15
|
-
|
|
16
|
-
title 勘定科目の区分体系
|
|
17
|
-
|
|
18
|
-
package "BSPL区分" {
|
|
19
|
-
rectangle "BS(貸借対照表)" as BS #LightBlue
|
|
20
|
-
rectangle "PL(損益計算書)" as PL #LightGreen
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
package "貸借区分" {
|
|
24
|
-
rectangle "借方" as Debit #LightYellow
|
|
25
|
-
rectangle "貸方" as Credit #LightPink
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
package "取引要素区分" {
|
|
29
|
-
rectangle "資産" as Asset
|
|
30
|
-
rectangle "負債" as Liability
|
|
31
|
-
rectangle "資本" as Equity
|
|
32
|
-
rectangle "収益" as Revenue
|
|
33
|
-
rectangle "費用" as Expense
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
package "集計区分" {
|
|
37
|
-
rectangle "見出科目" as Header
|
|
38
|
-
rectangle "集計科目" as Summary
|
|
39
|
-
rectangle "計上科目" as Posting
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
BS --> Asset : 借方
|
|
43
|
-
BS --> Liability : 貸方
|
|
44
|
-
BS --> Equity : 貸方
|
|
45
|
-
PL --> Revenue : 貸方
|
|
46
|
-
PL --> Expense : 借方
|
|
47
|
-
|
|
48
|
-
@enduml
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
#### 区分の説明
|
|
52
|
-
|
|
53
|
-
| 区分 | 説明 | 値の例 |
|
|
54
|
-
|-----|------|-------|
|
|
55
|
-
| **BSPL区分** | 貸借対照表(BS)か損益計算書(PL)か | `BS`, `PL` |
|
|
56
|
-
| **貸借区分** | 借方科目か貸方科目か | `借方`, `貸方` |
|
|
57
|
-
| **取引要素区分** | 5つの取引要素のどれに該当するか | `資産`, `負債`, `資本`, `収益`, `費用` |
|
|
58
|
-
| **集計区分** | 科目の性質(見出し/集計/計上) | `見出科目`, `集計科目`, `計上科目` |
|
|
59
|
-
|
|
60
|
-
#### 取引要素と貸借区分の関係
|
|
61
|
-
|
|
62
|
-
複式簿記では、取引要素によって借方・貸方が決まります。
|
|
63
|
-
|
|
64
|
-
| 取引要素 | BSPL区分 | 増加時の貸借 | 減少時の貸借 |
|
|
65
|
-
|---------|---------|------------|------------|
|
|
66
|
-
| 資産 | BS | 借方 | 貸方 |
|
|
67
|
-
| 負債 | BS | 貸方 | 借方 |
|
|
68
|
-
| 資本 | BS | 貸方 | 借方 |
|
|
69
|
-
| 収益 | PL | 貸方 | 借方 |
|
|
70
|
-
| 費用 | PL | 借方 | 貸方 |
|
|
71
|
-
|
|
72
|
-
### 勘定科目マスタのER図
|
|
73
|
-
|
|
74
|
-
```plantuml
|
|
75
|
-
@startuml
|
|
76
|
-
|
|
77
|
-
title 勘定科目マスタ
|
|
78
|
-
|
|
79
|
-
entity 勘定科目マスタ {
|
|
80
|
-
勘定科目コード <<PK>>
|
|
81
|
-
--
|
|
82
|
-
勘定科目名
|
|
83
|
-
勘定科目略名
|
|
84
|
-
勘定科目カナ
|
|
85
|
-
BSPL区分
|
|
86
|
-
貸借区分
|
|
87
|
-
取引要素区分
|
|
88
|
-
集計区分
|
|
89
|
-
管理会計区分
|
|
90
|
-
費用区分
|
|
91
|
-
元帳出力区分
|
|
92
|
-
補助科目種別
|
|
93
|
-
消費税計算区分
|
|
94
|
-
課税取引コード <<FK>>
|
|
95
|
-
期日管理区分
|
|
96
|
-
作成日時
|
|
97
|
-
更新日時
|
|
98
|
-
更新者名
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
entity 課税取引マスタ {
|
|
102
|
-
課税取引コード <<PK>>
|
|
103
|
-
--
|
|
104
|
-
課税取引名
|
|
105
|
-
税率
|
|
106
|
-
更新日時
|
|
107
|
-
更新者名
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
勘定科目マスタ }o..|| 課税取引マスタ
|
|
111
|
-
|
|
112
|
-
@enduml
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### マイグレーション:ENUM型とテーブルの作成
|
|
116
|
-
|
|
117
|
-
<details>
|
|
118
|
-
<summary>V001__create_enum_types.sql</summary>
|
|
119
|
-
|
|
120
|
-
```sql
|
|
121
|
-
-- BSPL区分(貸借対照表・損益計算書)
|
|
122
|
-
CREATE TYPE BSPL区分 AS ENUM ('BS', 'PL');
|
|
123
|
-
|
|
124
|
-
-- 貸借区分
|
|
125
|
-
CREATE TYPE 貸借区分 AS ENUM ('借方', '貸方');
|
|
126
|
-
|
|
127
|
-
-- 取引要素区分
|
|
128
|
-
CREATE TYPE 取引要素区分 AS ENUM ('資産', '負債', '資本', '収益', '費用');
|
|
129
|
-
|
|
130
|
-
-- 集計区分
|
|
131
|
-
CREATE TYPE 集計区分 AS ENUM ('見出科目', '集計科目', '計上科目');
|
|
132
|
-
|
|
133
|
-
-- 消費税計算区分
|
|
134
|
-
CREATE TYPE 消費税計算区分 AS ENUM ('課税', '非課税', '不課税', '免税');
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
</details>
|
|
138
|
-
|
|
139
|
-
<details>
|
|
140
|
-
<summary>V002__create_account_master.sql</summary>
|
|
141
|
-
|
|
142
|
-
```sql
|
|
143
|
-
-- 課税取引マスタ
|
|
144
|
-
CREATE TABLE "課税取引マスタ" (
|
|
145
|
-
"課税取引コード" VARCHAR(2) PRIMARY KEY,
|
|
146
|
-
"課税取引名" VARCHAR(20) NOT NULL,
|
|
147
|
-
"税率" DECIMAL(5,3) NOT NULL DEFAULT 0.10,
|
|
148
|
-
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
149
|
-
"更新者名" VARCHAR(12)
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
-- 勘定科目マスタ
|
|
153
|
-
CREATE TABLE "勘定科目マスタ" (
|
|
154
|
-
"勘定科目コード" VARCHAR(5) PRIMARY KEY,
|
|
155
|
-
"勘定科目名" VARCHAR(40) NOT NULL,
|
|
156
|
-
"勘定科目略名" VARCHAR(10),
|
|
157
|
-
"勘定科目カナ" VARCHAR(40),
|
|
158
|
-
"BSPL区分" BSPL区分 NOT NULL,
|
|
159
|
-
"貸借区分" 貸借区分 NOT NULL,
|
|
160
|
-
"取引要素区分" 取引要素区分 NOT NULL,
|
|
161
|
-
"集計区分" 集計区分 NOT NULL,
|
|
162
|
-
"管理会計区分" VARCHAR(1),
|
|
163
|
-
"費用区分" VARCHAR(1),
|
|
164
|
-
"元帳出力区分" VARCHAR(1),
|
|
165
|
-
"補助科目種別" VARCHAR(1),
|
|
166
|
-
"消費税計算区分" 消費税計算区分,
|
|
167
|
-
"課税取引コード" VARCHAR(2) REFERENCES "課税取引マスタ"("課税取引コード"),
|
|
168
|
-
"期日管理区分" VARCHAR(1),
|
|
169
|
-
"作成日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
170
|
-
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
171
|
-
"更新者名" VARCHAR(12)
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
-- インデックス
|
|
175
|
-
CREATE INDEX idx_勘定科目マスタ_BSPL区分 ON "勘定科目マスタ"("BSPL区分");
|
|
176
|
-
CREATE INDEX idx_勘定科目マスタ_取引要素区分 ON "勘定科目マスタ"("取引要素区分");
|
|
177
|
-
CREATE INDEX idx_勘定科目マスタ_集計区分 ON "勘定科目マスタ"("集計区分");
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
</details>
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## 15.2 JPA エンティティの実装
|
|
185
|
-
|
|
186
|
-
### TDD による勘定科目マスタの実装
|
|
187
|
-
|
|
188
|
-
#### Red: 失敗するテストを書く
|
|
189
|
-
|
|
190
|
-
<details>
|
|
191
|
-
<summary>勘定科目リポジトリテスト</summary>
|
|
192
|
-
|
|
193
|
-
```java
|
|
194
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
195
|
-
|
|
196
|
-
import com.example.accounting.application.port.out.AccountRepository;
|
|
197
|
-
import com.example.accounting.domain.model.account.*;
|
|
198
|
-
import com.example.accounting.testsetup.BaseIntegrationTest;
|
|
199
|
-
import org.junit.jupiter.api.*;
|
|
200
|
-
import org.springframework.beans.factory.annotation.Autowired;
|
|
201
|
-
|
|
202
|
-
import static org.assertj.core.api.Assertions.*;
|
|
203
|
-
|
|
204
|
-
@DisplayName("勘定科目リポジトリ")
|
|
205
|
-
class AccountRepositoryTest extends BaseIntegrationTest {
|
|
206
|
-
|
|
207
|
-
@Autowired
|
|
208
|
-
private AccountRepository accountRepository;
|
|
209
|
-
|
|
210
|
-
@BeforeEach
|
|
211
|
-
void setUp() {
|
|
212
|
-
accountRepository.deleteAll();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
@Nested
|
|
216
|
-
@DisplayName("登録")
|
|
217
|
-
class Registration {
|
|
218
|
-
|
|
219
|
-
@Test
|
|
220
|
-
@DisplayName("勘定科目を登録できる")
|
|
221
|
-
void canRegisterAccount() {
|
|
222
|
-
// Arrange
|
|
223
|
-
var account = Account.builder()
|
|
224
|
-
.accountCode("11110")
|
|
225
|
-
.accountName("現金")
|
|
226
|
-
.accountShortName("現金")
|
|
227
|
-
.bsPlType(BsPlType.BS)
|
|
228
|
-
.debitCreditType(DebitCreditType.DEBIT)
|
|
229
|
-
.transactionElementType(TransactionElementType.ASSET)
|
|
230
|
-
.aggregationType(AggregationType.POSTING)
|
|
231
|
-
.build();
|
|
232
|
-
|
|
233
|
-
// Act
|
|
234
|
-
accountRepository.save(account);
|
|
235
|
-
|
|
236
|
-
// Assert
|
|
237
|
-
var result = accountRepository.findByCode("11110");
|
|
238
|
-
assertThat(result).isPresent();
|
|
239
|
-
assertThat(result.get().getAccountName()).isEqualTo("現金");
|
|
240
|
-
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.BS);
|
|
241
|
-
assertThat(result.get().getDebitCreditType()).isEqualTo(DebitCreditType.DEBIT);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
@Test
|
|
245
|
-
@DisplayName("貸借対照表の資産科目を登録できる")
|
|
246
|
-
void canRegisterBSAssetAccount() {
|
|
247
|
-
var account = createAccount("11000", "流動資産", BsPlType.BS,
|
|
248
|
-
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.SUMMARY);
|
|
249
|
-
accountRepository.save(account);
|
|
250
|
-
|
|
251
|
-
var result = accountRepository.findByCode("11000");
|
|
252
|
-
assertThat(result).isPresent();
|
|
253
|
-
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.BS);
|
|
254
|
-
assertThat(result.get().getTransactionElementType()).isEqualTo(TransactionElementType.ASSET);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
@Test
|
|
258
|
-
@DisplayName("損益計算書の収益科目を登録できる")
|
|
259
|
-
void canRegisterPLRevenueAccount() {
|
|
260
|
-
var account = createAccount("41000", "売上高", BsPlType.PL,
|
|
261
|
-
DebitCreditType.CREDIT, TransactionElementType.REVENUE, AggregationType.SUMMARY);
|
|
262
|
-
accountRepository.save(account);
|
|
263
|
-
|
|
264
|
-
var result = accountRepository.findByCode("41000");
|
|
265
|
-
assertThat(result).isPresent();
|
|
266
|
-
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.PL);
|
|
267
|
-
assertThat(result.get().getTransactionElementType()).isEqualTo(TransactionElementType.REVENUE);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
@Nested
|
|
272
|
-
@DisplayName("集計区分")
|
|
273
|
-
class AggregationTypes {
|
|
274
|
-
|
|
275
|
-
@Test
|
|
276
|
-
@DisplayName("見出科目を登録できる")
|
|
277
|
-
void canRegisterHeaderAccount() {
|
|
278
|
-
var account = createAccount("11", "(資産の部)", BsPlType.BS,
|
|
279
|
-
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.HEADING);
|
|
280
|
-
accountRepository.save(account);
|
|
281
|
-
|
|
282
|
-
var result = accountRepository.findByCode("11");
|
|
283
|
-
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.HEADING);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
@Test
|
|
287
|
-
@DisplayName("集計科目を登録できる")
|
|
288
|
-
void canRegisterSummaryAccount() {
|
|
289
|
-
var account = createAccount("11190", "現金及び預金", BsPlType.BS,
|
|
290
|
-
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.SUMMARY);
|
|
291
|
-
accountRepository.save(account);
|
|
292
|
-
|
|
293
|
-
var result = accountRepository.findByCode("11190");
|
|
294
|
-
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.SUMMARY);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
@Test
|
|
298
|
-
@DisplayName("計上科目を登録できる")
|
|
299
|
-
void canRegisterPostingAccount() {
|
|
300
|
-
var account = createAccount("11110", "現金", BsPlType.BS,
|
|
301
|
-
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.POSTING);
|
|
302
|
-
accountRepository.save(account);
|
|
303
|
-
|
|
304
|
-
var result = accountRepository.findByCode("11110");
|
|
305
|
-
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.POSTING);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
private Account createAccount(String code, String name, BsPlType bsPlType,
|
|
310
|
-
DebitCreditType debitCreditType, TransactionElementType transactionElementType,
|
|
311
|
-
AggregationType aggregationType) {
|
|
312
|
-
return Account.builder()
|
|
313
|
-
.accountCode(code)
|
|
314
|
-
.accountName(name)
|
|
315
|
-
.bsPlType(bsPlType)
|
|
316
|
-
.debitCreditType(debitCreditType)
|
|
317
|
-
.transactionElementType(transactionElementType)
|
|
318
|
-
.aggregationType(aggregationType)
|
|
319
|
-
.build();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
</details>
|
|
325
|
-
|
|
326
|
-
#### Green: テストを通す実装
|
|
327
|
-
|
|
328
|
-
##### ドメイン層(JPA エンティティ)
|
|
329
|
-
|
|
330
|
-
<details>
|
|
331
|
-
<summary>Account.java(勘定科目エンティティ)</summary>
|
|
332
|
-
|
|
333
|
-
```java
|
|
334
|
-
package com.example.accounting.domain.model.account;
|
|
335
|
-
|
|
336
|
-
import com.example.accounting.infrastructure.persistence.converter.*;
|
|
337
|
-
import jakarta.persistence.*;
|
|
338
|
-
import lombok.*;
|
|
339
|
-
import java.time.LocalDateTime;
|
|
340
|
-
|
|
341
|
-
@Entity
|
|
342
|
-
@Table(name = "勘定科目マスタ")
|
|
343
|
-
@Data
|
|
344
|
-
@Builder
|
|
345
|
-
@NoArgsConstructor
|
|
346
|
-
@AllArgsConstructor
|
|
347
|
-
public class Account {
|
|
348
|
-
|
|
349
|
-
@Id
|
|
350
|
-
@Column(name = "勘定科目コード", length = 5)
|
|
351
|
-
private String accountCode;
|
|
352
|
-
|
|
353
|
-
@Column(name = "勘定科目名", length = 40, nullable = false)
|
|
354
|
-
private String accountName;
|
|
355
|
-
|
|
356
|
-
@Column(name = "勘定科目略名", length = 10)
|
|
357
|
-
private String accountShortName;
|
|
358
|
-
|
|
359
|
-
@Column(name = "勘定科目カナ", length = 40)
|
|
360
|
-
private String accountNameKana;
|
|
361
|
-
|
|
362
|
-
@Convert(converter = BsPlTypeConverter.class)
|
|
363
|
-
@Column(name = "BSPL区分", nullable = false, columnDefinition = "BSPL区分")
|
|
364
|
-
private BsPlType bsPlType;
|
|
365
|
-
|
|
366
|
-
@Convert(converter = DebitCreditTypeConverter.class)
|
|
367
|
-
@Column(name = "貸借区分", nullable = false, columnDefinition = "貸借区分")
|
|
368
|
-
private DebitCreditType debitCreditType;
|
|
369
|
-
|
|
370
|
-
@Convert(converter = TransactionElementTypeConverter.class)
|
|
371
|
-
@Column(name = "取引要素区分", nullable = false, columnDefinition = "取引要素区分")
|
|
372
|
-
private TransactionElementType transactionElementType;
|
|
373
|
-
|
|
374
|
-
@Convert(converter = AggregationTypeConverter.class)
|
|
375
|
-
@Column(name = "集計区分", nullable = false, columnDefinition = "集計区分")
|
|
376
|
-
private AggregationType aggregationType;
|
|
377
|
-
|
|
378
|
-
@Column(name = "管理会計区分", length = 1)
|
|
379
|
-
private String managementAccountingType;
|
|
380
|
-
|
|
381
|
-
@Column(name = "費用区分", length = 1)
|
|
382
|
-
private String expenseType;
|
|
383
|
-
|
|
384
|
-
@Column(name = "元帳出力区分", length = 1)
|
|
385
|
-
private String ledgerOutputType;
|
|
386
|
-
|
|
387
|
-
@Column(name = "補助科目種別", length = 1)
|
|
388
|
-
private String subAccountType;
|
|
389
|
-
|
|
390
|
-
@Convert(converter = TaxCalculationTypeConverter.class)
|
|
391
|
-
@Column(name = "消費税計算区分", columnDefinition = "消費税計算区分")
|
|
392
|
-
private TaxCalculationType taxCalculationType;
|
|
393
|
-
|
|
394
|
-
@Column(name = "課税取引コード", length = 2)
|
|
395
|
-
private String taxTransactionCode;
|
|
396
|
-
|
|
397
|
-
@Column(name = "期日管理区分", length = 1)
|
|
398
|
-
private String dueDateManagementType;
|
|
399
|
-
|
|
400
|
-
@Column(name = "作成日時")
|
|
401
|
-
private LocalDateTime createdAt;
|
|
402
|
-
|
|
403
|
-
@Column(name = "更新日時")
|
|
404
|
-
private LocalDateTime updatedAt;
|
|
405
|
-
|
|
406
|
-
@Column(name = "更新者名", length = 12)
|
|
407
|
-
private String updatedBy;
|
|
408
|
-
|
|
409
|
-
@PrePersist
|
|
410
|
-
protected void onCreate() {
|
|
411
|
-
createdAt = LocalDateTime.now();
|
|
412
|
-
updatedAt = LocalDateTime.now();
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
@PreUpdate
|
|
416
|
-
protected void onUpdate() {
|
|
417
|
-
updatedAt = LocalDateTime.now();
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
</details>
|
|
423
|
-
|
|
424
|
-
##### ENUM 定義(ドメイン層)
|
|
425
|
-
|
|
426
|
-
<details>
|
|
427
|
-
<summary>BsPlType.java(BSPL区分)</summary>
|
|
428
|
-
|
|
429
|
-
```java
|
|
430
|
-
package com.example.accounting.domain.model.account;
|
|
431
|
-
|
|
432
|
-
import lombok.Getter;
|
|
433
|
-
import lombok.RequiredArgsConstructor;
|
|
434
|
-
|
|
435
|
-
@Getter
|
|
436
|
-
@RequiredArgsConstructor
|
|
437
|
-
public enum BsPlType {
|
|
438
|
-
BS("BS"),
|
|
439
|
-
PL("PL");
|
|
440
|
-
|
|
441
|
-
private final String displayName;
|
|
442
|
-
|
|
443
|
-
public static BsPlType fromDisplayName(String displayName) {
|
|
444
|
-
for (BsPlType type : values()) {
|
|
445
|
-
if (type.displayName.equals(displayName)) {
|
|
446
|
-
return type;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
throw new IllegalArgumentException("不正なBSPL区分: " + displayName);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
</details>
|
|
455
|
-
|
|
456
|
-
<details>
|
|
457
|
-
<summary>DebitCreditType.java(貸借区分)</summary>
|
|
458
|
-
|
|
459
|
-
```java
|
|
460
|
-
package com.example.accounting.domain.model.account;
|
|
461
|
-
|
|
462
|
-
import lombok.Getter;
|
|
463
|
-
import lombok.RequiredArgsConstructor;
|
|
464
|
-
|
|
465
|
-
@Getter
|
|
466
|
-
@RequiredArgsConstructor
|
|
467
|
-
public enum DebitCreditType {
|
|
468
|
-
DEBIT("借方"),
|
|
469
|
-
CREDIT("貸方");
|
|
470
|
-
|
|
471
|
-
private final String displayName;
|
|
472
|
-
|
|
473
|
-
public static DebitCreditType fromDisplayName(String displayName) {
|
|
474
|
-
for (DebitCreditType type : values()) {
|
|
475
|
-
if (type.displayName.equals(displayName)) {
|
|
476
|
-
return type;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
throw new IllegalArgumentException("不正な貸借区分: " + displayName);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
</details>
|
|
485
|
-
|
|
486
|
-
<details>
|
|
487
|
-
<summary>TransactionElementType.java(取引要素区分)</summary>
|
|
488
|
-
|
|
489
|
-
```java
|
|
490
|
-
package com.example.accounting.domain.model.account;
|
|
491
|
-
|
|
492
|
-
import lombok.Getter;
|
|
493
|
-
import lombok.RequiredArgsConstructor;
|
|
494
|
-
|
|
495
|
-
@Getter
|
|
496
|
-
@RequiredArgsConstructor
|
|
497
|
-
public enum TransactionElementType {
|
|
498
|
-
ASSET("資産"),
|
|
499
|
-
LIABILITY("負債"),
|
|
500
|
-
EQUITY("資本"),
|
|
501
|
-
REVENUE("収益"),
|
|
502
|
-
EXPENSE("費用");
|
|
503
|
-
|
|
504
|
-
private final String displayName;
|
|
505
|
-
|
|
506
|
-
public static TransactionElementType fromDisplayName(String displayName) {
|
|
507
|
-
for (TransactionElementType type : values()) {
|
|
508
|
-
if (type.displayName.equals(displayName)) {
|
|
509
|
-
return type;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
throw new IllegalArgumentException("不正な取引要素区分: " + displayName);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
</details>
|
|
518
|
-
|
|
519
|
-
<details>
|
|
520
|
-
<summary>AggregationType.java(集計区分)</summary>
|
|
521
|
-
|
|
522
|
-
```java
|
|
523
|
-
package com.example.accounting.domain.model.account;
|
|
524
|
-
|
|
525
|
-
import lombok.Getter;
|
|
526
|
-
import lombok.RequiredArgsConstructor;
|
|
527
|
-
|
|
528
|
-
@Getter
|
|
529
|
-
@RequiredArgsConstructor
|
|
530
|
-
public enum AggregationType {
|
|
531
|
-
HEADING("見出科目"),
|
|
532
|
-
SUMMARY("集計科目"),
|
|
533
|
-
POSTING("計上科目");
|
|
534
|
-
|
|
535
|
-
private final String displayName;
|
|
536
|
-
|
|
537
|
-
public static AggregationType fromDisplayName(String displayName) {
|
|
538
|
-
for (AggregationType type : values()) {
|
|
539
|
-
if (type.displayName.equals(displayName)) {
|
|
540
|
-
return type;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
throw new IllegalArgumentException("不正な集計区分: " + displayName);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
</details>
|
|
549
|
-
|
|
550
|
-
##### AttributeConverter(ENUM 変換)
|
|
551
|
-
|
|
552
|
-
JPA では `AttributeConverter` を使って PostgreSQL ENUM と Java Enum を変換します。MyBatis の TypeHandler に相当します。
|
|
553
|
-
|
|
554
|
-
<details>
|
|
555
|
-
<summary>BsPlTypeConverter.java</summary>
|
|
556
|
-
|
|
557
|
-
```java
|
|
558
|
-
package com.example.accounting.infrastructure.persistence.converter;
|
|
559
|
-
|
|
560
|
-
import com.example.accounting.domain.model.account.BsPlType;
|
|
561
|
-
import jakarta.persistence.AttributeConverter;
|
|
562
|
-
import jakarta.persistence.Converter;
|
|
563
|
-
|
|
564
|
-
@Converter(autoApply = true)
|
|
565
|
-
public class BsPlTypeConverter implements AttributeConverter<BsPlType, String> {
|
|
566
|
-
|
|
567
|
-
@Override
|
|
568
|
-
public String convertToDatabaseColumn(BsPlType attribute) {
|
|
569
|
-
return attribute != null ? attribute.getDisplayName() : null;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
@Override
|
|
573
|
-
public BsPlType convertToEntityAttribute(String dbData) {
|
|
574
|
-
return dbData != null ? BsPlType.fromDisplayName(dbData) : null;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
</details>
|
|
580
|
-
|
|
581
|
-
<details>
|
|
582
|
-
<summary>DebitCreditTypeConverter.java</summary>
|
|
583
|
-
|
|
584
|
-
```java
|
|
585
|
-
package com.example.accounting.infrastructure.persistence.converter;
|
|
586
|
-
|
|
587
|
-
import com.example.accounting.domain.model.account.DebitCreditType;
|
|
588
|
-
import jakarta.persistence.AttributeConverter;
|
|
589
|
-
import jakarta.persistence.Converter;
|
|
590
|
-
|
|
591
|
-
@Converter(autoApply = true)
|
|
592
|
-
public class DebitCreditTypeConverter implements AttributeConverter<DebitCreditType, String> {
|
|
593
|
-
|
|
594
|
-
@Override
|
|
595
|
-
public String convertToDatabaseColumn(DebitCreditType attribute) {
|
|
596
|
-
return attribute != null ? attribute.getDisplayName() : null;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
@Override
|
|
600
|
-
public DebitCreditType convertToEntityAttribute(String dbData) {
|
|
601
|
-
return dbData != null ? DebitCreditType.fromDisplayName(dbData) : null;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
</details>
|
|
607
|
-
|
|
608
|
-
<details>
|
|
609
|
-
<summary>TransactionElementTypeConverter.java</summary>
|
|
610
|
-
|
|
611
|
-
```java
|
|
612
|
-
package com.example.accounting.infrastructure.persistence.converter;
|
|
613
|
-
|
|
614
|
-
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
615
|
-
import jakarta.persistence.AttributeConverter;
|
|
616
|
-
import jakarta.persistence.Converter;
|
|
617
|
-
|
|
618
|
-
@Converter(autoApply = true)
|
|
619
|
-
public class TransactionElementTypeConverter implements AttributeConverter<TransactionElementType, String> {
|
|
620
|
-
|
|
621
|
-
@Override
|
|
622
|
-
public String convertToDatabaseColumn(TransactionElementType attribute) {
|
|
623
|
-
return attribute != null ? attribute.getDisplayName() : null;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
@Override
|
|
627
|
-
public TransactionElementType convertToEntityAttribute(String dbData) {
|
|
628
|
-
return dbData != null ? TransactionElementType.fromDisplayName(dbData) : null;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
</details>
|
|
634
|
-
|
|
635
|
-
<details>
|
|
636
|
-
<summary>AggregationTypeConverter.java</summary>
|
|
637
|
-
|
|
638
|
-
```java
|
|
639
|
-
package com.example.accounting.infrastructure.persistence.converter;
|
|
640
|
-
|
|
641
|
-
import com.example.accounting.domain.model.account.AggregationType;
|
|
642
|
-
import jakarta.persistence.AttributeConverter;
|
|
643
|
-
import jakarta.persistence.Converter;
|
|
644
|
-
|
|
645
|
-
@Converter(autoApply = true)
|
|
646
|
-
public class AggregationTypeConverter implements AttributeConverter<AggregationType, String> {
|
|
647
|
-
|
|
648
|
-
@Override
|
|
649
|
-
public String convertToDatabaseColumn(AggregationType attribute) {
|
|
650
|
-
return attribute != null ? attribute.getDisplayName() : null;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
@Override
|
|
654
|
-
public AggregationType convertToEntityAttribute(String dbData) {
|
|
655
|
-
return dbData != null ? AggregationType.fromDisplayName(dbData) : null;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
</details>
|
|
661
|
-
|
|
662
|
-
##### Repository インターフェース(Output Port)
|
|
663
|
-
|
|
664
|
-
<details>
|
|
665
|
-
<summary>AccountRepository.java</summary>
|
|
666
|
-
|
|
667
|
-
```java
|
|
668
|
-
package com.example.accounting.application.port.out;
|
|
669
|
-
|
|
670
|
-
import com.example.accounting.domain.model.account.Account;
|
|
671
|
-
import com.example.accounting.domain.model.account.AggregationType;
|
|
672
|
-
import com.example.accounting.domain.model.account.BsPlType;
|
|
673
|
-
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
674
|
-
|
|
675
|
-
import java.util.List;
|
|
676
|
-
import java.util.Optional;
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* 勘定科目リポジトリ(Output Port)
|
|
680
|
-
*/
|
|
681
|
-
public interface AccountRepository {
|
|
682
|
-
|
|
683
|
-
void save(Account account);
|
|
684
|
-
|
|
685
|
-
Optional<Account> findByCode(String accountCode);
|
|
686
|
-
|
|
687
|
-
List<Account> findAll();
|
|
688
|
-
|
|
689
|
-
List<Account> findByBsPlType(BsPlType bsPlType);
|
|
690
|
-
|
|
691
|
-
List<Account> findByAggregationType(AggregationType aggregationType);
|
|
692
|
-
|
|
693
|
-
List<Account> findByTransactionElementType(TransactionElementType type);
|
|
694
|
-
|
|
695
|
-
void update(Account account);
|
|
696
|
-
|
|
697
|
-
void deleteAll();
|
|
698
|
-
}
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
</details>
|
|
702
|
-
|
|
703
|
-
##### Spring Data JPA Repository
|
|
704
|
-
|
|
705
|
-
<details>
|
|
706
|
-
<summary>AccountJpaRepository.java</summary>
|
|
707
|
-
|
|
708
|
-
```java
|
|
709
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
710
|
-
|
|
711
|
-
import com.example.accounting.domain.model.account.Account;
|
|
712
|
-
import com.example.accounting.domain.model.account.AggregationType;
|
|
713
|
-
import com.example.accounting.domain.model.account.BsPlType;
|
|
714
|
-
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
715
|
-
import org.springframework.data.jpa.repository.JpaRepository;
|
|
716
|
-
import org.springframework.data.jpa.repository.Modifying;
|
|
717
|
-
import org.springframework.data.jpa.repository.Query;
|
|
718
|
-
import org.springframework.stereotype.Repository;
|
|
719
|
-
|
|
720
|
-
import java.util.List;
|
|
721
|
-
|
|
722
|
-
@Repository
|
|
723
|
-
public interface AccountJpaRepository extends JpaRepository<Account, String> {
|
|
724
|
-
|
|
725
|
-
List<Account> findByBsPlType(BsPlType bsPlType);
|
|
726
|
-
|
|
727
|
-
List<Account> findByAggregationType(AggregationType aggregationType);
|
|
728
|
-
|
|
729
|
-
List<Account> findByTransactionElementType(TransactionElementType transactionElementType);
|
|
730
|
-
|
|
731
|
-
List<Account> findAllByOrderByAccountCodeAsc();
|
|
732
|
-
|
|
733
|
-
@Modifying
|
|
734
|
-
@Query(value = "TRUNCATE TABLE \"勘定科目マスタ\" CASCADE", nativeQuery = true)
|
|
735
|
-
void truncateTable();
|
|
736
|
-
}
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
</details>
|
|
740
|
-
|
|
741
|
-
##### Repository 実装クラス(インフラストラクチャ層)
|
|
742
|
-
|
|
743
|
-
<details>
|
|
744
|
-
<summary>AccountRepositoryImpl.java</summary>
|
|
745
|
-
|
|
746
|
-
```java
|
|
747
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
748
|
-
|
|
749
|
-
import com.example.accounting.application.port.out.AccountRepository;
|
|
750
|
-
import com.example.accounting.domain.model.account.Account;
|
|
751
|
-
import com.example.accounting.domain.model.account.AggregationType;
|
|
752
|
-
import com.example.accounting.domain.model.account.BsPlType;
|
|
753
|
-
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
754
|
-
import lombok.RequiredArgsConstructor;
|
|
755
|
-
import org.springframework.stereotype.Repository;
|
|
756
|
-
import org.springframework.transaction.annotation.Transactional;
|
|
757
|
-
|
|
758
|
-
import java.util.List;
|
|
759
|
-
import java.util.Optional;
|
|
760
|
-
|
|
761
|
-
@Repository
|
|
762
|
-
@RequiredArgsConstructor
|
|
763
|
-
public class AccountRepositoryImpl implements AccountRepository {
|
|
764
|
-
|
|
765
|
-
private final AccountJpaRepository jpaRepository;
|
|
766
|
-
|
|
767
|
-
@Override
|
|
768
|
-
public void save(Account account) {
|
|
769
|
-
jpaRepository.save(account);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
@Override
|
|
773
|
-
public Optional<Account> findByCode(String accountCode) {
|
|
774
|
-
return jpaRepository.findById(accountCode);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
@Override
|
|
778
|
-
public List<Account> findAll() {
|
|
779
|
-
return jpaRepository.findAllByOrderByAccountCodeAsc();
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
@Override
|
|
783
|
-
public List<Account> findByBsPlType(BsPlType bsPlType) {
|
|
784
|
-
return jpaRepository.findByBsPlType(bsPlType);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
@Override
|
|
788
|
-
public List<Account> findByAggregationType(AggregationType aggregationType) {
|
|
789
|
-
return jpaRepository.findByAggregationType(aggregationType);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
@Override
|
|
793
|
-
public List<Account> findByTransactionElementType(TransactionElementType type) {
|
|
794
|
-
return jpaRepository.findByTransactionElementType(type);
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
@Override
|
|
798
|
-
public void update(Account account) {
|
|
799
|
-
jpaRepository.save(account);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
@Override
|
|
803
|
-
@Transactional
|
|
804
|
-
public void deleteAll() {
|
|
805
|
-
jpaRepository.truncateTable();
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
</details>
|
|
811
|
-
|
|
812
|
-
---
|
|
813
|
-
|
|
814
|
-
## 15.3 勘定科目構成マスタの設計
|
|
815
|
-
|
|
816
|
-
### チルダ連結方式による階層構造
|
|
817
|
-
|
|
818
|
-
勘定科目の階層構造を「チルダ(^)連結」で表現します。これにより、SQL の LIKE 検索で効率的に階層検索ができます。
|
|
819
|
-
|
|
820
|
-
```plantuml
|
|
821
|
-
@startwbs
|
|
822
|
-
title 貸借対照表の科目ツリー構造(部分)
|
|
823
|
-
|
|
824
|
-
* 貸借対照表
|
|
825
|
-
** 資産の部
|
|
826
|
-
*** 流動資産
|
|
827
|
-
**** 現金及び預金
|
|
828
|
-
***** 現金
|
|
829
|
-
***** 当座預金
|
|
830
|
-
***** 普通預金
|
|
831
|
-
*** 固定資産
|
|
832
|
-
**** 有形固定資産
|
|
833
|
-
***** 建物
|
|
834
|
-
***** 機械及び装置
|
|
835
|
-
** 負債の部
|
|
836
|
-
*** 流動負債
|
|
837
|
-
**** 支払手形
|
|
838
|
-
**** 買掛金
|
|
839
|
-
** 資本の部
|
|
840
|
-
*** 資本金
|
|
841
|
-
*** 利益剰余金
|
|
842
|
-
@endwbs
|
|
843
|
-
```
|
|
844
|
-
|
|
845
|
-
### 勘定科目構成マスタのデータ例
|
|
846
|
-
|
|
847
|
-
| 勘定科目コード | 勘定科目パス |
|
|
848
|
-
|-------------|-------------|
|
|
849
|
-
| 11 | 11 |
|
|
850
|
-
| 11000 | 11^11000 |
|
|
851
|
-
| 11190 | 11^11000^11190 |
|
|
852
|
-
| 11110 | 11^11000^11190^11110 |
|
|
853
|
-
| 11120 | 11^11000^11190^11120 |
|
|
854
|
-
| 11130 | 11^11000^11190^11130 |
|
|
855
|
-
|
|
856
|
-
### マイグレーション
|
|
857
|
-
|
|
858
|
-
<details>
|
|
859
|
-
<summary>V003__create_account_structure.sql</summary>
|
|
860
|
-
|
|
861
|
-
```sql
|
|
862
|
-
-- 勘定科目構成マスタ
|
|
863
|
-
CREATE TABLE "勘定科目構成マスタ" (
|
|
864
|
-
"勘定科目コード" VARCHAR(5) PRIMARY KEY REFERENCES "勘定科目マスタ"("勘定科目コード"),
|
|
865
|
-
"勘定科目パス" VARCHAR(100) NOT NULL,
|
|
866
|
-
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
867
|
-
"更新者名" VARCHAR(12)
|
|
868
|
-
);
|
|
869
|
-
|
|
870
|
-
-- インデックス(パス検索用)
|
|
871
|
-
CREATE INDEX idx_勘定科目構成マスタ_パス ON "勘定科目構成マスタ"("勘定科目パス");
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
</details>
|
|
875
|
-
|
|
876
|
-
### TDD による勘定科目構成マスタの実装
|
|
877
|
-
|
|
878
|
-
#### JPA エンティティ
|
|
879
|
-
|
|
880
|
-
<details>
|
|
881
|
-
<summary>AccountStructure.java</summary>
|
|
882
|
-
|
|
883
|
-
```java
|
|
884
|
-
package com.example.accounting.domain.model.account;
|
|
885
|
-
|
|
886
|
-
import jakarta.persistence.*;
|
|
887
|
-
import lombok.*;
|
|
888
|
-
import java.time.LocalDateTime;
|
|
889
|
-
|
|
890
|
-
@Entity
|
|
891
|
-
@Table(name = "勘定科目構成マスタ")
|
|
892
|
-
@Data
|
|
893
|
-
@Builder
|
|
894
|
-
@NoArgsConstructor
|
|
895
|
-
@AllArgsConstructor
|
|
896
|
-
public class AccountStructure {
|
|
897
|
-
|
|
898
|
-
@Id
|
|
899
|
-
@Column(name = "勘定科目コード", length = 5)
|
|
900
|
-
private String accountCode;
|
|
901
|
-
|
|
902
|
-
@Column(name = "勘定科目パス", length = 100, nullable = false)
|
|
903
|
-
private String accountPath;
|
|
904
|
-
|
|
905
|
-
@Column(name = "更新日時")
|
|
906
|
-
private LocalDateTime updatedAt;
|
|
907
|
-
|
|
908
|
-
@Column(name = "更新者名", length = 12)
|
|
909
|
-
private String updatedBy;
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* パスの深さ(階層レベル)を取得
|
|
913
|
-
*/
|
|
914
|
-
@Transient
|
|
915
|
-
public int getDepth() {
|
|
916
|
-
if (accountPath == null || accountPath.isEmpty()) {
|
|
917
|
-
return 0;
|
|
918
|
-
}
|
|
919
|
-
return accountPath.split("\\^").length - 1;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* 親科目コードを取得
|
|
924
|
-
*/
|
|
925
|
-
@Transient
|
|
926
|
-
public String getParentCode() {
|
|
927
|
-
if (accountPath == null || !accountPath.contains("^")) {
|
|
928
|
-
return null;
|
|
929
|
-
}
|
|
930
|
-
String[] parts = accountPath.split("\\^");
|
|
931
|
-
if (parts.length < 2) {
|
|
932
|
-
return null;
|
|
933
|
-
}
|
|
934
|
-
return parts[parts.length - 2];
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
@PrePersist
|
|
938
|
-
@PreUpdate
|
|
939
|
-
protected void onUpdate() {
|
|
940
|
-
updatedAt = LocalDateTime.now();
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
```
|
|
944
|
-
|
|
945
|
-
</details>
|
|
946
|
-
|
|
947
|
-
#### Repository インターフェース(Output Port)
|
|
948
|
-
|
|
949
|
-
<details>
|
|
950
|
-
<summary>AccountStructureRepository.java</summary>
|
|
951
|
-
|
|
952
|
-
```java
|
|
953
|
-
package com.example.accounting.application.port.out;
|
|
954
|
-
|
|
955
|
-
import com.example.accounting.domain.model.account.AccountStructure;
|
|
956
|
-
|
|
957
|
-
import java.util.List;
|
|
958
|
-
import java.util.Optional;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* 勘定科目構成リポジトリ(Output Port)
|
|
962
|
-
*/
|
|
963
|
-
public interface AccountStructureRepository {
|
|
964
|
-
|
|
965
|
-
void save(AccountStructure structure);
|
|
966
|
-
|
|
967
|
-
Optional<AccountStructure> findByCode(String accountCode);
|
|
968
|
-
|
|
969
|
-
List<AccountStructure> findAll();
|
|
970
|
-
|
|
971
|
-
List<AccountStructure> findByPathContaining(String pathSegment);
|
|
972
|
-
|
|
973
|
-
List<AccountStructure> findChildren(String parentCode);
|
|
974
|
-
|
|
975
|
-
void update(AccountStructure structure);
|
|
976
|
-
|
|
977
|
-
void deleteAll();
|
|
978
|
-
}
|
|
979
|
-
```
|
|
980
|
-
|
|
981
|
-
</details>
|
|
982
|
-
|
|
983
|
-
#### Spring Data JPA Repository
|
|
984
|
-
|
|
985
|
-
<details>
|
|
986
|
-
<summary>AccountStructureJpaRepository.java</summary>
|
|
987
|
-
|
|
988
|
-
```java
|
|
989
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
990
|
-
|
|
991
|
-
import com.example.accounting.domain.model.account.AccountStructure;
|
|
992
|
-
import org.springframework.data.jpa.repository.JpaRepository;
|
|
993
|
-
import org.springframework.data.jpa.repository.Modifying;
|
|
994
|
-
import org.springframework.data.jpa.repository.Query;
|
|
995
|
-
import org.springframework.data.repository.query.Param;
|
|
996
|
-
import org.springframework.stereotype.Repository;
|
|
997
|
-
|
|
998
|
-
import java.util.List;
|
|
999
|
-
|
|
1000
|
-
@Repository
|
|
1001
|
-
public interface AccountStructureJpaRepository extends JpaRepository<AccountStructure, String> {
|
|
1002
|
-
|
|
1003
|
-
List<AccountStructure> findAllByOrderByAccountCodeAsc();
|
|
1004
|
-
|
|
1005
|
-
@Query("SELECT s FROM AccountStructure s WHERE s.accountPath LIKE %:pathSegment% ORDER BY s.accountCode")
|
|
1006
|
-
List<AccountStructure> findByAccountPathContaining(@Param("pathSegment") String pathSegment);
|
|
1007
|
-
|
|
1008
|
-
@Query("SELECT s FROM AccountStructure s WHERE s.accountPath LIKE :parentCode% ORDER BY s.accountCode")
|
|
1009
|
-
List<AccountStructure> findChildrenByParentCode(@Param("parentCode") String parentCode);
|
|
1010
|
-
|
|
1011
|
-
@Modifying
|
|
1012
|
-
@Query(value = "TRUNCATE TABLE \"勘定科目構成マスタ\" CASCADE", nativeQuery = true)
|
|
1013
|
-
void truncateTable();
|
|
1014
|
-
}
|
|
1015
|
-
```
|
|
1016
|
-
|
|
1017
|
-
</details>
|
|
1018
|
-
|
|
1019
|
-
#### Repository 実装クラス
|
|
1020
|
-
|
|
1021
|
-
<details>
|
|
1022
|
-
<summary>AccountStructureRepositoryImpl.java</summary>
|
|
1023
|
-
|
|
1024
|
-
```java
|
|
1025
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
1026
|
-
|
|
1027
|
-
import com.example.accounting.application.port.out.AccountStructureRepository;
|
|
1028
|
-
import com.example.accounting.domain.model.account.AccountStructure;
|
|
1029
|
-
import lombok.RequiredArgsConstructor;
|
|
1030
|
-
import org.springframework.stereotype.Repository;
|
|
1031
|
-
import org.springframework.transaction.annotation.Transactional;
|
|
1032
|
-
|
|
1033
|
-
import java.util.List;
|
|
1034
|
-
import java.util.Optional;
|
|
1035
|
-
|
|
1036
|
-
@Repository
|
|
1037
|
-
@RequiredArgsConstructor
|
|
1038
|
-
public class AccountStructureRepositoryImpl implements AccountStructureRepository {
|
|
1039
|
-
|
|
1040
|
-
private final AccountStructureJpaRepository jpaRepository;
|
|
1041
|
-
|
|
1042
|
-
@Override
|
|
1043
|
-
public void save(AccountStructure structure) {
|
|
1044
|
-
jpaRepository.save(structure);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
@Override
|
|
1048
|
-
public Optional<AccountStructure> findByCode(String accountCode) {
|
|
1049
|
-
return jpaRepository.findById(accountCode);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
@Override
|
|
1053
|
-
public List<AccountStructure> findAll() {
|
|
1054
|
-
return jpaRepository.findAllByOrderByAccountCodeAsc();
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
@Override
|
|
1058
|
-
public List<AccountStructure> findByPathContaining(String pathSegment) {
|
|
1059
|
-
return jpaRepository.findByAccountPathContaining(pathSegment);
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
@Override
|
|
1063
|
-
public List<AccountStructure> findChildren(String parentCode) {
|
|
1064
|
-
return jpaRepository.findChildrenByParentCode(parentCode + "^");
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
@Override
|
|
1068
|
-
public void update(AccountStructure structure) {
|
|
1069
|
-
jpaRepository.save(structure);
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
@Override
|
|
1073
|
-
@Transactional
|
|
1074
|
-
public void deleteAll() {
|
|
1075
|
-
jpaRepository.truncateTable();
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
```
|
|
1079
|
-
|
|
1080
|
-
</details>
|
|
1081
|
-
|
|
1082
|
-
---
|
|
1083
|
-
|
|
1084
|
-
## 15.4 課税取引マスタの設計
|
|
1085
|
-
|
|
1086
|
-
### 課税取引コード・税率の管理
|
|
1087
|
-
|
|
1088
|
-
課税取引マスタは、消費税の税率情報を管理するマスタテーブルです。
|
|
1089
|
-
|
|
1090
|
-
| 課税取引コード | 課税取引名 | 税率 |
|
|
1091
|
-
|-------------|-----------|------|
|
|
1092
|
-
| 00 | 非課税 | 0.000 |
|
|
1093
|
-
| 08 | 軽減税率 | 0.080 |
|
|
1094
|
-
| 10 | 標準税率 | 0.100 |
|
|
1095
|
-
|
|
1096
|
-
### TDD による課税取引マスタの実装
|
|
1097
|
-
|
|
1098
|
-
#### JPA エンティティ
|
|
1099
|
-
|
|
1100
|
-
<details>
|
|
1101
|
-
<summary>TaxTransaction.java</summary>
|
|
1102
|
-
|
|
1103
|
-
```java
|
|
1104
|
-
package com.example.accounting.domain.model.tax;
|
|
1105
|
-
|
|
1106
|
-
import jakarta.persistence.*;
|
|
1107
|
-
import lombok.*;
|
|
1108
|
-
import java.math.BigDecimal;
|
|
1109
|
-
import java.time.LocalDateTime;
|
|
1110
|
-
|
|
1111
|
-
@Entity
|
|
1112
|
-
@Table(name = "課税取引マスタ")
|
|
1113
|
-
@Data
|
|
1114
|
-
@Builder
|
|
1115
|
-
@NoArgsConstructor
|
|
1116
|
-
@AllArgsConstructor
|
|
1117
|
-
public class TaxTransaction {
|
|
1118
|
-
|
|
1119
|
-
@Id
|
|
1120
|
-
@Column(name = "課税取引コード", length = 2)
|
|
1121
|
-
private String taxCode;
|
|
1122
|
-
|
|
1123
|
-
@Column(name = "課税取引名", length = 20, nullable = false)
|
|
1124
|
-
private String taxName;
|
|
1125
|
-
|
|
1126
|
-
@Builder.Default
|
|
1127
|
-
@Column(name = "税率", precision = 5, scale = 3, nullable = false)
|
|
1128
|
-
private BigDecimal taxRate = new BigDecimal("0.10");
|
|
1129
|
-
|
|
1130
|
-
@Column(name = "更新日時")
|
|
1131
|
-
private LocalDateTime updatedAt;
|
|
1132
|
-
|
|
1133
|
-
@Column(name = "更新者名", length = 12)
|
|
1134
|
-
private String updatedBy;
|
|
1135
|
-
|
|
1136
|
-
/**
|
|
1137
|
-
* 税込金額を計算
|
|
1138
|
-
*/
|
|
1139
|
-
public BigDecimal calculateTaxIncludedAmount(BigDecimal amount) {
|
|
1140
|
-
return amount.add(amount.multiply(taxRate));
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
/**
|
|
1144
|
-
* 消費税額を計算
|
|
1145
|
-
*/
|
|
1146
|
-
public BigDecimal calculateTaxAmount(BigDecimal amount) {
|
|
1147
|
-
return amount.multiply(taxRate);
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
@PrePersist
|
|
1151
|
-
@PreUpdate
|
|
1152
|
-
protected void onUpdate() {
|
|
1153
|
-
updatedAt = LocalDateTime.now();
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
```
|
|
1157
|
-
|
|
1158
|
-
</details>
|
|
1159
|
-
|
|
1160
|
-
#### Spring Data JPA Repository
|
|
1161
|
-
|
|
1162
|
-
<details>
|
|
1163
|
-
<summary>TaxTransactionJpaRepository.java</summary>
|
|
1164
|
-
|
|
1165
|
-
```java
|
|
1166
|
-
package com.example.accounting.infrastructure.persistence.repository;
|
|
1167
|
-
|
|
1168
|
-
import com.example.accounting.domain.model.tax.TaxTransaction;
|
|
1169
|
-
import org.springframework.data.jpa.repository.JpaRepository;
|
|
1170
|
-
import org.springframework.data.jpa.repository.Modifying;
|
|
1171
|
-
import org.springframework.data.jpa.repository.Query;
|
|
1172
|
-
import org.springframework.stereotype.Repository;
|
|
1173
|
-
|
|
1174
|
-
import java.util.List;
|
|
1175
|
-
|
|
1176
|
-
@Repository
|
|
1177
|
-
public interface TaxTransactionJpaRepository extends JpaRepository<TaxTransaction, String> {
|
|
1178
|
-
|
|
1179
|
-
List<TaxTransaction> findAllByOrderByTaxCodeAsc();
|
|
1180
|
-
|
|
1181
|
-
@Modifying
|
|
1182
|
-
@Query(value = "TRUNCATE TABLE \"課税取引マスタ\" CASCADE", nativeQuery = true)
|
|
1183
|
-
void truncateTable();
|
|
1184
|
-
}
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
</details>
|
|
1188
|
-
|
|
1189
|
-
---
|
|
1190
|
-
|
|
1191
|
-
## 15.5 MyBatis 版との比較
|
|
1192
|
-
|
|
1193
|
-
### 実装の違い
|
|
1194
|
-
|
|
1195
|
-
| 観点 | MyBatis 版 | JPA 版 |
|
|
1196
|
-
|------|-----------|--------|
|
|
1197
|
-
| マッピング | XML Mapper + resultMap | @Entity + @Column |
|
|
1198
|
-
| ENUM 変換 | TypeHandler | AttributeConverter |
|
|
1199
|
-
| Repository | Mapper インターフェース + XML | JpaRepository インターフェース |
|
|
1200
|
-
| SQL | XML で明示的に記述 | メソッド名規約で自動生成 |
|
|
1201
|
-
| トランザクション管理 | 明示的に記述 | @Transactional |
|
|
1202
|
-
| TRUNCATE | XML で定義 | @Query(nativeQuery) |
|
|
1203
|
-
|
|
1204
|
-
### コード量の比較
|
|
1205
|
-
|
|
1206
|
-
| 項目 | MyBatis 版 | JPA 版 |
|
|
1207
|
-
|------|-----------|--------|
|
|
1208
|
-
| エンティティ | POJO(アノテーションなし) | @Entity + @Column |
|
|
1209
|
-
| ENUM 変換 | TypeHandler(各4クラス) | AttributeConverter(各4クラス) |
|
|
1210
|
-
| Mapper/Repository | Mapper + XML | JpaRepository インターフェースのみ |
|
|
1211
|
-
| SQL | XML で全て記述 | メソッド名規約 + @Query |
|
|
1212
|
-
|
|
1213
|
-
---
|
|
1214
|
-
|
|
1215
|
-
## 第15章のまとめ
|
|
1216
|
-
|
|
1217
|
-
### 作成したテーブル
|
|
1218
|
-
|
|
1219
|
-
| テーブル名 | 説明 |
|
|
1220
|
-
|----------|------|
|
|
1221
|
-
| `課税取引マスタ` | 消費税の税率情報を管理 |
|
|
1222
|
-
| `勘定科目マスタ` | 勘定科目の基本情報を管理 |
|
|
1223
|
-
| `勘定科目構成マスタ` | 勘定科目の階層構造をチルダ連結で管理 |
|
|
1224
|
-
|
|
1225
|
-
### ER図
|
|
1226
|
-
|
|
1227
|
-
```plantuml
|
|
1228
|
-
@startuml
|
|
1229
|
-
|
|
1230
|
-
title 勘定科目関連 ER図
|
|
1231
|
-
|
|
1232
|
-
entity 課税取引マスタ {
|
|
1233
|
-
課税取引コード <<PK>>
|
|
1234
|
-
--
|
|
1235
|
-
課税取引名
|
|
1236
|
-
税率
|
|
1237
|
-
更新日時
|
|
1238
|
-
更新者名
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
entity 勘定科目マスタ {
|
|
1242
|
-
勘定科目コード <<PK>>
|
|
1243
|
-
--
|
|
1244
|
-
勘定科目名
|
|
1245
|
-
勘定科目略名
|
|
1246
|
-
勘定科目カナ
|
|
1247
|
-
BSPL区分
|
|
1248
|
-
貸借区分
|
|
1249
|
-
取引要素区分
|
|
1250
|
-
集計区分
|
|
1251
|
-
管理会計区分
|
|
1252
|
-
費用区分
|
|
1253
|
-
元帳出力区分
|
|
1254
|
-
補助科目種別
|
|
1255
|
-
消費税計算区分
|
|
1256
|
-
課税取引コード <<FK>>
|
|
1257
|
-
期日管理区分
|
|
1258
|
-
...
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
entity 勘定科目構成マスタ {
|
|
1262
|
-
勘定科目コード <<PK,FK>>
|
|
1263
|
-
--
|
|
1264
|
-
勘定科目パス
|
|
1265
|
-
更新日時
|
|
1266
|
-
更新者名
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
勘定科目マスタ }o..|| 課税取引マスタ
|
|
1270
|
-
勘定科目マスタ ||--|| 勘定科目構成マスタ
|
|
1271
|
-
|
|
1272
|
-
@enduml
|
|
1273
|
-
```
|
|
1274
|
-
|
|
1275
|
-
### 設計のポイント
|
|
1276
|
-
|
|
1277
|
-
1. **ENUM 型の活用**: BSPL区分、貸借区分、取引要素区分、集計区分で型安全性を確保
|
|
1278
|
-
2. **日本語 DB / 英語 Java**: テーブル・カラムは日本語、Java コードは英語で統一
|
|
1279
|
-
3. **AttributeConverter**: Java Enum と日本語 ENUM 値の変換を JPA AttributeConverter で実装
|
|
1280
|
-
4. **チルダ連結方式**: 勘定科目構成マスタで階層構造を表現し、JPQL の LIKE 検索で効率的に階層検索
|
|
1281
|
-
5. **ヘキサゴナルアーキテクチャ**: ドメイン層がインフラに依存しない設計
|
|
1282
|
-
6. **JpaRepository**: メソッド名規約による自動 SQL 生成
|
|
1283
|
-
|
|
1284
|
-
### 命名規則
|
|
1285
|
-
|
|
1286
|
-
| 要素 | 言語 | 例 |
|
|
1287
|
-
|------|------|-----|
|
|
1288
|
-
| **テーブル名** | 日本語 | `"勘定科目マスタ"`, `"課税取引マスタ"` |
|
|
1289
|
-
| **カラム名** | 日本語 | `"勘定科目コード"`, `"勘定科目名"` |
|
|
1290
|
-
| **ENUM 型** | 日本語 | `BSPL区分`, `貸借区分` |
|
|
1291
|
-
| **ENUM 値** | 日本語 | `'BS'`, `'借方'` |
|
|
1292
|
-
| **Java クラス名** | 英語 | `Account`, `AccountStructure` |
|
|
1293
|
-
| **Java フィールド名** | 英語 | `accountCode`, `accountName` |
|
|
1294
|
-
| **JPA @Column** | 日本語カラム指定 | `@Column(name = "勘定科目コード")` |
|
|
1295
|
-
|
|
1296
|
-
---
|
|
1297
|
-
|
|
1298
|
-
## 次章の予告
|
|
1299
|
-
|
|
1300
|
-
第16章では、仕訳テーブルの設計に進みます。複式簿記の基本構造である「借方・貸方」の仕訳データを JPA で実装していきます。@EmbeddedId を使った複合主キーや @ManyToOne によるリレーションも解説します。
|
|
1
|
+
# 第15章:勘定科目の設計(ORM版)
|
|
2
|
+
|
|
3
|
+
財務会計システムの根幹となる勘定科目マスタを Spring Data JPA で設計します。本章では、TDD(テスト駆動開発)を用いて勘定科目マスタ、勘定科目構成マスタ、課税取引マスタを JPA エンティティとして実装していきます。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 15.1 勘定科目マスタの設計
|
|
8
|
+
|
|
9
|
+
### 勘定科目の区分体系
|
|
10
|
+
|
|
11
|
+
勘定科目は複数の区分で分類されます。これらの区分を正しく理解することが、財務会計システム設計の基礎となります。
|
|
12
|
+
|
|
13
|
+
```plantuml
|
|
14
|
+
@startuml
|
|
15
|
+
|
|
16
|
+
title 勘定科目の区分体系
|
|
17
|
+
|
|
18
|
+
package "BSPL区分" {
|
|
19
|
+
rectangle "BS(貸借対照表)" as BS #LightBlue
|
|
20
|
+
rectangle "PL(損益計算書)" as PL #LightGreen
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
package "貸借区分" {
|
|
24
|
+
rectangle "借方" as Debit #LightYellow
|
|
25
|
+
rectangle "貸方" as Credit #LightPink
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
package "取引要素区分" {
|
|
29
|
+
rectangle "資産" as Asset
|
|
30
|
+
rectangle "負債" as Liability
|
|
31
|
+
rectangle "資本" as Equity
|
|
32
|
+
rectangle "収益" as Revenue
|
|
33
|
+
rectangle "費用" as Expense
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
package "集計区分" {
|
|
37
|
+
rectangle "見出科目" as Header
|
|
38
|
+
rectangle "集計科目" as Summary
|
|
39
|
+
rectangle "計上科目" as Posting
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BS --> Asset : 借方
|
|
43
|
+
BS --> Liability : 貸方
|
|
44
|
+
BS --> Equity : 貸方
|
|
45
|
+
PL --> Revenue : 貸方
|
|
46
|
+
PL --> Expense : 借方
|
|
47
|
+
|
|
48
|
+
@enduml
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### 区分の説明
|
|
52
|
+
|
|
53
|
+
| 区分 | 説明 | 値の例 |
|
|
54
|
+
|-----|------|-------|
|
|
55
|
+
| **BSPL区分** | 貸借対照表(BS)か損益計算書(PL)か | `BS`, `PL` |
|
|
56
|
+
| **貸借区分** | 借方科目か貸方科目か | `借方`, `貸方` |
|
|
57
|
+
| **取引要素区分** | 5つの取引要素のどれに該当するか | `資産`, `負債`, `資本`, `収益`, `費用` |
|
|
58
|
+
| **集計区分** | 科目の性質(見出し/集計/計上) | `見出科目`, `集計科目`, `計上科目` |
|
|
59
|
+
|
|
60
|
+
#### 取引要素と貸借区分の関係
|
|
61
|
+
|
|
62
|
+
複式簿記では、取引要素によって借方・貸方が決まります。
|
|
63
|
+
|
|
64
|
+
| 取引要素 | BSPL区分 | 増加時の貸借 | 減少時の貸借 |
|
|
65
|
+
|---------|---------|------------|------------|
|
|
66
|
+
| 資産 | BS | 借方 | 貸方 |
|
|
67
|
+
| 負債 | BS | 貸方 | 借方 |
|
|
68
|
+
| 資本 | BS | 貸方 | 借方 |
|
|
69
|
+
| 収益 | PL | 貸方 | 借方 |
|
|
70
|
+
| 費用 | PL | 借方 | 貸方 |
|
|
71
|
+
|
|
72
|
+
### 勘定科目マスタのER図
|
|
73
|
+
|
|
74
|
+
```plantuml
|
|
75
|
+
@startuml
|
|
76
|
+
|
|
77
|
+
title 勘定科目マスタ
|
|
78
|
+
|
|
79
|
+
entity 勘定科目マスタ {
|
|
80
|
+
勘定科目コード <<PK>>
|
|
81
|
+
--
|
|
82
|
+
勘定科目名
|
|
83
|
+
勘定科目略名
|
|
84
|
+
勘定科目カナ
|
|
85
|
+
BSPL区分
|
|
86
|
+
貸借区分
|
|
87
|
+
取引要素区分
|
|
88
|
+
集計区分
|
|
89
|
+
管理会計区分
|
|
90
|
+
費用区分
|
|
91
|
+
元帳出力区分
|
|
92
|
+
補助科目種別
|
|
93
|
+
消費税計算区分
|
|
94
|
+
課税取引コード <<FK>>
|
|
95
|
+
期日管理区分
|
|
96
|
+
作成日時
|
|
97
|
+
更新日時
|
|
98
|
+
更新者名
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
entity 課税取引マスタ {
|
|
102
|
+
課税取引コード <<PK>>
|
|
103
|
+
--
|
|
104
|
+
課税取引名
|
|
105
|
+
税率
|
|
106
|
+
更新日時
|
|
107
|
+
更新者名
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
勘定科目マスタ }o..|| 課税取引マスタ
|
|
111
|
+
|
|
112
|
+
@enduml
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### マイグレーション:ENUM型とテーブルの作成
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary>V001__create_enum_types.sql</summary>
|
|
119
|
+
|
|
120
|
+
```sql
|
|
121
|
+
-- BSPL区分(貸借対照表・損益計算書)
|
|
122
|
+
CREATE TYPE BSPL区分 AS ENUM ('BS', 'PL');
|
|
123
|
+
|
|
124
|
+
-- 貸借区分
|
|
125
|
+
CREATE TYPE 貸借区分 AS ENUM ('借方', '貸方');
|
|
126
|
+
|
|
127
|
+
-- 取引要素区分
|
|
128
|
+
CREATE TYPE 取引要素区分 AS ENUM ('資産', '負債', '資本', '収益', '費用');
|
|
129
|
+
|
|
130
|
+
-- 集計区分
|
|
131
|
+
CREATE TYPE 集計区分 AS ENUM ('見出科目', '集計科目', '計上科目');
|
|
132
|
+
|
|
133
|
+
-- 消費税計算区分
|
|
134
|
+
CREATE TYPE 消費税計算区分 AS ENUM ('課税', '非課税', '不課税', '免税');
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
</details>
|
|
138
|
+
|
|
139
|
+
<details>
|
|
140
|
+
<summary>V002__create_account_master.sql</summary>
|
|
141
|
+
|
|
142
|
+
```sql
|
|
143
|
+
-- 課税取引マスタ
|
|
144
|
+
CREATE TABLE "課税取引マスタ" (
|
|
145
|
+
"課税取引コード" VARCHAR(2) PRIMARY KEY,
|
|
146
|
+
"課税取引名" VARCHAR(20) NOT NULL,
|
|
147
|
+
"税率" DECIMAL(5,3) NOT NULL DEFAULT 0.10,
|
|
148
|
+
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
149
|
+
"更新者名" VARCHAR(12)
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
-- 勘定科目マスタ
|
|
153
|
+
CREATE TABLE "勘定科目マスタ" (
|
|
154
|
+
"勘定科目コード" VARCHAR(5) PRIMARY KEY,
|
|
155
|
+
"勘定科目名" VARCHAR(40) NOT NULL,
|
|
156
|
+
"勘定科目略名" VARCHAR(10),
|
|
157
|
+
"勘定科目カナ" VARCHAR(40),
|
|
158
|
+
"BSPL区分" BSPL区分 NOT NULL,
|
|
159
|
+
"貸借区分" 貸借区分 NOT NULL,
|
|
160
|
+
"取引要素区分" 取引要素区分 NOT NULL,
|
|
161
|
+
"集計区分" 集計区分 NOT NULL,
|
|
162
|
+
"管理会計区分" VARCHAR(1),
|
|
163
|
+
"費用区分" VARCHAR(1),
|
|
164
|
+
"元帳出力区分" VARCHAR(1),
|
|
165
|
+
"補助科目種別" VARCHAR(1),
|
|
166
|
+
"消費税計算区分" 消費税計算区分,
|
|
167
|
+
"課税取引コード" VARCHAR(2) REFERENCES "課税取引マスタ"("課税取引コード"),
|
|
168
|
+
"期日管理区分" VARCHAR(1),
|
|
169
|
+
"作成日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
170
|
+
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
171
|
+
"更新者名" VARCHAR(12)
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
-- インデックス
|
|
175
|
+
CREATE INDEX idx_勘定科目マスタ_BSPL区分 ON "勘定科目マスタ"("BSPL区分");
|
|
176
|
+
CREATE INDEX idx_勘定科目マスタ_取引要素区分 ON "勘定科目マスタ"("取引要素区分");
|
|
177
|
+
CREATE INDEX idx_勘定科目マスタ_集計区分 ON "勘定科目マスタ"("集計区分");
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
</details>
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 15.2 JPA エンティティの実装
|
|
185
|
+
|
|
186
|
+
### TDD による勘定科目マスタの実装
|
|
187
|
+
|
|
188
|
+
#### Red: 失敗するテストを書く
|
|
189
|
+
|
|
190
|
+
<details>
|
|
191
|
+
<summary>勘定科目リポジトリテスト</summary>
|
|
192
|
+
|
|
193
|
+
```java
|
|
194
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
195
|
+
|
|
196
|
+
import com.example.accounting.application.port.out.AccountRepository;
|
|
197
|
+
import com.example.accounting.domain.model.account.*;
|
|
198
|
+
import com.example.accounting.testsetup.BaseIntegrationTest;
|
|
199
|
+
import org.junit.jupiter.api.*;
|
|
200
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
|
201
|
+
|
|
202
|
+
import static org.assertj.core.api.Assertions.*;
|
|
203
|
+
|
|
204
|
+
@DisplayName("勘定科目リポジトリ")
|
|
205
|
+
class AccountRepositoryTest extends BaseIntegrationTest {
|
|
206
|
+
|
|
207
|
+
@Autowired
|
|
208
|
+
private AccountRepository accountRepository;
|
|
209
|
+
|
|
210
|
+
@BeforeEach
|
|
211
|
+
void setUp() {
|
|
212
|
+
accountRepository.deleteAll();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@Nested
|
|
216
|
+
@DisplayName("登録")
|
|
217
|
+
class Registration {
|
|
218
|
+
|
|
219
|
+
@Test
|
|
220
|
+
@DisplayName("勘定科目を登録できる")
|
|
221
|
+
void canRegisterAccount() {
|
|
222
|
+
// Arrange
|
|
223
|
+
var account = Account.builder()
|
|
224
|
+
.accountCode("11110")
|
|
225
|
+
.accountName("現金")
|
|
226
|
+
.accountShortName("現金")
|
|
227
|
+
.bsPlType(BsPlType.BS)
|
|
228
|
+
.debitCreditType(DebitCreditType.DEBIT)
|
|
229
|
+
.transactionElementType(TransactionElementType.ASSET)
|
|
230
|
+
.aggregationType(AggregationType.POSTING)
|
|
231
|
+
.build();
|
|
232
|
+
|
|
233
|
+
// Act
|
|
234
|
+
accountRepository.save(account);
|
|
235
|
+
|
|
236
|
+
// Assert
|
|
237
|
+
var result = accountRepository.findByCode("11110");
|
|
238
|
+
assertThat(result).isPresent();
|
|
239
|
+
assertThat(result.get().getAccountName()).isEqualTo("現金");
|
|
240
|
+
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.BS);
|
|
241
|
+
assertThat(result.get().getDebitCreditType()).isEqualTo(DebitCreditType.DEBIT);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@Test
|
|
245
|
+
@DisplayName("貸借対照表の資産科目を登録できる")
|
|
246
|
+
void canRegisterBSAssetAccount() {
|
|
247
|
+
var account = createAccount("11000", "流動資産", BsPlType.BS,
|
|
248
|
+
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.SUMMARY);
|
|
249
|
+
accountRepository.save(account);
|
|
250
|
+
|
|
251
|
+
var result = accountRepository.findByCode("11000");
|
|
252
|
+
assertThat(result).isPresent();
|
|
253
|
+
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.BS);
|
|
254
|
+
assertThat(result.get().getTransactionElementType()).isEqualTo(TransactionElementType.ASSET);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@Test
|
|
258
|
+
@DisplayName("損益計算書の収益科目を登録できる")
|
|
259
|
+
void canRegisterPLRevenueAccount() {
|
|
260
|
+
var account = createAccount("41000", "売上高", BsPlType.PL,
|
|
261
|
+
DebitCreditType.CREDIT, TransactionElementType.REVENUE, AggregationType.SUMMARY);
|
|
262
|
+
accountRepository.save(account);
|
|
263
|
+
|
|
264
|
+
var result = accountRepository.findByCode("41000");
|
|
265
|
+
assertThat(result).isPresent();
|
|
266
|
+
assertThat(result.get().getBsPlType()).isEqualTo(BsPlType.PL);
|
|
267
|
+
assertThat(result.get().getTransactionElementType()).isEqualTo(TransactionElementType.REVENUE);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@Nested
|
|
272
|
+
@DisplayName("集計区分")
|
|
273
|
+
class AggregationTypes {
|
|
274
|
+
|
|
275
|
+
@Test
|
|
276
|
+
@DisplayName("見出科目を登録できる")
|
|
277
|
+
void canRegisterHeaderAccount() {
|
|
278
|
+
var account = createAccount("11", "(資産の部)", BsPlType.BS,
|
|
279
|
+
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.HEADING);
|
|
280
|
+
accountRepository.save(account);
|
|
281
|
+
|
|
282
|
+
var result = accountRepository.findByCode("11");
|
|
283
|
+
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.HEADING);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@Test
|
|
287
|
+
@DisplayName("集計科目を登録できる")
|
|
288
|
+
void canRegisterSummaryAccount() {
|
|
289
|
+
var account = createAccount("11190", "現金及び預金", BsPlType.BS,
|
|
290
|
+
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.SUMMARY);
|
|
291
|
+
accountRepository.save(account);
|
|
292
|
+
|
|
293
|
+
var result = accountRepository.findByCode("11190");
|
|
294
|
+
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.SUMMARY);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@Test
|
|
298
|
+
@DisplayName("計上科目を登録できる")
|
|
299
|
+
void canRegisterPostingAccount() {
|
|
300
|
+
var account = createAccount("11110", "現金", BsPlType.BS,
|
|
301
|
+
DebitCreditType.DEBIT, TransactionElementType.ASSET, AggregationType.POSTING);
|
|
302
|
+
accountRepository.save(account);
|
|
303
|
+
|
|
304
|
+
var result = accountRepository.findByCode("11110");
|
|
305
|
+
assertThat(result.get().getAggregationType()).isEqualTo(AggregationType.POSTING);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
private Account createAccount(String code, String name, BsPlType bsPlType,
|
|
310
|
+
DebitCreditType debitCreditType, TransactionElementType transactionElementType,
|
|
311
|
+
AggregationType aggregationType) {
|
|
312
|
+
return Account.builder()
|
|
313
|
+
.accountCode(code)
|
|
314
|
+
.accountName(name)
|
|
315
|
+
.bsPlType(bsPlType)
|
|
316
|
+
.debitCreditType(debitCreditType)
|
|
317
|
+
.transactionElementType(transactionElementType)
|
|
318
|
+
.aggregationType(aggregationType)
|
|
319
|
+
.build();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
</details>
|
|
325
|
+
|
|
326
|
+
#### Green: テストを通す実装
|
|
327
|
+
|
|
328
|
+
##### ドメイン層(JPA エンティティ)
|
|
329
|
+
|
|
330
|
+
<details>
|
|
331
|
+
<summary>Account.java(勘定科目エンティティ)</summary>
|
|
332
|
+
|
|
333
|
+
```java
|
|
334
|
+
package com.example.accounting.domain.model.account;
|
|
335
|
+
|
|
336
|
+
import com.example.accounting.infrastructure.persistence.converter.*;
|
|
337
|
+
import jakarta.persistence.*;
|
|
338
|
+
import lombok.*;
|
|
339
|
+
import java.time.LocalDateTime;
|
|
340
|
+
|
|
341
|
+
@Entity
|
|
342
|
+
@Table(name = "勘定科目マスタ")
|
|
343
|
+
@Data
|
|
344
|
+
@Builder
|
|
345
|
+
@NoArgsConstructor
|
|
346
|
+
@AllArgsConstructor
|
|
347
|
+
public class Account {
|
|
348
|
+
|
|
349
|
+
@Id
|
|
350
|
+
@Column(name = "勘定科目コード", length = 5)
|
|
351
|
+
private String accountCode;
|
|
352
|
+
|
|
353
|
+
@Column(name = "勘定科目名", length = 40, nullable = false)
|
|
354
|
+
private String accountName;
|
|
355
|
+
|
|
356
|
+
@Column(name = "勘定科目略名", length = 10)
|
|
357
|
+
private String accountShortName;
|
|
358
|
+
|
|
359
|
+
@Column(name = "勘定科目カナ", length = 40)
|
|
360
|
+
private String accountNameKana;
|
|
361
|
+
|
|
362
|
+
@Convert(converter = BsPlTypeConverter.class)
|
|
363
|
+
@Column(name = "BSPL区分", nullable = false, columnDefinition = "BSPL区分")
|
|
364
|
+
private BsPlType bsPlType;
|
|
365
|
+
|
|
366
|
+
@Convert(converter = DebitCreditTypeConverter.class)
|
|
367
|
+
@Column(name = "貸借区分", nullable = false, columnDefinition = "貸借区分")
|
|
368
|
+
private DebitCreditType debitCreditType;
|
|
369
|
+
|
|
370
|
+
@Convert(converter = TransactionElementTypeConverter.class)
|
|
371
|
+
@Column(name = "取引要素区分", nullable = false, columnDefinition = "取引要素区分")
|
|
372
|
+
private TransactionElementType transactionElementType;
|
|
373
|
+
|
|
374
|
+
@Convert(converter = AggregationTypeConverter.class)
|
|
375
|
+
@Column(name = "集計区分", nullable = false, columnDefinition = "集計区分")
|
|
376
|
+
private AggregationType aggregationType;
|
|
377
|
+
|
|
378
|
+
@Column(name = "管理会計区分", length = 1)
|
|
379
|
+
private String managementAccountingType;
|
|
380
|
+
|
|
381
|
+
@Column(name = "費用区分", length = 1)
|
|
382
|
+
private String expenseType;
|
|
383
|
+
|
|
384
|
+
@Column(name = "元帳出力区分", length = 1)
|
|
385
|
+
private String ledgerOutputType;
|
|
386
|
+
|
|
387
|
+
@Column(name = "補助科目種別", length = 1)
|
|
388
|
+
private String subAccountType;
|
|
389
|
+
|
|
390
|
+
@Convert(converter = TaxCalculationTypeConverter.class)
|
|
391
|
+
@Column(name = "消費税計算区分", columnDefinition = "消費税計算区分")
|
|
392
|
+
private TaxCalculationType taxCalculationType;
|
|
393
|
+
|
|
394
|
+
@Column(name = "課税取引コード", length = 2)
|
|
395
|
+
private String taxTransactionCode;
|
|
396
|
+
|
|
397
|
+
@Column(name = "期日管理区分", length = 1)
|
|
398
|
+
private String dueDateManagementType;
|
|
399
|
+
|
|
400
|
+
@Column(name = "作成日時")
|
|
401
|
+
private LocalDateTime createdAt;
|
|
402
|
+
|
|
403
|
+
@Column(name = "更新日時")
|
|
404
|
+
private LocalDateTime updatedAt;
|
|
405
|
+
|
|
406
|
+
@Column(name = "更新者名", length = 12)
|
|
407
|
+
private String updatedBy;
|
|
408
|
+
|
|
409
|
+
@PrePersist
|
|
410
|
+
protected void onCreate() {
|
|
411
|
+
createdAt = LocalDateTime.now();
|
|
412
|
+
updatedAt = LocalDateTime.now();
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
@PreUpdate
|
|
416
|
+
protected void onUpdate() {
|
|
417
|
+
updatedAt = LocalDateTime.now();
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
</details>
|
|
423
|
+
|
|
424
|
+
##### ENUM 定義(ドメイン層)
|
|
425
|
+
|
|
426
|
+
<details>
|
|
427
|
+
<summary>BsPlType.java(BSPL区分)</summary>
|
|
428
|
+
|
|
429
|
+
```java
|
|
430
|
+
package com.example.accounting.domain.model.account;
|
|
431
|
+
|
|
432
|
+
import lombok.Getter;
|
|
433
|
+
import lombok.RequiredArgsConstructor;
|
|
434
|
+
|
|
435
|
+
@Getter
|
|
436
|
+
@RequiredArgsConstructor
|
|
437
|
+
public enum BsPlType {
|
|
438
|
+
BS("BS"),
|
|
439
|
+
PL("PL");
|
|
440
|
+
|
|
441
|
+
private final String displayName;
|
|
442
|
+
|
|
443
|
+
public static BsPlType fromDisplayName(String displayName) {
|
|
444
|
+
for (BsPlType type : values()) {
|
|
445
|
+
if (type.displayName.equals(displayName)) {
|
|
446
|
+
return type;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
throw new IllegalArgumentException("不正なBSPL区分: " + displayName);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
</details>
|
|
455
|
+
|
|
456
|
+
<details>
|
|
457
|
+
<summary>DebitCreditType.java(貸借区分)</summary>
|
|
458
|
+
|
|
459
|
+
```java
|
|
460
|
+
package com.example.accounting.domain.model.account;
|
|
461
|
+
|
|
462
|
+
import lombok.Getter;
|
|
463
|
+
import lombok.RequiredArgsConstructor;
|
|
464
|
+
|
|
465
|
+
@Getter
|
|
466
|
+
@RequiredArgsConstructor
|
|
467
|
+
public enum DebitCreditType {
|
|
468
|
+
DEBIT("借方"),
|
|
469
|
+
CREDIT("貸方");
|
|
470
|
+
|
|
471
|
+
private final String displayName;
|
|
472
|
+
|
|
473
|
+
public static DebitCreditType fromDisplayName(String displayName) {
|
|
474
|
+
for (DebitCreditType type : values()) {
|
|
475
|
+
if (type.displayName.equals(displayName)) {
|
|
476
|
+
return type;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
throw new IllegalArgumentException("不正な貸借区分: " + displayName);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
</details>
|
|
485
|
+
|
|
486
|
+
<details>
|
|
487
|
+
<summary>TransactionElementType.java(取引要素区分)</summary>
|
|
488
|
+
|
|
489
|
+
```java
|
|
490
|
+
package com.example.accounting.domain.model.account;
|
|
491
|
+
|
|
492
|
+
import lombok.Getter;
|
|
493
|
+
import lombok.RequiredArgsConstructor;
|
|
494
|
+
|
|
495
|
+
@Getter
|
|
496
|
+
@RequiredArgsConstructor
|
|
497
|
+
public enum TransactionElementType {
|
|
498
|
+
ASSET("資産"),
|
|
499
|
+
LIABILITY("負債"),
|
|
500
|
+
EQUITY("資本"),
|
|
501
|
+
REVENUE("収益"),
|
|
502
|
+
EXPENSE("費用");
|
|
503
|
+
|
|
504
|
+
private final String displayName;
|
|
505
|
+
|
|
506
|
+
public static TransactionElementType fromDisplayName(String displayName) {
|
|
507
|
+
for (TransactionElementType type : values()) {
|
|
508
|
+
if (type.displayName.equals(displayName)) {
|
|
509
|
+
return type;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
throw new IllegalArgumentException("不正な取引要素区分: " + displayName);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
</details>
|
|
518
|
+
|
|
519
|
+
<details>
|
|
520
|
+
<summary>AggregationType.java(集計区分)</summary>
|
|
521
|
+
|
|
522
|
+
```java
|
|
523
|
+
package com.example.accounting.domain.model.account;
|
|
524
|
+
|
|
525
|
+
import lombok.Getter;
|
|
526
|
+
import lombok.RequiredArgsConstructor;
|
|
527
|
+
|
|
528
|
+
@Getter
|
|
529
|
+
@RequiredArgsConstructor
|
|
530
|
+
public enum AggregationType {
|
|
531
|
+
HEADING("見出科目"),
|
|
532
|
+
SUMMARY("集計科目"),
|
|
533
|
+
POSTING("計上科目");
|
|
534
|
+
|
|
535
|
+
private final String displayName;
|
|
536
|
+
|
|
537
|
+
public static AggregationType fromDisplayName(String displayName) {
|
|
538
|
+
for (AggregationType type : values()) {
|
|
539
|
+
if (type.displayName.equals(displayName)) {
|
|
540
|
+
return type;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
throw new IllegalArgumentException("不正な集計区分: " + displayName);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
</details>
|
|
549
|
+
|
|
550
|
+
##### AttributeConverter(ENUM 変換)
|
|
551
|
+
|
|
552
|
+
JPA では `AttributeConverter` を使って PostgreSQL ENUM と Java Enum を変換します。MyBatis の TypeHandler に相当します。
|
|
553
|
+
|
|
554
|
+
<details>
|
|
555
|
+
<summary>BsPlTypeConverter.java</summary>
|
|
556
|
+
|
|
557
|
+
```java
|
|
558
|
+
package com.example.accounting.infrastructure.persistence.converter;
|
|
559
|
+
|
|
560
|
+
import com.example.accounting.domain.model.account.BsPlType;
|
|
561
|
+
import jakarta.persistence.AttributeConverter;
|
|
562
|
+
import jakarta.persistence.Converter;
|
|
563
|
+
|
|
564
|
+
@Converter(autoApply = true)
|
|
565
|
+
public class BsPlTypeConverter implements AttributeConverter<BsPlType, String> {
|
|
566
|
+
|
|
567
|
+
@Override
|
|
568
|
+
public String convertToDatabaseColumn(BsPlType attribute) {
|
|
569
|
+
return attribute != null ? attribute.getDisplayName() : null;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
@Override
|
|
573
|
+
public BsPlType convertToEntityAttribute(String dbData) {
|
|
574
|
+
return dbData != null ? BsPlType.fromDisplayName(dbData) : null;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
</details>
|
|
580
|
+
|
|
581
|
+
<details>
|
|
582
|
+
<summary>DebitCreditTypeConverter.java</summary>
|
|
583
|
+
|
|
584
|
+
```java
|
|
585
|
+
package com.example.accounting.infrastructure.persistence.converter;
|
|
586
|
+
|
|
587
|
+
import com.example.accounting.domain.model.account.DebitCreditType;
|
|
588
|
+
import jakarta.persistence.AttributeConverter;
|
|
589
|
+
import jakarta.persistence.Converter;
|
|
590
|
+
|
|
591
|
+
@Converter(autoApply = true)
|
|
592
|
+
public class DebitCreditTypeConverter implements AttributeConverter<DebitCreditType, String> {
|
|
593
|
+
|
|
594
|
+
@Override
|
|
595
|
+
public String convertToDatabaseColumn(DebitCreditType attribute) {
|
|
596
|
+
return attribute != null ? attribute.getDisplayName() : null;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
@Override
|
|
600
|
+
public DebitCreditType convertToEntityAttribute(String dbData) {
|
|
601
|
+
return dbData != null ? DebitCreditType.fromDisplayName(dbData) : null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
</details>
|
|
607
|
+
|
|
608
|
+
<details>
|
|
609
|
+
<summary>TransactionElementTypeConverter.java</summary>
|
|
610
|
+
|
|
611
|
+
```java
|
|
612
|
+
package com.example.accounting.infrastructure.persistence.converter;
|
|
613
|
+
|
|
614
|
+
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
615
|
+
import jakarta.persistence.AttributeConverter;
|
|
616
|
+
import jakarta.persistence.Converter;
|
|
617
|
+
|
|
618
|
+
@Converter(autoApply = true)
|
|
619
|
+
public class TransactionElementTypeConverter implements AttributeConverter<TransactionElementType, String> {
|
|
620
|
+
|
|
621
|
+
@Override
|
|
622
|
+
public String convertToDatabaseColumn(TransactionElementType attribute) {
|
|
623
|
+
return attribute != null ? attribute.getDisplayName() : null;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
@Override
|
|
627
|
+
public TransactionElementType convertToEntityAttribute(String dbData) {
|
|
628
|
+
return dbData != null ? TransactionElementType.fromDisplayName(dbData) : null;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
</details>
|
|
634
|
+
|
|
635
|
+
<details>
|
|
636
|
+
<summary>AggregationTypeConverter.java</summary>
|
|
637
|
+
|
|
638
|
+
```java
|
|
639
|
+
package com.example.accounting.infrastructure.persistence.converter;
|
|
640
|
+
|
|
641
|
+
import com.example.accounting.domain.model.account.AggregationType;
|
|
642
|
+
import jakarta.persistence.AttributeConverter;
|
|
643
|
+
import jakarta.persistence.Converter;
|
|
644
|
+
|
|
645
|
+
@Converter(autoApply = true)
|
|
646
|
+
public class AggregationTypeConverter implements AttributeConverter<AggregationType, String> {
|
|
647
|
+
|
|
648
|
+
@Override
|
|
649
|
+
public String convertToDatabaseColumn(AggregationType attribute) {
|
|
650
|
+
return attribute != null ? attribute.getDisplayName() : null;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
@Override
|
|
654
|
+
public AggregationType convertToEntityAttribute(String dbData) {
|
|
655
|
+
return dbData != null ? AggregationType.fromDisplayName(dbData) : null;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
</details>
|
|
661
|
+
|
|
662
|
+
##### Repository インターフェース(Output Port)
|
|
663
|
+
|
|
664
|
+
<details>
|
|
665
|
+
<summary>AccountRepository.java</summary>
|
|
666
|
+
|
|
667
|
+
```java
|
|
668
|
+
package com.example.accounting.application.port.out;
|
|
669
|
+
|
|
670
|
+
import com.example.accounting.domain.model.account.Account;
|
|
671
|
+
import com.example.accounting.domain.model.account.AggregationType;
|
|
672
|
+
import com.example.accounting.domain.model.account.BsPlType;
|
|
673
|
+
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
674
|
+
|
|
675
|
+
import java.util.List;
|
|
676
|
+
import java.util.Optional;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* 勘定科目リポジトリ(Output Port)
|
|
680
|
+
*/
|
|
681
|
+
public interface AccountRepository {
|
|
682
|
+
|
|
683
|
+
void save(Account account);
|
|
684
|
+
|
|
685
|
+
Optional<Account> findByCode(String accountCode);
|
|
686
|
+
|
|
687
|
+
List<Account> findAll();
|
|
688
|
+
|
|
689
|
+
List<Account> findByBsPlType(BsPlType bsPlType);
|
|
690
|
+
|
|
691
|
+
List<Account> findByAggregationType(AggregationType aggregationType);
|
|
692
|
+
|
|
693
|
+
List<Account> findByTransactionElementType(TransactionElementType type);
|
|
694
|
+
|
|
695
|
+
void update(Account account);
|
|
696
|
+
|
|
697
|
+
void deleteAll();
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
</details>
|
|
702
|
+
|
|
703
|
+
##### Spring Data JPA Repository
|
|
704
|
+
|
|
705
|
+
<details>
|
|
706
|
+
<summary>AccountJpaRepository.java</summary>
|
|
707
|
+
|
|
708
|
+
```java
|
|
709
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
710
|
+
|
|
711
|
+
import com.example.accounting.domain.model.account.Account;
|
|
712
|
+
import com.example.accounting.domain.model.account.AggregationType;
|
|
713
|
+
import com.example.accounting.domain.model.account.BsPlType;
|
|
714
|
+
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
715
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
|
716
|
+
import org.springframework.data.jpa.repository.Modifying;
|
|
717
|
+
import org.springframework.data.jpa.repository.Query;
|
|
718
|
+
import org.springframework.stereotype.Repository;
|
|
719
|
+
|
|
720
|
+
import java.util.List;
|
|
721
|
+
|
|
722
|
+
@Repository
|
|
723
|
+
public interface AccountJpaRepository extends JpaRepository<Account, String> {
|
|
724
|
+
|
|
725
|
+
List<Account> findByBsPlType(BsPlType bsPlType);
|
|
726
|
+
|
|
727
|
+
List<Account> findByAggregationType(AggregationType aggregationType);
|
|
728
|
+
|
|
729
|
+
List<Account> findByTransactionElementType(TransactionElementType transactionElementType);
|
|
730
|
+
|
|
731
|
+
List<Account> findAllByOrderByAccountCodeAsc();
|
|
732
|
+
|
|
733
|
+
@Modifying
|
|
734
|
+
@Query(value = "TRUNCATE TABLE \"勘定科目マスタ\" CASCADE", nativeQuery = true)
|
|
735
|
+
void truncateTable();
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
</details>
|
|
740
|
+
|
|
741
|
+
##### Repository 実装クラス(インフラストラクチャ層)
|
|
742
|
+
|
|
743
|
+
<details>
|
|
744
|
+
<summary>AccountRepositoryImpl.java</summary>
|
|
745
|
+
|
|
746
|
+
```java
|
|
747
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
748
|
+
|
|
749
|
+
import com.example.accounting.application.port.out.AccountRepository;
|
|
750
|
+
import com.example.accounting.domain.model.account.Account;
|
|
751
|
+
import com.example.accounting.domain.model.account.AggregationType;
|
|
752
|
+
import com.example.accounting.domain.model.account.BsPlType;
|
|
753
|
+
import com.example.accounting.domain.model.account.TransactionElementType;
|
|
754
|
+
import lombok.RequiredArgsConstructor;
|
|
755
|
+
import org.springframework.stereotype.Repository;
|
|
756
|
+
import org.springframework.transaction.annotation.Transactional;
|
|
757
|
+
|
|
758
|
+
import java.util.List;
|
|
759
|
+
import java.util.Optional;
|
|
760
|
+
|
|
761
|
+
@Repository
|
|
762
|
+
@RequiredArgsConstructor
|
|
763
|
+
public class AccountRepositoryImpl implements AccountRepository {
|
|
764
|
+
|
|
765
|
+
private final AccountJpaRepository jpaRepository;
|
|
766
|
+
|
|
767
|
+
@Override
|
|
768
|
+
public void save(Account account) {
|
|
769
|
+
jpaRepository.save(account);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
@Override
|
|
773
|
+
public Optional<Account> findByCode(String accountCode) {
|
|
774
|
+
return jpaRepository.findById(accountCode);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
@Override
|
|
778
|
+
public List<Account> findAll() {
|
|
779
|
+
return jpaRepository.findAllByOrderByAccountCodeAsc();
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
@Override
|
|
783
|
+
public List<Account> findByBsPlType(BsPlType bsPlType) {
|
|
784
|
+
return jpaRepository.findByBsPlType(bsPlType);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
@Override
|
|
788
|
+
public List<Account> findByAggregationType(AggregationType aggregationType) {
|
|
789
|
+
return jpaRepository.findByAggregationType(aggregationType);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
@Override
|
|
793
|
+
public List<Account> findByTransactionElementType(TransactionElementType type) {
|
|
794
|
+
return jpaRepository.findByTransactionElementType(type);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
@Override
|
|
798
|
+
public void update(Account account) {
|
|
799
|
+
jpaRepository.save(account);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
@Override
|
|
803
|
+
@Transactional
|
|
804
|
+
public void deleteAll() {
|
|
805
|
+
jpaRepository.truncateTable();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
</details>
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## 15.3 勘定科目構成マスタの設計
|
|
815
|
+
|
|
816
|
+
### チルダ連結方式による階層構造
|
|
817
|
+
|
|
818
|
+
勘定科目の階層構造を「チルダ(^)連結」で表現します。これにより、SQL の LIKE 検索で効率的に階層検索ができます。
|
|
819
|
+
|
|
820
|
+
```plantuml
|
|
821
|
+
@startwbs
|
|
822
|
+
title 貸借対照表の科目ツリー構造(部分)
|
|
823
|
+
|
|
824
|
+
* 貸借対照表
|
|
825
|
+
** 資産の部
|
|
826
|
+
*** 流動資産
|
|
827
|
+
**** 現金及び預金
|
|
828
|
+
***** 現金
|
|
829
|
+
***** 当座預金
|
|
830
|
+
***** 普通預金
|
|
831
|
+
*** 固定資産
|
|
832
|
+
**** 有形固定資産
|
|
833
|
+
***** 建物
|
|
834
|
+
***** 機械及び装置
|
|
835
|
+
** 負債の部
|
|
836
|
+
*** 流動負債
|
|
837
|
+
**** 支払手形
|
|
838
|
+
**** 買掛金
|
|
839
|
+
** 資本の部
|
|
840
|
+
*** 資本金
|
|
841
|
+
*** 利益剰余金
|
|
842
|
+
@endwbs
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### 勘定科目構成マスタのデータ例
|
|
846
|
+
|
|
847
|
+
| 勘定科目コード | 勘定科目パス |
|
|
848
|
+
|-------------|-------------|
|
|
849
|
+
| 11 | 11 |
|
|
850
|
+
| 11000 | 11^11000 |
|
|
851
|
+
| 11190 | 11^11000^11190 |
|
|
852
|
+
| 11110 | 11^11000^11190^11110 |
|
|
853
|
+
| 11120 | 11^11000^11190^11120 |
|
|
854
|
+
| 11130 | 11^11000^11190^11130 |
|
|
855
|
+
|
|
856
|
+
### マイグレーション
|
|
857
|
+
|
|
858
|
+
<details>
|
|
859
|
+
<summary>V003__create_account_structure.sql</summary>
|
|
860
|
+
|
|
861
|
+
```sql
|
|
862
|
+
-- 勘定科目構成マスタ
|
|
863
|
+
CREATE TABLE "勘定科目構成マスタ" (
|
|
864
|
+
"勘定科目コード" VARCHAR(5) PRIMARY KEY REFERENCES "勘定科目マスタ"("勘定科目コード"),
|
|
865
|
+
"勘定科目パス" VARCHAR(100) NOT NULL,
|
|
866
|
+
"更新日時" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
867
|
+
"更新者名" VARCHAR(12)
|
|
868
|
+
);
|
|
869
|
+
|
|
870
|
+
-- インデックス(パス検索用)
|
|
871
|
+
CREATE INDEX idx_勘定科目構成マスタ_パス ON "勘定科目構成マスタ"("勘定科目パス");
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
</details>
|
|
875
|
+
|
|
876
|
+
### TDD による勘定科目構成マスタの実装
|
|
877
|
+
|
|
878
|
+
#### JPA エンティティ
|
|
879
|
+
|
|
880
|
+
<details>
|
|
881
|
+
<summary>AccountStructure.java</summary>
|
|
882
|
+
|
|
883
|
+
```java
|
|
884
|
+
package com.example.accounting.domain.model.account;
|
|
885
|
+
|
|
886
|
+
import jakarta.persistence.*;
|
|
887
|
+
import lombok.*;
|
|
888
|
+
import java.time.LocalDateTime;
|
|
889
|
+
|
|
890
|
+
@Entity
|
|
891
|
+
@Table(name = "勘定科目構成マスタ")
|
|
892
|
+
@Data
|
|
893
|
+
@Builder
|
|
894
|
+
@NoArgsConstructor
|
|
895
|
+
@AllArgsConstructor
|
|
896
|
+
public class AccountStructure {
|
|
897
|
+
|
|
898
|
+
@Id
|
|
899
|
+
@Column(name = "勘定科目コード", length = 5)
|
|
900
|
+
private String accountCode;
|
|
901
|
+
|
|
902
|
+
@Column(name = "勘定科目パス", length = 100, nullable = false)
|
|
903
|
+
private String accountPath;
|
|
904
|
+
|
|
905
|
+
@Column(name = "更新日時")
|
|
906
|
+
private LocalDateTime updatedAt;
|
|
907
|
+
|
|
908
|
+
@Column(name = "更新者名", length = 12)
|
|
909
|
+
private String updatedBy;
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* パスの深さ(階層レベル)を取得
|
|
913
|
+
*/
|
|
914
|
+
@Transient
|
|
915
|
+
public int getDepth() {
|
|
916
|
+
if (accountPath == null || accountPath.isEmpty()) {
|
|
917
|
+
return 0;
|
|
918
|
+
}
|
|
919
|
+
return accountPath.split("\\^").length - 1;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* 親科目コードを取得
|
|
924
|
+
*/
|
|
925
|
+
@Transient
|
|
926
|
+
public String getParentCode() {
|
|
927
|
+
if (accountPath == null || !accountPath.contains("^")) {
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
String[] parts = accountPath.split("\\^");
|
|
931
|
+
if (parts.length < 2) {
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
return parts[parts.length - 2];
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
@PrePersist
|
|
938
|
+
@PreUpdate
|
|
939
|
+
protected void onUpdate() {
|
|
940
|
+
updatedAt = LocalDateTime.now();
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
</details>
|
|
946
|
+
|
|
947
|
+
#### Repository インターフェース(Output Port)
|
|
948
|
+
|
|
949
|
+
<details>
|
|
950
|
+
<summary>AccountStructureRepository.java</summary>
|
|
951
|
+
|
|
952
|
+
```java
|
|
953
|
+
package com.example.accounting.application.port.out;
|
|
954
|
+
|
|
955
|
+
import com.example.accounting.domain.model.account.AccountStructure;
|
|
956
|
+
|
|
957
|
+
import java.util.List;
|
|
958
|
+
import java.util.Optional;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* 勘定科目構成リポジトリ(Output Port)
|
|
962
|
+
*/
|
|
963
|
+
public interface AccountStructureRepository {
|
|
964
|
+
|
|
965
|
+
void save(AccountStructure structure);
|
|
966
|
+
|
|
967
|
+
Optional<AccountStructure> findByCode(String accountCode);
|
|
968
|
+
|
|
969
|
+
List<AccountStructure> findAll();
|
|
970
|
+
|
|
971
|
+
List<AccountStructure> findByPathContaining(String pathSegment);
|
|
972
|
+
|
|
973
|
+
List<AccountStructure> findChildren(String parentCode);
|
|
974
|
+
|
|
975
|
+
void update(AccountStructure structure);
|
|
976
|
+
|
|
977
|
+
void deleteAll();
|
|
978
|
+
}
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
</details>
|
|
982
|
+
|
|
983
|
+
#### Spring Data JPA Repository
|
|
984
|
+
|
|
985
|
+
<details>
|
|
986
|
+
<summary>AccountStructureJpaRepository.java</summary>
|
|
987
|
+
|
|
988
|
+
```java
|
|
989
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
990
|
+
|
|
991
|
+
import com.example.accounting.domain.model.account.AccountStructure;
|
|
992
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
|
993
|
+
import org.springframework.data.jpa.repository.Modifying;
|
|
994
|
+
import org.springframework.data.jpa.repository.Query;
|
|
995
|
+
import org.springframework.data.repository.query.Param;
|
|
996
|
+
import org.springframework.stereotype.Repository;
|
|
997
|
+
|
|
998
|
+
import java.util.List;
|
|
999
|
+
|
|
1000
|
+
@Repository
|
|
1001
|
+
public interface AccountStructureJpaRepository extends JpaRepository<AccountStructure, String> {
|
|
1002
|
+
|
|
1003
|
+
List<AccountStructure> findAllByOrderByAccountCodeAsc();
|
|
1004
|
+
|
|
1005
|
+
@Query("SELECT s FROM AccountStructure s WHERE s.accountPath LIKE %:pathSegment% ORDER BY s.accountCode")
|
|
1006
|
+
List<AccountStructure> findByAccountPathContaining(@Param("pathSegment") String pathSegment);
|
|
1007
|
+
|
|
1008
|
+
@Query("SELECT s FROM AccountStructure s WHERE s.accountPath LIKE :parentCode% ORDER BY s.accountCode")
|
|
1009
|
+
List<AccountStructure> findChildrenByParentCode(@Param("parentCode") String parentCode);
|
|
1010
|
+
|
|
1011
|
+
@Modifying
|
|
1012
|
+
@Query(value = "TRUNCATE TABLE \"勘定科目構成マスタ\" CASCADE", nativeQuery = true)
|
|
1013
|
+
void truncateTable();
|
|
1014
|
+
}
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
</details>
|
|
1018
|
+
|
|
1019
|
+
#### Repository 実装クラス
|
|
1020
|
+
|
|
1021
|
+
<details>
|
|
1022
|
+
<summary>AccountStructureRepositoryImpl.java</summary>
|
|
1023
|
+
|
|
1024
|
+
```java
|
|
1025
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
1026
|
+
|
|
1027
|
+
import com.example.accounting.application.port.out.AccountStructureRepository;
|
|
1028
|
+
import com.example.accounting.domain.model.account.AccountStructure;
|
|
1029
|
+
import lombok.RequiredArgsConstructor;
|
|
1030
|
+
import org.springframework.stereotype.Repository;
|
|
1031
|
+
import org.springframework.transaction.annotation.Transactional;
|
|
1032
|
+
|
|
1033
|
+
import java.util.List;
|
|
1034
|
+
import java.util.Optional;
|
|
1035
|
+
|
|
1036
|
+
@Repository
|
|
1037
|
+
@RequiredArgsConstructor
|
|
1038
|
+
public class AccountStructureRepositoryImpl implements AccountStructureRepository {
|
|
1039
|
+
|
|
1040
|
+
private final AccountStructureJpaRepository jpaRepository;
|
|
1041
|
+
|
|
1042
|
+
@Override
|
|
1043
|
+
public void save(AccountStructure structure) {
|
|
1044
|
+
jpaRepository.save(structure);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
@Override
|
|
1048
|
+
public Optional<AccountStructure> findByCode(String accountCode) {
|
|
1049
|
+
return jpaRepository.findById(accountCode);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
@Override
|
|
1053
|
+
public List<AccountStructure> findAll() {
|
|
1054
|
+
return jpaRepository.findAllByOrderByAccountCodeAsc();
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
@Override
|
|
1058
|
+
public List<AccountStructure> findByPathContaining(String pathSegment) {
|
|
1059
|
+
return jpaRepository.findByAccountPathContaining(pathSegment);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
@Override
|
|
1063
|
+
public List<AccountStructure> findChildren(String parentCode) {
|
|
1064
|
+
return jpaRepository.findChildrenByParentCode(parentCode + "^");
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
@Override
|
|
1068
|
+
public void update(AccountStructure structure) {
|
|
1069
|
+
jpaRepository.save(structure);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
@Override
|
|
1073
|
+
@Transactional
|
|
1074
|
+
public void deleteAll() {
|
|
1075
|
+
jpaRepository.truncateTable();
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
</details>
|
|
1081
|
+
|
|
1082
|
+
---
|
|
1083
|
+
|
|
1084
|
+
## 15.4 課税取引マスタの設計
|
|
1085
|
+
|
|
1086
|
+
### 課税取引コード・税率の管理
|
|
1087
|
+
|
|
1088
|
+
課税取引マスタは、消費税の税率情報を管理するマスタテーブルです。
|
|
1089
|
+
|
|
1090
|
+
| 課税取引コード | 課税取引名 | 税率 |
|
|
1091
|
+
|-------------|-----------|------|
|
|
1092
|
+
| 00 | 非課税 | 0.000 |
|
|
1093
|
+
| 08 | 軽減税率 | 0.080 |
|
|
1094
|
+
| 10 | 標準税率 | 0.100 |
|
|
1095
|
+
|
|
1096
|
+
### TDD による課税取引マスタの実装
|
|
1097
|
+
|
|
1098
|
+
#### JPA エンティティ
|
|
1099
|
+
|
|
1100
|
+
<details>
|
|
1101
|
+
<summary>TaxTransaction.java</summary>
|
|
1102
|
+
|
|
1103
|
+
```java
|
|
1104
|
+
package com.example.accounting.domain.model.tax;
|
|
1105
|
+
|
|
1106
|
+
import jakarta.persistence.*;
|
|
1107
|
+
import lombok.*;
|
|
1108
|
+
import java.math.BigDecimal;
|
|
1109
|
+
import java.time.LocalDateTime;
|
|
1110
|
+
|
|
1111
|
+
@Entity
|
|
1112
|
+
@Table(name = "課税取引マスタ")
|
|
1113
|
+
@Data
|
|
1114
|
+
@Builder
|
|
1115
|
+
@NoArgsConstructor
|
|
1116
|
+
@AllArgsConstructor
|
|
1117
|
+
public class TaxTransaction {
|
|
1118
|
+
|
|
1119
|
+
@Id
|
|
1120
|
+
@Column(name = "課税取引コード", length = 2)
|
|
1121
|
+
private String taxCode;
|
|
1122
|
+
|
|
1123
|
+
@Column(name = "課税取引名", length = 20, nullable = false)
|
|
1124
|
+
private String taxName;
|
|
1125
|
+
|
|
1126
|
+
@Builder.Default
|
|
1127
|
+
@Column(name = "税率", precision = 5, scale = 3, nullable = false)
|
|
1128
|
+
private BigDecimal taxRate = new BigDecimal("0.10");
|
|
1129
|
+
|
|
1130
|
+
@Column(name = "更新日時")
|
|
1131
|
+
private LocalDateTime updatedAt;
|
|
1132
|
+
|
|
1133
|
+
@Column(name = "更新者名", length = 12)
|
|
1134
|
+
private String updatedBy;
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* 税込金額を計算
|
|
1138
|
+
*/
|
|
1139
|
+
public BigDecimal calculateTaxIncludedAmount(BigDecimal amount) {
|
|
1140
|
+
return amount.add(amount.multiply(taxRate));
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* 消費税額を計算
|
|
1145
|
+
*/
|
|
1146
|
+
public BigDecimal calculateTaxAmount(BigDecimal amount) {
|
|
1147
|
+
return amount.multiply(taxRate);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
@PrePersist
|
|
1151
|
+
@PreUpdate
|
|
1152
|
+
protected void onUpdate() {
|
|
1153
|
+
updatedAt = LocalDateTime.now();
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
</details>
|
|
1159
|
+
|
|
1160
|
+
#### Spring Data JPA Repository
|
|
1161
|
+
|
|
1162
|
+
<details>
|
|
1163
|
+
<summary>TaxTransactionJpaRepository.java</summary>
|
|
1164
|
+
|
|
1165
|
+
```java
|
|
1166
|
+
package com.example.accounting.infrastructure.persistence.repository;
|
|
1167
|
+
|
|
1168
|
+
import com.example.accounting.domain.model.tax.TaxTransaction;
|
|
1169
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
|
1170
|
+
import org.springframework.data.jpa.repository.Modifying;
|
|
1171
|
+
import org.springframework.data.jpa.repository.Query;
|
|
1172
|
+
import org.springframework.stereotype.Repository;
|
|
1173
|
+
|
|
1174
|
+
import java.util.List;
|
|
1175
|
+
|
|
1176
|
+
@Repository
|
|
1177
|
+
public interface TaxTransactionJpaRepository extends JpaRepository<TaxTransaction, String> {
|
|
1178
|
+
|
|
1179
|
+
List<TaxTransaction> findAllByOrderByTaxCodeAsc();
|
|
1180
|
+
|
|
1181
|
+
@Modifying
|
|
1182
|
+
@Query(value = "TRUNCATE TABLE \"課税取引マスタ\" CASCADE", nativeQuery = true)
|
|
1183
|
+
void truncateTable();
|
|
1184
|
+
}
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
</details>
|
|
1188
|
+
|
|
1189
|
+
---
|
|
1190
|
+
|
|
1191
|
+
## 15.5 MyBatis 版との比較
|
|
1192
|
+
|
|
1193
|
+
### 実装の違い
|
|
1194
|
+
|
|
1195
|
+
| 観点 | MyBatis 版 | JPA 版 |
|
|
1196
|
+
|------|-----------|--------|
|
|
1197
|
+
| マッピング | XML Mapper + resultMap | @Entity + @Column |
|
|
1198
|
+
| ENUM 変換 | TypeHandler | AttributeConverter |
|
|
1199
|
+
| Repository | Mapper インターフェース + XML | JpaRepository インターフェース |
|
|
1200
|
+
| SQL | XML で明示的に記述 | メソッド名規約で自動生成 |
|
|
1201
|
+
| トランザクション管理 | 明示的に記述 | @Transactional |
|
|
1202
|
+
| TRUNCATE | XML で定義 | @Query(nativeQuery) |
|
|
1203
|
+
|
|
1204
|
+
### コード量の比較
|
|
1205
|
+
|
|
1206
|
+
| 項目 | MyBatis 版 | JPA 版 |
|
|
1207
|
+
|------|-----------|--------|
|
|
1208
|
+
| エンティティ | POJO(アノテーションなし) | @Entity + @Column |
|
|
1209
|
+
| ENUM 変換 | TypeHandler(各4クラス) | AttributeConverter(各4クラス) |
|
|
1210
|
+
| Mapper/Repository | Mapper + XML | JpaRepository インターフェースのみ |
|
|
1211
|
+
| SQL | XML で全て記述 | メソッド名規約 + @Query |
|
|
1212
|
+
|
|
1213
|
+
---
|
|
1214
|
+
|
|
1215
|
+
## 第15章のまとめ
|
|
1216
|
+
|
|
1217
|
+
### 作成したテーブル
|
|
1218
|
+
|
|
1219
|
+
| テーブル名 | 説明 |
|
|
1220
|
+
|----------|------|
|
|
1221
|
+
| `課税取引マスタ` | 消費税の税率情報を管理 |
|
|
1222
|
+
| `勘定科目マスタ` | 勘定科目の基本情報を管理 |
|
|
1223
|
+
| `勘定科目構成マスタ` | 勘定科目の階層構造をチルダ連結で管理 |
|
|
1224
|
+
|
|
1225
|
+
### ER図
|
|
1226
|
+
|
|
1227
|
+
```plantuml
|
|
1228
|
+
@startuml
|
|
1229
|
+
|
|
1230
|
+
title 勘定科目関連 ER図
|
|
1231
|
+
|
|
1232
|
+
entity 課税取引マスタ {
|
|
1233
|
+
課税取引コード <<PK>>
|
|
1234
|
+
--
|
|
1235
|
+
課税取引名
|
|
1236
|
+
税率
|
|
1237
|
+
更新日時
|
|
1238
|
+
更新者名
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
entity 勘定科目マスタ {
|
|
1242
|
+
勘定科目コード <<PK>>
|
|
1243
|
+
--
|
|
1244
|
+
勘定科目名
|
|
1245
|
+
勘定科目略名
|
|
1246
|
+
勘定科目カナ
|
|
1247
|
+
BSPL区分
|
|
1248
|
+
貸借区分
|
|
1249
|
+
取引要素区分
|
|
1250
|
+
集計区分
|
|
1251
|
+
管理会計区分
|
|
1252
|
+
費用区分
|
|
1253
|
+
元帳出力区分
|
|
1254
|
+
補助科目種別
|
|
1255
|
+
消費税計算区分
|
|
1256
|
+
課税取引コード <<FK>>
|
|
1257
|
+
期日管理区分
|
|
1258
|
+
...
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
entity 勘定科目構成マスタ {
|
|
1262
|
+
勘定科目コード <<PK,FK>>
|
|
1263
|
+
--
|
|
1264
|
+
勘定科目パス
|
|
1265
|
+
更新日時
|
|
1266
|
+
更新者名
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
勘定科目マスタ }o..|| 課税取引マスタ
|
|
1270
|
+
勘定科目マスタ ||--|| 勘定科目構成マスタ
|
|
1271
|
+
|
|
1272
|
+
@enduml
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
### 設計のポイント
|
|
1276
|
+
|
|
1277
|
+
1. **ENUM 型の活用**: BSPL区分、貸借区分、取引要素区分、集計区分で型安全性を確保
|
|
1278
|
+
2. **日本語 DB / 英語 Java**: テーブル・カラムは日本語、Java コードは英語で統一
|
|
1279
|
+
3. **AttributeConverter**: Java Enum と日本語 ENUM 値の変換を JPA AttributeConverter で実装
|
|
1280
|
+
4. **チルダ連結方式**: 勘定科目構成マスタで階層構造を表現し、JPQL の LIKE 検索で効率的に階層検索
|
|
1281
|
+
5. **ヘキサゴナルアーキテクチャ**: ドメイン層がインフラに依存しない設計
|
|
1282
|
+
6. **JpaRepository**: メソッド名規約による自動 SQL 生成
|
|
1283
|
+
|
|
1284
|
+
### 命名規則
|
|
1285
|
+
|
|
1286
|
+
| 要素 | 言語 | 例 |
|
|
1287
|
+
|------|------|-----|
|
|
1288
|
+
| **テーブル名** | 日本語 | `"勘定科目マスタ"`, `"課税取引マスタ"` |
|
|
1289
|
+
| **カラム名** | 日本語 | `"勘定科目コード"`, `"勘定科目名"` |
|
|
1290
|
+
| **ENUM 型** | 日本語 | `BSPL区分`, `貸借区分` |
|
|
1291
|
+
| **ENUM 値** | 日本語 | `'BS'`, `'借方'` |
|
|
1292
|
+
| **Java クラス名** | 英語 | `Account`, `AccountStructure` |
|
|
1293
|
+
| **Java フィールド名** | 英語 | `accountCode`, `accountName` |
|
|
1294
|
+
| **JPA @Column** | 日本語カラム指定 | `@Column(name = "勘定科目コード")` |
|
|
1295
|
+
|
|
1296
|
+
---
|
|
1297
|
+
|
|
1298
|
+
## 次章の予告
|
|
1299
|
+
|
|
1300
|
+
第16章では、仕訳テーブルの設計に進みます。複式簿記の基本構造である「借方・貸方」の仕訳データを JPA で実装していきます。@EmbeddedId を使った複合主キーや @ManyToOne によるリレーションも解説します。
|