package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gree.mall.manager.bean.admin.AdminDeptWebsitVO;
import com.gree.mall.manager.bean.admin.AdminWebsitVO;
import com.gree.mall.manager.bean.common.SysDictCompanyVO;
import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
import com.gree.mall.manager.plus.entity.AdminUser;
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;

import java.util.List;

@Mapper
public interface AdminMapper {


    /**
     * 商户列表
     */
    @SqlParser(filter = true)
    public IPage<AdminUser> mchList(IPage page,
                                   @Param("userName") String userName,
                                   @Param("nickName") String nickName,
                                   @Param("linkPhone") String linkPhone,
                                   @Param("email") String email,
                                   @Param("status") Boolean status);


    @SqlParser(filter = true)
    public List<AdminCompanyWechat> queryAdminCompanyWechat(@Param("adminUserId") String adminUserId);


    /**
     * 用户列表
     */
    Page<AdminUser> getAdminUser(IPage page,
                                  @Param("roleId") String roleId, @Param("status")Boolean status,
                                  @Param("userName")String userName, @Param("companyWechatIds")List<String> companyWechatIds);

    @SqlParser(filter = true)
    IPage<AdminDeptWebsitVO> list(Page page, @Param("ex") ZfireParamBean zfireParam);

    @Select({ "call batch_update_company_wechat_name("
            + "#{companyWechatId,mode=IN,jdbcType=VARCHAR},"
            + "#{companyWechatName,mode=IN,jdbcType=VARCHAR})"
    })
    @Options(statementType = StatementType.CALLABLE)
    void batchUpdateCompanyWechatName(String companyWechatId, String companyWechatName);

    IPage<SysDictCompanyVO> sysDictCompanyList(Page page,
                                               @Param("ex") ZfireParamBean zfireParam,
                                               @Param("companyWechatIds") List<String> companyWechatIds);

    IPage<AdminWebsitVO> listWebsit(Page page, @Param("ex") ZfireParamBean zfireParam);
}
