|
|
@@ -1,15 +1,20 @@
|
|
|
package com.goafanti.standard.controller;
|
|
|
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AttachmentType;
|
|
|
import com.goafanti.common.model.StandardDocument;
|
|
|
+import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.standard.bo.InputStandardList;
|
|
|
+import com.goafanti.standard.bo.OutStandardDocument;
|
|
|
import com.goafanti.standard.service.StandardService;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/api/admin/standard")
|
|
|
@@ -26,7 +31,7 @@ public class StandardApiController extends CertifyApiController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
public Result list(InputStandardList in) {
|
|
|
- Result res = res();
|
|
|
+ Result res = new Result<Pagination<OutStandardDocument>>();
|
|
|
return res.data(standardService.list(in));
|
|
|
}
|
|
|
/**
|
|
|
@@ -73,4 +78,21 @@ public class StandardApiController extends CertifyApiController {
|
|
|
Result res = res();
|
|
|
return res.data(standardService.update(in));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 图片上传
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
|
|
|
+ public Result uploadPicture(HttpServletRequest req, String sign) {
|
|
|
+ Result res = new Result();
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+
|
|
|
+ if (attachmentType == AttachmentType.STANDARD_DOCUMENT
|
|
|
+ ) {
|
|
|
+ res.setData(handleFiles(res, "/standard/", false, req, sign, ""));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "图片"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|