package com.yonge.cooleshow.biz.dal.dao;

import java.math.BigDecimal;
import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.cooleshow.biz.dal.dto.UserAccountRecordDto;
import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
import com.yonge.cooleshow.biz.dal.vo.res.AccountShareTotal;
import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
import org.apache.ibatis.annotations.Param;
import com.yonge.cooleshow.biz.dal.entity.UserAccount;
import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
import com.yonge.cooleshow.biz.dal.dto.search.UserAccountSearch;


public interface UserAccountDao extends BaseMapper<UserAccount> {
    /**
     * 查询详情
     *
     * @author liweifan
     * @date 2022-03-30 13:53:51
     * @return: com.yonge.cooleshow.biz.dal.vo.UserAccountVo
     */
    UserAccountVo detail(@Param("id") Long id);

    /**
     * 分页查询
     *
     * @author liweifan
     * @date 2022-03-30 13:53:51
     * @return: com.yonge.cooleshow.biz.dal.vo.UserAccountVo
     */
    List<UserAccountVo> selectPage(@Param("page") IPage page, @Param("param") UserAccountSearch userAccount);

    /***
     * 账户变更(冻结)
     * @author liweifan
     * @param: userId
     * @param: transAmount
     * @updateTime 2022/4/7 17:54
     * @return: java.lang.Integer
     */
    Integer frozenChangeAccount(@Param("userId") Long userId, @Param("transAmount") BigDecimal transAmount, @Param("inOrOut") String inOrOut);

    /***
     * 账户变更(冻结后交易成功)
     * @author liweifan
     * @param: userId
     * @param: transAmount
     * @updateTime 2022/4/7 17:54
     * @return: java.lang.Integer
     */
    Integer frozenDeductChangeAccount(@Param("userId") Long userId, @Param("transAmount") BigDecimal transAmount, @Param("inOrOut") String inOrOut);

    /***
     * 账户变更(冻结后交易退回)
     * @author liweifan
     * @param: userId
     * @param: transAmount
     * @updateTime 2022/4/7 17:54
     * @return: java.lang.Integer
     */
    Integer frozenBackChangeAccount(@Param("userId") Long userId, @Param("transAmount") BigDecimal transAmount, @Param("inOrOut") String inOrOut);

    /***
     * 账户变更（余额）
     * @author liweifan
     * @param: userId
     * @param: transAmount
     * @updateTime 2022/4/7 19:11
     * @return: java.lang.Integer
     */
    Integer changeAccount(@Param("userId") Long userId, @Param("transAmount") BigDecimal transAmount, @Param("inOrOut") String inOrOut);

    /***
     * 收入统计
     * @author liweifan
     * @param: totalReq
     * @updateTime 2022/4/24 13:53
     * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.res.AccountTotal>
     */
    List<AccountTotal> accountTotal(@Param("timeType") String timeType, @Param("param") TotalReq totalReq);

    /**
     * 统计本次变更前已经变更的金额
     *
     * @param orderNo
     * @return
     */
    BigDecimal totalTransAmountByOrderNo(@Param("orderNo") String orderNo);

    AccountShareTotal accountShareTotal(@Param("param") TotalReq query);
}