| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = "contentType", value = "检索关键字", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "系统标识", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")}) |
| | | public PageResult<SysPictureBase> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | @ApiImplicitParam(name = "productType", value = "检索关键字", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "系统标识", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")}) |
| | | public Result<List<SysPictureBase>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | |
| | | return PageResult.ok(sysPictureBaseService.page(queryFilter)); |
| | | return Result.ok(sysPictureBaseService.page(queryFilter)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | |
| | | @PostMapping("save") |
| | | @ApiOperation("保存") |
| | | @LogOperation("保存") |
| | | public Result save(@RequestBody MultipartFile file, Long id, String type, String subType, |
| | | String name, String contentType, String systemMark, Integer sortNo, String remark) { |
| | | public Result save(@RequestBody MultipartFile file, Long id, Integer isDefault, |
| | | String name, String contentType, Integer productType, String remark) { |
| | | SysPictureBase sysPictureBase; |
| | | if (id != 0) { |
| | | sysPictureBase = sysPictureBaseService.get(id); |
| | | sysPictureBase.setType(type); |
| | | sysPictureBase.setSubType(subType); |
| | | sysPictureBase.setIsDefault(isDefault); |
| | | sysPictureBase.setName(name); |
| | | sysPictureBase.setContentType(contentType); |
| | | sysPictureBase.setSystemMark(systemMark); |
| | | sysPictureBase.setSortNo(sortNo); |
| | | sysPictureBase.setProductType(productType); |
| | | sysPictureBase.setRemark(remark); |
| | | sysPictureBaseService.update(sysPictureBase); |
| | | } else { |
| | | sysPictureBase = new SysPictureBase(); |
| | | sysPictureBase.setType(type); |
| | | sysPictureBase.setSubType(subType); |
| | | sysPictureBase.setIsDefault(isDefault); |
| | | sysPictureBase.setName(name); |
| | | sysPictureBase.setContentType(contentType); |
| | | sysPictureBase.setSystemMark(systemMark); |
| | | Integer no = sysPictureBaseService.getNo(); |
| | | sysPictureBase.setSortNo(no + 1); |
| | | sysPictureBase.setProductType(productType); |
| | | sysPictureBase.setRemark(remark); |
| | | sysPictureBaseService.insert(sysPictureBase); |
| | | } |
| | | if (sysPictureBase.getIsDefault()==1){ |
| | | sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType()); |
| | | sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType()); |
| | | } |
| | | if (file != null) { |
| | | BufferedImage bufferedImage = null; |
| | |
| | | byte[] buff = new byte[1024]; |
| | | //所读取的内容使用n来接收 |
| | | int n; |
| | | //当没有读取完时,继续读取,循环 |
| | | //当没有读 |
| | | //取完时,继续读取,循环 |
| | | while ((n = in.read(buff)) != -1) { |
| | | //将字节数组的数据全部写入到输出流中 |
| | | outputStream.write(buff, 0, n); |