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));
|
}
|
|
}
|