package com.fs.store.mapper;

import java.util.List;
import com.fs.store.domain.FsUserExtract;
import com.fs.store.param.FsUseExtractQueryParam;
import com.fs.store.vo.FsUserExtractVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户提现Mapper接口
 * 
 * @author fs
 * @date 2022-03-15
 */
public interface FsUserExtractMapper 
{
    /**
     * 查询用户提现
     * 
     * @param id 用户提现ID
     * @return 用户提现
     */
    public FsUserExtract selectFsUserExtractById(Long id);

    /**
     * 查询用户提现列表
     * 
     * @param fsUserExtract 用户提现
     * @return 用户提现集合
     */
    public List<FsUserExtract> selectFsUserExtractList(FsUserExtract fsUserExtract);

    /**
     * 新增用户提现
     * 
     * @param fsUserExtract 用户提现
     * @return 结果
     */
    public int insertFsUserExtract(FsUserExtract fsUserExtract);

    /**
     * 修改用户提现
     * 
     * @param fsUserExtract 用户提现
     * @return 结果
     */
    public int updateFsUserExtract(FsUserExtract fsUserExtract);

    /**
     * 删除用户提现
     * 
     * @param id 用户提现ID
     * @return 结果
     */
    public int deleteFsUserExtractById(Long id);

    /**
     * 批量删除用户提现
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteFsUserExtractByIds(Long[] ids);
    @Select({"<script> " +
            "select e.*,u.nickname,u.phone from fs_user_extract e left join fs_user u on u.user_id=e.user_id   " +
            "where 1=1 " +
            "<if test = 'maps.userId != null    '> " +
            "and e.user_id =#{maps.userId} " +
            "</if>" +
            "<if test = 'maps.nickname != null and maps.nickname!=\"\"    '> " +
            "and u.nickname =#{maps.nickname} " +
            "</if>" +
            "<if test = 'maps.status != null     '> " +
            "and e.status =#{maps.status} " +
            "</if>" +
            "<if test = 'maps.phone != null and maps.phone!=\"\"    '> " +
            "and u.phone =#{maps.phone} " +
            "</if>" +
            "<if test = 'maps.createTime != null    '> " +
            " and DATE_FORMAT(e.create_time,'%Y-%m-%d') = DATE_FORMAT(#{maps.createTime},'%Y-%m-%d')" +
            "</if>" +
            " order by create_time desc "+
            "</script>"})
    List<FsUserExtractVO> selectFsUserExtractListVOQuery(@Param("maps") FsUseExtractQueryParam param);
}
