package Ġcom . github . product . controller Ċ Ċ import Ġcom . github . dto . Result Dto Ċ import Ġcom . github . dto . result Success Ċ import Ġcom . github . product . entity . Attr Group Relation Ċ import Ġcom . github . product . service . Attr Group Relation Service Ċ import Ġio . swagger . annotations . Api Ċ import Ġio . swagger . annotations . ApiOperation Ċ import Ġkotlinx . coroutines . flow . toList Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . web . bind . annotation .* Ċ Ċ /** Ċ Ġ* Ċ Ġ* Ġ@ author ĠAn do chi wa Ċ Ġ* Ġ@ email Ġa 1 0 6 6 0 7 9 4 6 9 @ gmail . com Ċ Ġ* Ġ@ date Ġ 2 0 2 1 - 0 9 - 2 4 Ġ 0 0 : 4 7 : 1 9 Ċ Ġ*/ Ċ @ RestController Ċ @ RequestMapping (" product / attr group relation ") Ċ @ Api Ċ class ĠAttr Group Relation Controller Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġattr Group Relation Service : ĠAttr Group Relation Service ĊĊĠĠĠ Ġ@ GetMapping ("{ id }") ĊĠĠĠ Ġ@ ApiOperation (" get ") ĊĠĠĠ Ġsuspend Ġfun Ġget ById (@ PathVariable (" id ") Ġid : ĠLong ): ĠResult Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġattr Group Relation Ġ= Ġattr Group Relation Service . getById ( id ) ĊĠĠĠĠĠĠĠ Ġreturn Ġresult Success (). put (" attr Group Relation ", Ġattr Group Relation ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ PostMapping ĊĠĠĠ Ġ@ ApiOperation (" insert ") ĊĠĠĠ Ġsuspend Ġfun Ġinsert (@ RequestBody Ġattr Group Relation : ĠAttr Group Relation ): ĠResult Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġattr Group Relation Service . save OrUpdate ( attr Group Relation ) ĊĠĠĠĠĠĠĠ Ġreturn Ġresult Success () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Put Mapping ĊĠĠĠ Ġ@ ApiOperation (" update ") ĊĠĠĠ Ġsuspend Ġfun Ġupdate (@ RequestBody Ġattr Group Relation : ĠAttr Group Relation ): ĠResult Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġattr Group Relation Service . save OrUpdate ( attr Group Relation ) ĊĠĠĠĠĠĠĠ Ġreturn Ġresult Success () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Delete Mapping ("{ id }") ĊĠĠĠ Ġ@ ApiOperation (" delete ById ") ĊĠĠĠ Ġsuspend Ġfun Ġdelete ById (@ PathVariable (" id ") Ġid : ĠLong ): ĠResult Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġattr Group Relation Service . delete ById ( id ) ĊĠĠĠĠĠĠĠ Ġreturn Ġresult Success () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ĊĠĠĠ Ġ@ ApiOperation (" getAll ") ĊĠĠĠ Ġsuspend Ġfun ĠgetAll (): ĠResult Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġattr Group Relations Ġ= Ġattr Group Relation Service . getAll () ĊĠĠĠĠĠĠĠ Ġreturn Ġresult Success (). put (" attr Group Relation ", Ġattr Group Relations . toList ()) ĊĠĠĠ Ġ} Ċ } Ċ