src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -6,7 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import java.util.List; public interface DappFundFlowDao extends BaseMapper<DappFundFlowEntity> { IPage<DappFundFlowEntity> selectInPage(Page<DappFundFlowEntity> page, @Param("record") DappFundFlowEntity dappFundFlowEntity); List<DappFundFlowEntity> selectListForMemberAndDay(@Param("memberId") Long memberId, @Param("type") int type); } src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -11,6 +11,7 @@ import cc.mrbird.febs.dapp.mapper.*; import cc.mrbird.febs.dapp.service.DappWalletService; import cc.mrbird.febs.dapp.vo.WalletInfoVo; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; @@ -93,6 +94,11 @@ public void withdraw(WalletOperateDto walletOperateDto) { DappMemberEntity member = LoginUserUtil.getAppUser(); List<DappFundFlowEntity> fundFlows = dappFundFlowDao.selectListForMemberAndDay(member.getId(), 2); if (CollUtil.isNotEmpty(fundFlows)) { throw new FebsException("一天只能提现一次"); } DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId()); if (walletOperateDto.getAmount().compareTo(walletCoin.getAvailableAmount()) > 0) { throw new FebsException("可用金额不足"); src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -21,4 +21,10 @@ </where> order by a.create_time desc </select> <select id="selectListForMemberAndDay" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity"> select * from dapp_fund_flow where member_id=#{memberId} and date_format(create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d') and type=#{type} </select> </mapper>