2026-07-01 6b5f7c66fc40d7f6099d561e31a34fbd50dd20d3
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/api/brand/MdmBrandApiImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,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));
    }
}