2026-06-29 940c8481d2fdcf51341db4ccd6fd6fcc2d43debb
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
package cn.iocoder.yudao.module.mdm.api.brand;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mdm.api.brand.dto.MdmBrandRespDTO;
import cn.iocoder.yudao.module.mdm.dal.dataobject.brand.MdmBrandDO;
import cn.iocoder.yudao.module.mdm.service.brand.MdmBrandService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Collection;
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
/**
 * MDM 品牌 API 实现类
 *
 * @author 芋道源码
 */
@RestController
@RequestMapping(MdmBrandApi.PREFIX)
@Validated
public class MdmBrandApiImpl implements MdmBrandApi {
 
    @Resource
    private MdmBrandService brandService;
 
    @Override
    public CommonResult<MdmBrandRespDTO> getBrand(Long id) {
        MdmBrandDO brand = brandService.getBrand(id);
        return success(BeanUtils.toBean(brand, MdmBrandRespDTO.class));
    }
 
    @Override
    public CommonResult<List<MdmBrandRespDTO>> getBrandList(Collection<Long> ids) {
        List<MdmBrandDO> list = brandService.getBrandList(ids);
        return success(BeanUtils.toBean(list, MdmBrandRespDTO.class));
    }
 
    @Override
    public CommonResult<MdmBrandRespDTO> validateBrandExists(Long id) {
        MdmBrandDO brand = brandService.validateBrandExists(id);
        return success(BeanUtils.toBean(brand, MdmBrandRespDTO.class));
    }
 
    @Override
    public CommonResult<MdmBrandRespDTO> getBrandByCode(String code) {
        MdmBrandDO brand = brandService.getBrandByCode(code);
        return success(BeanUtils.toBean(brand, MdmBrandRespDTO.class));
    }
 
}