package com.fs.his.mapper;

import com.fs.his.domain.FsUserExtract;
import com.fs.his.param.FsUserExtractParam;
import com.fs.his.vo.FsUserExtractVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户提现管理Mapper接口
 *
 * @author fs
 * @date 2023-06-25
 */
public interface FsUserExtractMapper
{
    /**
     * 查询用户提现管理
     *
     * @param extractId 用户提现管理主键
     * @return 用户提现管理
     */
    public FsUserExtract selectFsUserExtractByExtractId(String extractId);

    /**
     * 查询用户提现管理列表
     *
     * @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 extractId 用户提现管理主键
     * @return 结果
     */
    public int deleteFsUserExtractByExtractId(String extractId);

    /**
     * 批量删除用户提现管理
     *
     * @param extractIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsUserExtractByExtractIds(String[] extractIds);
    @Select({"<script> " +
            "select fue.*,fu.nick_name ,fu.phone from fs_user_extract fue LEFT JOIN fs_user fu ON fu.user_id =fue.user_id"+
            "  <where>  \n" +
            "            <if test=\"userId != null  and userId != ''\"> and fue.user_id = #{userId}</if>\n" +
            "            <if test=\"realName != null  and realName != ''\"> and fue.real_name like concat( #{realName}, '%')</if>\n" +
            "            <if test=\"phone != null  and phone != ''\"> and fu.phone like concat( #{phone}, '%')</if>\n" +
            "            <if test=\"nickName != null  and nickName != ''\"> and fue.nick_name like concat( #{nickName}, '%')</if>\n" +
            "            <if test=\"extractType != null  and extractType != ''\"> and fue.extract_type = #{extractType}</if>\n" +
            "            <if test=\"bankCode != null  and bankCode != ''\"> and fue.bank_code = #{bankCode}</if>\n" +
            "            <if test=\"bankAddress != null  and bankAddress != ''\"> and fue.bank_address = #{bankAddress}</if>\n" +
            "            <if test=\"failMsg != null  and failMsg != ''\"> and fue.fail_msg = #{failMsg}</if>\n" +
            "            <if test=\"failTime != null \"> and DATE(fue.fail_time) = #{failTime}</if>\n" +
            "            <if test=\"status != null \"> and fue.status = #{status}</if>\n" +
            "            <if test=\"createTime != null \"> and  DATE(fue.create_time) = #{createTime}</if>\n" +
            "            <if test=\"isDel != null \"> and fue.is_del = #{isDel}</if>\n" +
            "            <if test=\"sTime != null \">  and DATE(so.create_time) &gt;= DATE(#{sTime})</if>\n" +
            "            <if test=\"eTime != null \">  and DATE(so.create_time) &lt;= DATE(#{eTime})</if>\n" +
            "        </where>"+
            "        order by extract_id desc" +
            "</script>"})
    List<FsUserExtractVO> selectFsUserExtractListVO(FsUserExtractParam fsUserExtract);
}
