package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
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 {


    /**
     * 商户列表
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    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);


    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    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("companyIds")List<String> companyIds);

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    IPage<AdminDeptWebsitVO> list(Page page, @Param("ex") ZfireParamBean zfireParam);

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

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

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