package com.xzx.gc.user.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import com.xzx.gc.entity.AccountInfo; import com.xzx.gc.entity.AccountLog; import com.xzx.gc.user.mapper.AccountLogMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class AccountLogService { @Autowired private AccountLogMapper accountLogMapper; @Autowired private AccountService accountService; public void add(AccountLog accountLog){ accountLog.setCreateTime(DateUtil.now()); accountLogMapper.insertSelective(accountLog); } public AccountLog findByUserIdAndOrderId(String userId,String flowNo){ AccountInfo byUserIdForbidden = accountService.findByUserIdForbidden(userId); if(byUserIdForbidden!=null){ AccountLog accountLog=new AccountLog(); accountLog.setAccountId(byUserIdForbidden.getAccountId()); accountLog.setOrderId(flowNo); List select = accountLogMapper.select(accountLog); if(CollUtil.isNotEmpty(select)){ return select.get(0); } } return null; } }