package com.bonus.canteen.core.drp.api;

import com.bonus.canteen.core.drp.mapper.DrpUnitMapper;
import com.bonus.canteen.core.drp.model.DrpUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.lang.invoke.SerializedLambda;

@Service
public class DrpUnitServiceApi {
   private static final Logger log = LoggerFactory.getLogger(DrpUnitServiceApi.class);
//   @Autowired
//   @Lazy
//   private DrpUnitService drpUnitService;
   @Autowired
   @Lazy
   private DrpUnitMapper drpUnitMapper;

//   public Long getUnitIdByName(String unitName) {
//      return this.drpUnitMapper.getUnitIdByName(unitName);
//   }

   public void insertUnit(DrpUnit drpUnit) {
      this.drpUnitMapper.insert(drpUnit);
   }

//   public DrpUnit getKgUnitInfo() {
//      return (DrpUnit)this.drpUnitMapper.selectOne((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DrpUnit.class).eq(DrpUnit::getDelFlag, DelFlagEnum.DEL_FALSE.key())).eq(DrpUnit::getUnitName, "公斤"));
//   }

   public Long getUnitIdByNameAndArea(String unitName, Long areaId) {
      return this.drpUnitMapper.getUnitIdByNameAndArea(unitName, areaId);
   }
}
