package com.fzm.mall.server.front.asset.mapper;

import com.fzm.mall.server.front.asset.model.TranOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author fzm
 * @since 2021-09-07
 */
@Mapper
public interface TranOrderMapper extends BaseMapper<TranOrder> {
    @Select("select * from tran_order where uid = #{uid} or seller = #{uid} order by create_time desc limit #{start},#{size}")
    List<TranOrder> getListAll(@Param("uid") String uid, @Param("start") int start, @Param("size") Integer size);

    @Select("select * from tran_order where seller = #{uid} order by create_time desc limit #{start},#{size}")
    List<TranOrder> getListOut(@Param("uid")String uid,  @Param("start") int start, @Param("size")Integer size);

    @Select("select * from tran_order where uid = #{uid} order by create_time desc limit #{start},#{size}")
    List<TranOrder> getListIn(@Param("uid")String uid,  @Param("start") int start, @Param("size")Integer size);
    List<TranOrder> list(@Param("transferId") String transferId,
                         @Param("status") Integer status);

    @Select("select count(*) from tran_order where uid = #{uid} or seller = #{uid}")
    int getAll(@Param("uid") String uid);

    @Select("select count(*) from tran_order where seller = #{uid}")
    int getOut(@Param("uid") String uid);

    @Select("select count(*) from tran_order where uid = #{uid} ")
    int getIn(@Param("uid") String uid);
}
