liyong
8 天以前 1ab2b329a40decba8ff7eefbeb158ff259aceb6d
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
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<MesMdItemTypeRespDTO> getItemType(Long id) {
        MesMdItemTypeDO itemType = itemTypeService.getItemType(id);
        return success(BeanUtils.toBean(itemType, MesMdItemTypeRespDTO.class));
    }
 
    @Override
    public CommonResult<List<MesMdItemTypeRespDTO>> getItemTypeList(Collection<Long> ids) {
        List<MesMdItemTypeDO> list = itemTypeService.getItemTypeList(ids);
        return success(BeanUtils.toBean(list, MesMdItemTypeRespDTO.class));
    }
 
    @Override
    public CommonResult<MesMdItemTypeRespDTO> getItemTypeByCode(String code) {
        MesMdItemTypeDO itemType = itemTypeService.getItemTypeByCode(code);
        return success(BeanUtils.toBean(itemType, MesMdItemTypeRespDTO.class));
    }
 
}