package com.bonus.canteen.core.auth.user.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.auth.user.entity.MgrUserInSystem;
import com.bonus.canteen.core.merchant.vo.MercMerchantEndTimeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MgrUserInSystemMapper extends BaseMapper<MgrUserInSystem> {
   MercMerchantEndTimeVO selectMerchantByMerchantId(Long merchantId);

   @Select({"select username, password from mgr_user ${ew.customSqlSegment}"})
   MgrUserInSystem selectPasswordByUserId(@Param("ew") Wrapper<MgrUserInSystem> wrapper);

   @Select({"select tenant_id from merc_merchant where third_merchant_id = #{thirdMerchantId}"})
   Long selectMerchantIdByThird(String thirdMerchantId);

   @Select({"select user_type from mgr_user where username = #{username} and del_flag = #{delFlag}"})
   Integer selectUserTypeByUsername(@Param("username") String username, @Param("delFlag") Integer delFlag);
}
