4 changed files with 113 additions and 1 deletions
@ -0,0 +1,105 @@ |
|||||
|
package com.easy.admin.modules.huzhou.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.easy.admin.common.api.vo.Result; |
||||
|
import com.easy.admin.common.core.exception.EasyException; |
||||
|
import com.easy.admin.modules.huzhou.entity.HuzhouInformationMaterial; |
||||
|
import com.easy.admin.modules.huzhou.service.IHuzhouInformationMaterialService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.IOException; |
||||
|
|
||||
|
/** |
||||
|
* @author gjh |
||||
|
* 标志性成果 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/huzhouInformationMaterial/result") |
||||
|
public class HuzhouInformationMaterialResultController { |
||||
|
@Autowired |
||||
|
private IHuzhouInformationMaterialService informationMaterialService; |
||||
|
|
||||
|
/** |
||||
|
* 查询信息材料分页 |
||||
|
* @param informationMaterial 条件 |
||||
|
* @param pageNo 分页 |
||||
|
* @param pageSize 页码 |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/informationMaterialPageList") |
||||
|
public Result<?> informationMaterialPageList(HuzhouInformationMaterial informationMaterial, |
||||
|
@RequestParam(name="current", defaultValue="1") Integer pageNo, |
||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){ |
||||
|
Page<HuzhouInformationMaterial> pageList = informationMaterialService.getInformationMaterialPageList(informationMaterial, pageNo, pageSize); |
||||
|
return Result.ok(pageList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id获取详情信息材料 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getInformationMaterialById") |
||||
|
public Result<?> getInformationMaterialById(String id){ |
||||
|
HuzhouInformationMaterial byId = informationMaterialService.getById(id); |
||||
|
return Result.ok(byId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加信息材料 |
||||
|
* @param file |
||||
|
* @param informationMaterial |
||||
|
* @return |
||||
|
* @throws IOException |
||||
|
*/ |
||||
|
@PostMapping("/addInformationMaterial") |
||||
|
public Result<?> addInformationMaterial(@RequestParam(value = "file") MultipartFile file, HuzhouInformationMaterial informationMaterial) throws IOException { |
||||
|
informationMaterialService.addInformationMaterial(file,informationMaterial); |
||||
|
return Result.ok("上传成功"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改信息材料 |
||||
|
* @param file |
||||
|
* @param informationMaterial |
||||
|
* @return |
||||
|
* @throws IOException |
||||
|
*/ |
||||
|
@PostMapping("/modifyInformationMaterial") |
||||
|
public Result<?> modifyInformationMaterial(@RequestParam(value = "file",required = false) MultipartFile file, HuzhouInformationMaterial informationMaterial) throws IOException { |
||||
|
Boolean aBoolean = informationMaterialService.modifyInformationMaterial(file, informationMaterial); |
||||
|
if(aBoolean){ |
||||
|
return Result.ok("修改成功"); |
||||
|
} |
||||
|
throw new EasyException("修改失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除信息材料 |
||||
|
* @param informationMaterial |
||||
|
* @return |
||||
|
* @throws IOException |
||||
|
*/ |
||||
|
@PostMapping("/deleteInformationMaterial") |
||||
|
public Result<?> deleteInformationMaterial(@RequestBody HuzhouInformationMaterial informationMaterial) throws IOException { |
||||
|
Boolean aBoolean = informationMaterialService.deleteInformationMaterial(informationMaterial); |
||||
|
if(aBoolean){ |
||||
|
return Result.ok("删除成功"); |
||||
|
} |
||||
|
throw new EasyException("删除失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量下载 |
||||
|
* @param informationMaterial |
||||
|
* @param response |
||||
|
*/ |
||||
|
@GetMapping("/batchdownloadInformationMaterialFiles") |
||||
|
public void batchdownloadInformationMaterialFiles(HuzhouInformationMaterial informationMaterial, HttpServletResponse response){ |
||||
|
informationMaterialService.batchdownloadInformationMaterialFiles(informationMaterial,response); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue