package com.whyc.controller; import com.google.gson.reflect.TypeToken; import com.whyc.dto.Response; import com.whyc.pojo.Software; import com.whyc.service.SoftwareService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.util.List; @RestController @RequestMapping("software") @Api(tags = "软件包") public class SoftwareController { @Autowired private SoftwareService service; @ApiOperation("升级申请") @PostMapping("upgradeApply") public Response upgradeApply(@RequestBody Software software) throws IOException { return service.upgradeApply(software); } /** * * @param file * @param softwareStr 必传序列号,SN编码,版本号 * @return * @throws IOException */ @ApiOperation("上传") @PostMapping("upload") public Response upload(@RequestParam MultipartFile file,@RequestParam String softwareStr) throws IOException { Software software = ActionUtil.getGson().fromJson(softwareStr,Software.class); return service.upload(file,software); } @GetMapping("getPage") public Response getPage(@RequestParam int pageNum,@RequestParam int pageSize, @RequestParam(required = false) String snCode, @RequestParam(required = false) String serialNumber, @RequestParam(required = false) String materialCode){ return service.getPage(pageNum,pageSize,snCode,serialNumber,materialCode); } @GetMapping("getSnCodeList") public Response getSnCodeList(){ return service.getSnCodeList(); } @GetMapping("getSerialNumberList") public Response getSerialNumberList(){ return service.getSerialNumberList(); } @GetMapping("getMaterialCodeList") public Response getMaterialCodeList(){ return service.getMaterialCodeList(); } }