package com.hzs.scm.general.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.ScmFieldConstants;
import com.hzs.common.core.constant.SystemFieldConstants;
import com.hzs.common.core.enums.EYesNo;
import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.domain.scm.general.IcGeneralOutB;
import com.hzs.common.domain.scm.general.ext.IcGeneralOutBExt;
import com.hzs.scm.general.mapper.IcGeneralOutBMapper;
import com.hzs.scm.general.service.IIcGeneralOutBService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 其他入库单明细 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2023-11-27
 */
@Service
public class IcGeneralOutBServiceImpl extends ServiceImpl<IcGeneralOutBMapper, IcGeneralOutB> implements IIcGeneralOutBService {

    @Override
    public List<IcGeneralOutBExt> queryGeneralOutBiByList(Integer orderType, List<IcGeneralOutBExt> icGeneralOutbExtList) {
        return baseMapper.queryGeneralOutBiByPk(orderType, icGeneralOutbExtList);
    }

    @Override
    public List<IcGeneralOutBExt> queryGeneralOutBiByPK(Integer pkCountry, Long pkOrder) {
        return baseMapper.queryGeneralOutBiByPK(pkCountry, pkOrder);
    }

    @Override
    public void deleteGeneralItemsByList(List<IcGeneralOutB> icGeneralOutbList, Long pkMember) {
        baseMapper.deleteGeneralItemsByList(icGeneralOutbList, pkMember);
    }

    @Override
    public void deleteGeneralItemsByPkGeneral(Long pkGeneral, Long pkMember) {
        UpdateWrapper<IcGeneralOutB> updateWrapper = new UpdateWrapper<>();
        updateWrapper.set(SystemFieldConstants.DEL_FLAG, EYesNo.NO.getIntValue());
        updateWrapper.set(SystemFieldConstants.PK_MODIFIED, pkMember);
        updateWrapper.set(SystemFieldConstants.MODIFIED_TIME, DateUtils.currentDateTime());
        updateWrapper.eq(ScmFieldConstants.PK_GENERAL, pkGeneral);
        update(updateWrapper);
    }
}
