package com.winsun.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.SysUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 用户表的Mapper
 */
@Mapper
@Component
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Insert("insert into `hhr_user_school` (user_id,school_id) values(#{userId},#{schoolId})")
    Integer insertUserSchool(@Param("userId")String userId,@Param("schoolId")String schoolId);

    @Select("SELECT s.id id,s.name name,s.account account,hs.school_name school,hs.sub_name area \n" +
            "FROM sys_user s,hhr_user_school hus,hhr_school hs\n" +
            "where s.id = hus.user_id\n" +
            "and hus.school_id = hs.id\n" +
            "and s.id = #{id} ")
    List<Map<String,Object>> findPartnerById(@Param("id")String id);
}
