package com.bonus.canteen.core.supply.purchase.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.canteen.core.supply.purchase.domain.bo.DrpSupplierQualification;
import com.bonus.canteen.core.supply.purchase.mapper.DrpPurchaseSupplierQualificationMapper;
import com.bonus.canteen.core.supply.purchase.service.DrpPurchaseSupplierQualificationService;
import org.springframework.stereotype.Service;

@Service
public class DrpPurchaseSupplierQualificationServiceImpl extends ServiceImpl<DrpPurchaseSupplierQualificationMapper, DrpSupplierQualification> implements DrpPurchaseSupplierQualificationService {
//   private static final Logger log = LoggerFactory.getLogger(DrpSupplierQualificationServiceImpl.class);
//
//   public Page<DrpSupplierQualificationPageVO> getDrpSupplierQualificationPage(DrpSupplierQualificationPageDTO content) {
//      Page<DrpSupplierQualificationPageVO> resultPage = new Page(content.getCurrent(), content.getSize());
//      LambdaQueryWrapper<DrpSupplierQualification> queryWrapper = new LambdaQueryWrapper();
//      queryWrapper.eq(DrpSupplierQualification::getSupplierId, content.getSupplierId());
//      queryWrapper.eq(DrpSupplierQualification::getDelFlag, DelFlagEnum.DEL_FALSE.key());
//      if (CharSequenceUtil.isNotBlank(content.getQualificationNum())) {
//         queryWrapper.eq(DrpSupplierQualification::getQualificationNum, content.getQualificationNum());
//      }
//
//      if (CharSequenceUtil.isNotBlank(content.getQualificationName())) {
//         queryWrapper.like(DrpSupplierQualification::getQualificationName, content.getQualificationName());
//      }
//
//      if (ObjectUtil.isNotEmpty(content.getMainFlag())) {
//         queryWrapper.eq(DrpSupplierQualification::getMainFlag, content.getMainFlag());
//      }
//
//      resultPage = ((DrpSupplierQualificationMapper)this.baseMapper).pageSupplierQualification(resultPage, queryWrapper);
//      return resultPage;
//   }
//
//   public void addDrpSupplierQualification(DrpSupplierQualificationAddDTO content) {
//      String username = SecurityUtils.getUser().getUsername();
//      DrpSupplierQualification qualification = new DrpSupplierQualification();
//      BeanUtil.copyProperties(content, qualification, new String[0]);
//      qualification.setCrby(username);
//      ((DrpSupplierQualificationMapper)this.baseMapper).insert(qualification);
//   }
//
//   public void editDrpSupplierQualification(DrpSupplierQualificationEditDTO content) {
//      String username = SecurityUtils.getUser().getUsername();
//      DrpSupplierQualification qualification = new DrpSupplierQualification();
//      BeanUtil.copyProperties(content, qualification, new String[0]);
//      qualification.setUpby(username);
//      ((DrpSupplierQualificationMapper)this.baseMapper).update(qualification, (Wrapper)Wrappers.lambdaQuery(DrpSupplierQualification.class).eq(DrpSupplierQualification::getId, content.getId()));
//   }
//
//   public void removeBySupplierQualificationId(Long id) {
//      if (ObjectUtil.isEmpty(id)) {
//         log.info("***[库存中心_供应商资质管理]_删除供应商资质_传入的供应商资质id为空************");
//         throw new LeException(I18n.getMessage("drp.select-delete-qualification", new Object[0]));
//      } else {
//         ((DrpSupplierQualificationMapper)this.baseMapper).update((Object)null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DrpSupplierQualification.class).eq(DrpSupplierQualification::getId, id)).set(DrpSupplierQualification::getDelFlag, DelFlagEnum.DEL_TRUE.key()));
//      }
//   }
//
//   public Page<DrpSupplierQualificationExpireVO> expire(DrpSupplierQualificationPageDTO content) {
//      Page<DrpSupplierQualificationExpireVO> resultPage = new Page(content.getCurrent(), content.getSize());
//      resultPage = ((DrpSupplierQualificationMapper)this.baseMapper).expire(resultPage, content);
//      if (CollUtil.isNotEmpty(resultPage.getRecords())) {
//         resultPage.getRecords().forEach((d) -> {
//            if (d.getValidity() != null) {
//               Duration duration = Duration.between(LocalDateTime.now(), d.getValidity().atStartOfDay());
//               d.setExpireDays(duration.toDays());
//            }
//
//         });
//      }
//
//      return resultPage;
//   }
}
