|
@@ -2,11 +2,18 @@ package com.sxtvs.open.api.h5template.controller;
|
|
|
|
|
|
import com.sxtvs.open.api.h5template.entity.H5Template;
|
|
|
import com.sxtvs.open.api.h5template.service.impl.H5TemplateServiceImpl;
|
|
|
+import com.sxtvs.open.api.h5template.service.impl.OSSService;
|
|
|
+import com.sxtvs.open.core.auth.LoginRequired;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -23,9 +30,33 @@ public class H5TemplateController {
|
|
|
@Resource
|
|
|
private H5TemplateServiceImpl h5TemplateService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private OSSService ossService;
|
|
|
+
|
|
|
@PostMapping("store")
|
|
|
+ @LoginRequired
|
|
|
public void store(@RequestBody H5Template h5Template){
|
|
|
- h5TemplateService.save(h5Template);
|
|
|
+ h5TemplateService.store(h5Template);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("list")
|
|
|
+ @LoginRequired
|
|
|
+ public List<H5Template> ls(){
|
|
|
+ return h5TemplateService.list();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("update")
|
|
|
+ @LoginRequired
|
|
|
+ public void update(@RequestBody H5Template h5Template){
|
|
|
+ h5TemplateService.updateById(h5Template);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("upload")
|
|
|
+ @LoginRequired
|
|
|
+ public Map<String, String> upload(MultipartFile file){
|
|
|
+ return new HashMap<>() {{
|
|
|
+ put("url", ossService.commonPut(file));
|
|
|
+ }};
|
|
|
}
|
|
|
|
|
|
}
|