| | |
| | | } else { |
| | | sysPictureBaseService.insert(sysPictureBase); |
| | | } |
| | | if (sysPictureBase.getIsDefault()==1){ |
| | | if (sysPictureBase.getId()==null){ |
| | | sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType()); |
| | | sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),null); |
| | | }else{ |
| | | if (!sysPictureBase.getId().equals(sysPictureBase.getId())){ |
| | | sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType()); |
| | | sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),sysPictureBase.getId()); |
| | | } |
| | | } |
| | | if (sysPictureBase.getIsDefault() == 1 && sysPictureBase.getProductType()!=20) { |
| | | sysPictureBaseService.updateByDefault(sysPictureBase.getId(), sysPictureBase.getProductType()); |
| | | sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(), sysPictureBase.getProductType(), null); |
| | | } |
| | | return Result.ok(); |
| | | } |
| | |
| | | //关流 |
| | | outputStream.close(); |
| | | in.close(); |
| | | } catch (IOException e) { |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/getSvgImage") |
| | | public void getSvgImage(HttpServletResponse response, Long id) { |
| | | try { |
| | | SysPictureBase data = sysPictureBaseService.get(id); |
| | | String svgContent = data.getSvgContent(); |
| | | response.setContentType("image/svg+xml"); |
| | | response.getWriter().write(svgContent); |
| | | response.getWriter().flush(); |
| | | response.getWriter().close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sysPictureBaseService.getSvgImage(response,id); |
| | | } |
| | | |
| | | @GetMapping("/getDefaultImg") |
| | |
| | | SysPictureBase data = sysPictureBaseService.getDefaultImg(productType); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |