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

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.customer.constants.PersonalStatusEnum;
import com.bonus.canteen.core.customer.dto.CustInfoDTO;
import com.bonus.canteen.core.customer.dto.CustPayDTO;
import com.bonus.canteen.core.customer.model.CustInfo;
import com.bonus.canteen.core.customer.service.CustInfoBusiness;
import com.bonus.canteen.core.customer.service.CustInfoService;
import com.bonus.canteen.core.customer.vo.CustInfoVo;
import com.bonus.canteen.core.customer.vo.CustPayVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class CustInfoApi {
   @Resource
   @Lazy
   private CustInfoBusiness custInfoBusiness;
   @Autowired
   @Lazy
   private CustInfoService custInfoService;
//   @Autowired
//   @Lazy
//   private CustInfoMapper custInfoMapper;
//   @Autowired
//   @Lazy
//   private CustInfoBusiness custInfoBusiness;
//   @Lazy
//   @Autowired
//   private AesEncryptUtil aesEncryptUtil;
//   @Autowired
//   @Lazy
//   private CustOrgService custOrgService;
//   @Autowired
//   @Lazy
//   private MenuCustomDictMapper menuCustomDictMapper;
//   @Autowired
//   @Lazy
//   private CustOrgMapper custOrgMapper;
public CustInfoVo queryCustInfo(CustInfoDTO custInfoDTO) {
   return this.custInfoBusiness.queryCustInfo(custInfoDTO);
}
   public CustInfo getNormalOneByCustId(Long custId) {
      return (CustInfo)this.custInfoService.getOne((Wrappers.lambdaQuery(CustInfo.class).eq(CustInfo::getCustId, custId))
              .eq(CustInfo::getCustState, PersonalStatusEnum.NORMAL.getKey()));
   }
   public CustPayVO getCustPayVO(CustPayDTO custPayDTO) {
      return this.custInfoService.getCustPayVO(custPayDTO);
   }

   public CustInfo getCustInfoByCustId(Long custId) {
      return (CustInfo)this.custInfoService.getOne(Wrappers.<CustInfo>lambdaQuery().eq(CustInfo::getCustId, custId));
   }

}
