package cn.iocoder.yudao.module.mes.api.item; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemTypeRespDTO; import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemTypeService; 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; /** * MES 物料分类 API 实现类 * * @author 芋道源码 */ @RestController @RequestMapping(MesMdItemTypeApi.PREFIX) @Validated public class MesMdItemTypeApiImpl implements MesMdItemTypeApi { @Resource private MesMdItemTypeService itemTypeService; @Override public CommonResult getItemType(Long id) { MesMdItemTypeDO itemType = itemTypeService.getItemType(id); return success(BeanUtils.toBean(itemType, MesMdItemTypeRespDTO.class)); } @Override public CommonResult> getItemTypeList(Collection ids) { List list = itemTypeService.getItemTypeList(ids); return success(BeanUtils.toBean(list, MesMdItemTypeRespDTO.class)); } @Override public CommonResult getItemTypeByCode(String code) { MesMdItemTypeDO itemType = itemTypeService.getItemTypeByCode(code); return success(BeanUtils.toBean(itemType, MesMdItemTypeRespDTO.class)); } }