123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.fdkankan.manage.controller;
- import com.fdkankan.manage.common.ResultCode;
- import com.fdkankan.manage.exception.BusinessException;
- import com.fdkankan.manage.common.ResultData;
- import com.fdkankan.common.util.FileMd5Util;
- import com.fdkankan.manage.entity.AppFile;
- import com.fdkankan.manage.service.IAppFileService;
- import com.fdkankan.manage.vo.request.AppFileParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.ObjectUtils;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * 产品管理/app管理
- */
- @RestController
- @RequestMapping("/service/manage/appFile")
- public class AppFileController {
- @Autowired
- IAppFileService appFileService;
- @PostMapping(value = "/upload", consumes = { "multipart/form-data" })
- private ResultData upload(@RequestParam(required = false) MultipartFile file) {
- // 将文件转字节-> 字符串
- return ResultData.ok(appFileService.upload(file));
- }
- @PostMapping(value = "/add")
- private ResultData add(@RequestBody AppFile param) {
- appFileService.saveByParam(param);
- return ResultData.ok();
- }
- @GetMapping(value = "/agentList")
- private ResultData agentList(@RequestParam(required = false) String agentName ) {
- return ResultData.ok(appFileService.agentList(agentName));
- }
- @PostMapping(value = "/list")
- private ResultData list(@RequestBody AppFileParam param) {
- return ResultData.ok(appFileService.pageList(param));
- }
- @PostMapping(value = "/delete")
- private ResultData delete(@RequestBody AppFile param) {
- if(ObjectUtils.isEmpty(param.getId())){
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
- }
- appFileService.removeById(param.getId());
- return ResultData.ok();
- }
- }
|