zepengdev
2025-06-14 6e0a83c55db4bae4d23a4c281946bda1d610f678
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
package com.oying.modules.pc.category.converter;
 
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.oying.modules.pc.category.domain.PlatformCategory;
import com.oying.modules.pc.category.domain.dto.PlatformCategoryCreateRequest;
import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateDto;
import com.oying.modules.pc.utils.ImageUtils;
 
public class PlatformCategoryAssembler {
 
    public static PlatformCategory to(PlatformCategoryCreateRequest request) {
        PlatformCategory platformCategory = new PlatformCategory();
        BeanUtil.copyProperties(request, platformCategory, CopyOptions.create().setIgnoreNullValue(true));
        platformCategory.setIconId(request.getIconUploadFileId());
        platformCategory.setIconUrl(ImageUtils.getPublicObjectUrl(request.getIconUploadFileId()));
        return platformCategory;
    }
 
    public static PlatformCategory to(PlatformCategoryUpdateDto updateDto) {
        PlatformCategory platformCategory = new PlatformCategory();
        BeanUtil.copyProperties(updateDto, platformCategory, CopyOptions.create().setIgnoreNullValue(true));
        platformCategory.setIconId(updateDto.getIconUploadFileId());
        platformCategory.setIconUrl(ImageUtils.getPublicObjectUrl(updateDto.getIconUploadFileId()));
        return platformCategory;
    }
 
}