302Lookup / Code Tables
Code tables: one generic table holds many small lists (gender, title, region ...).
Try it
All code tables
Each type is a small list; other masters store the code (e.g. holiday.holiday_type = 'PUBLIC')| # | Code | Name | System type | Status | |
|---|---|---|---|---|---|
| 9 | BLOOD_GROUP | Blood group | Active | ✏️ | |
| 7 | GENDER | Gender | Active | ✏️ | |
| 2 | HOLIDAY_TYPE | Holiday type | ✓ | Active | ✏️ |
| 10 | MARITAL_STATUS | Marital status | Active | ✏️ | |
| 6 | PARAM_GROUP | Parameter group | ✓ | Active | ✏️ |
| 3 | TAX_TYPE | Tax type | ✓ | Active | ✏️ |
| 4 | TH_REGION | Thai region | ✓ | Active | ✏️ |
| 8 | TITLE | Name title | Active | ✏️ | |
| 1 | UNIT_TYPE | Unit type | ✓ | Active | ✏️ |
| 5 | WORLD_REGION | World region | ✓ | Active | ✏️ |
Showing 1–10 of 10
🎓 Learn: how this master is built table lookup_type
Key points
- Instead of 10 tiny tables, lookup_type + lookup_value store them all.
- LookupService.values() is @Cacheable("lookups"); MasterListeners clears the cache after a change.
Code
- Entity
domain/LookupType.java- Repository
repo/LookupTypeRepository.java- Definition
MasterRegistry: "lookup-types"- Page / form
web/MasterController.java- Try-it panel
templates/tools/lookup-overview.html- REST API
GET /api/lookups/TITLE
SQL to try in SSMS (database MasterDataLabDB)
SELECT t.code AS type, v.code, v.name, v.name_th FROM lookup_value v JOIN lookup_type t ON t.id = v.lookup_type_id WHERE t.code = 'TITLE' ORDER BY v.sort_order;