当前位置:   article > 正文

# base64 转 MultipartFile_图片base64 转换multipartfile java

图片base64 转换multipartfile java

java中Base64编码转MultipartFile工具类

/**
 * @Description: TODO
 * @Author: CL
 * @CreateTime: 2023-11-07  15:13
 * @Version: 1.0
 */
@Service
@Slf4j
public class ExamConfirmServiceImpl extends ServiceImpl<ExamConfirmMapper, ExamConfirm> implements ExamConfirmService {
    @Autowired
    private ExamConfirmMapper examConfirmMapper;
    @Override
    public void insert(ExamConfirm examConfirm) {
        examConfirmMapper.insert(examConfirm);
    }

    @Override
    public void update(ExamConfirm examConfirm) {
        examConfirmMapper.updateById(examConfirm);
    }

    @Override
    public void del(String id) {
        examConfirmMapper.deleteById(id);
    }

    @Override
    public ExamConfirm getInfo(String id) {
        ExamConfirm examConfirm = examConfirmMapper.selectById(id);
        return examConfirm;
    }

    @Override
    public HashMap<String, Object> getList(Page page, QueryExam query) {
        QueryWrapper<ExamConfirm> qw = new QueryWrapper();
        if (StringUtils.isNotBlank(query.getFactoryId())) {
            qw.eq("factory_id", query.getFactoryId());
        }
        if (StringUtils.isNotBlank(query.getStatus())) {
            qw.eq("status", query.getStatus());
        }
        if (StringUtils.isNotBlank(query.getExamTitle())) {
            qw.like("exam_title", query.getExamTitle());
        }
        if (StringUtils.isNotBlank(query.getWorkerId())) {
            qw.like("worker_id", query.getWorkerId());
        }
        qw.orderByDesc("create_time");
        IPage iPage = this.baseMapper.selectPage(page, qw);
        List<Factory> list = iPage.getRecords();
        HashMap<String, Object> pageMap = new HashMap<>();
        HashMap<String, Object> result = new HashMap<>();
        pageMap.put("totalRows", iPage.getTotal());
        pageMap.put("pageSize", iPage.getSize());
        pageMap.put("current", iPage.getCurrent());
        result.put("pagination", pageMap);
        result.put("data", list);
        return result;
    }
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61

测试

    public R convert(@RequestBody String base64) {
        MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(base64);
        upload(file);
        }
  • 1
  • 2
  • 3
  • 4

本文参考与:https://cloud.tencent.com/developer/article/2242674?from=15425

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/399294
推荐阅读
相关标签
  

闽ICP备14008679号