package cn.com.ty.lift.ud.applyExpert.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import cn.com.ty.lift.ud.applyExpert.controller.query.ApplyExpertQuery;
import cn.com.ty.lift.ud.applyExpert.mapper.entity.ApplyExpert;

/**
 * 专家申请表-Repository
 * 
 * @author Xson
 * @date 2020-05-16
 */
public interface ApplyExpertMapper extends BaseMapper<ApplyExpert> {

    @Update("UPDATE apply_expert SET check_flag=#{falg} WHERE id=#{id} ")
    void examineById(@Param("id") Long id, @Param("falg") Integer falg);
    
    @Update("UPDATE apply_expert SET check_flag=0 WHERE user_id=#{userId} ")
    void updateStatusByUserId(@Param("userId")String userId);
    
    List<ApplyExpert> selectByQuery(@Param("ew") Wrapper wrapper, @Param("page") ApplyExpertQuery page);

    int countByQuery(@Param("ew") Wrapper wrapper);
    
    @Select(" SELECT * FROM apply_expert WHERE user_id=#{userId}")
    ApplyExpert getByUserId(@Param("userId")Long userId);
}
