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.IcGeneralInB;
import com.hzs.common.domain.scm.general.ext.IcGeneralInBExt;
import com.hzs.scm.general.mapper.IcGeneralInBMapper;
import com.hzs.scm.general.service.IIcGeneralInBService;
import org.springframework.stereotype.Service;

import java.util.List;

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

    @Override
    public List<IcGeneralInBExt> queryGeneralInbByPk(Integer orderType, List<IcGeneralInBExt> icGeneralInbExtList) {
        return baseMapper.queryGeneralInbByList(orderType, icGeneralInbExtList);
    }

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

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

    @Override
    public void deleteGeneralItemsByPkGeneral(Long pkGeneral, Long pkMember) {
        UpdateWrapper<IcGeneralInB> 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);
    }
}
