package cn.iocoder.yudao.module.bpm.service.oa;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimItemSaveVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAAssetClaimItemMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

/**
 * OA 资产申领明细 Service 实现类
 *
 * @author 符溶馨
 */
@Service
@Validated
public class BpmOAAssetClaimItemServiceImpl implements BpmOAAssetClaimItemService{

    @Resource
    private BpmOAAssetClaimItemMapper assetClaimItemMapper;

    @Override
    public void createAssetClaimItem(List<BpmOAAssetClaimItemSaveVO> createReqVO) {

        List<BpmOAAssetClaimItemDO> items = BeanUtils.toBean(createReqVO, BpmOAAssetClaimItemDO.class);
        assetClaimItemMapper.insertBatch(items);
    }

    @Override
    public List<BpmOAAssetClaimItemDO> getAssetClaimItem(Long assetClaimId) {

        return assetClaimItemMapper.selectList(BpmOAAssetClaimItemDO::getAssetClaimId, assetClaimId);
    }
}
