package Ġcn . it xia . api . controller Ċ Ċ import Ġcn . it xia . api . annotation . Current It xia Member Ċ import Ġcn . it xia . api . model . It xia Member Ċ import Ġcn . it xia . api . response . Response Ċ import Ġcn . it xia . api . service . Attachment Service Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . web . bind . annotation .* Ċ import Ġorg . springframework . web . multipart . Multipart File Ċ import Ġjavax . servlet . http . HttpServletResponse Ċ Ċ /** Ċ Ġ* Ġ éĻĦ ä»¶ ä¸Ĭä¼ł / ä¸ĭè½½ . Ċ Ġ* Ġ*/ Ċ @ RestController Ċ class ĠAttachment Controller Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġattachment Service : ĠAttachment Service ĊĊĠĠĠ Ġ@ PostMapping ("/ upload ") ĊĠĠĠ Ġfun Ġupload (@ RequestParam (" file ") Ġfile : ĠMultip art File , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ Current It xia Member Ġit xia Member : ĠI tx ia Member ?): ĠResponse Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġattachment Service . handle Upload ( file , Ġit xia Member ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ("/ upload /{ _ id }") ĊĠĠĠ Ġfun ĠgetFile (@ PathVariable Ġ_ id : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestParam ( required Ġ= Ġfalse ) Ġthumbnail : ĠString ?, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestParam ( required Ġ= Ġfalse ) Ġdownload : ĠString ?, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse : ĠHttpServletResponse ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġis Download Ġ= Ġdownload Ġ!= Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġis Thumbnail Ġ= Ġthumbnail Ġ!= Ġnull ĊĠĠĠĠĠĠĠ Ġattachment Service . getFile (_ id , Ġis Download , Ġis Thumbnail , Ġresponse ) ĊĠĠĠ Ġ} Ċ } ĊĊ