package com.fs.hisStore.mapper;

import com.fs.hisStore.domain.FsStoreExtractScrm;
import com.fs.his.vo.FsStoreExtractVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 店铺提现管理Mapper接口
 *
 * @author fs
 * @date 2023-06-25
 */
public interface FsStoreExtractScrmMapper
{
    /**
     * 查询店铺提现管理
     *
     * @param extractId 店铺提现管理主键
     * @return 店铺提现管理
     */
    public FsStoreExtractScrm selectFsStoreExtractByExtractId(String extractId);

    /**
     * 查询店铺提现管理列表
     *
     * @param fsStoreExtract 店铺提现管理
     * @return 店铺提现管理集合
     */
    public List<FsStoreExtractScrm> selectFsStoreExtractList(FsStoreExtractScrm fsStoreExtract);

    /**
     * 新增店铺提现管理
     *
     * @param fsStoreExtract 店铺提现管理
     * @return 结果
     */
    public int insertFsStoreExtract(FsStoreExtractScrm fsStoreExtract);

    /**
     * 修改店铺提现管理
     *
     * @param fsStoreExtract 店铺提现管理
     * @return 结果
     */
    public int updateFsStoreExtract(FsStoreExtractScrm fsStoreExtract);

    /**
     * 删除店铺提现管理
     *
     * @param extractId 店铺提现管理主键
     * @return 结果
     */
    public int deleteFsStoreExtractByExtractId(String extractId);

    /**
     * 批量删除店铺提现管理
     *
     * @param extractIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsStoreExtractByExtractIds(String[] extractIds);

    @Select({"<script> " +
            "select se.*,fs.store_name name from fs_store_extract se LEFT JOIN fs_store fs ON fs.store_id= se.store_id"+
            "<where>  \n" +
            "            <if test=\"storeId != null  and storeId != ''\"> and se.store_id = #{storeId}</if>\n" +
            "            <if test=\"realName != null  and realName != ''\"> and se.real_name like concat('%', #{realName}, '%')</if>\n" +
            "            <if test=\"extractType != null  and extractType != ''\"> and se.extract_type = #{extractType}</if>\n" +
            "            <if test=\"bankCode != null  and bankCode != ''\"> and se.bank_code = #{bankCode}</if>\n" +
            "            <if test=\"bankAddress != null  and bankAddress != ''\"> and se.bank_address = #{bankAddress}</if>\n" +
            "            <if test=\"alipayCode != null  and alipayCode != ''\"> and se.alipay_code = #{alipayCode}</if>\n" +
            "            <if test=\"extractPrice != null \"> and se.extract_price = #{extractPrice}</if>\n" +
            "            <if test=\"mark != null  and mark != ''\"> and se.mark = #{mark}</if>\n" +
            "            <if test=\"balance != null \"> and se.balance = #{balance}</if>\n" +
            "            <if test=\"failMsg != null  and failMsg != ''\"> and se.fail_msg = #{failMsg}</if>\n" +
            "            <if test=\"failTime != null \"> and  DATE(se.fail_time)= #{failTime}</if>\n" +
            "            <if test=\"status != null \"> and se.status = #{status}</if>\n" +
            "            <if test=\"createTime != null \"> and  DATE(se.create_time) = #{createTime}</if>"+
            "            <if test=\"wechat != null  and wechat != ''\"> and se.wechat = #{wechat}</if>\n" +
            "            <if test=\"isDel != null \"> and se.is_del = #{isDel}</if>\n" +
            "            <if test=\"beginTime != null \">  and DATE(se.create_time) &gt;= DATE(#{beginTime})</if>\n" +
            "            <if test=\"endTime != null \">  and DATE(se.create_time) &lt;= DATE(#{endTime})</if>\n" +
            "        </where>"+
            " order by extract_id desc"+
            "</script>"})
    List<FsStoreExtractVO> selectFsStoreExtractListVO(FsStoreExtractScrm fsStoreExtract);
}
