package com.willalp.files.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.willalp.files.domain.HsOrgPersonnelFiles;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

/**
 * 机构人员档案Mapper接口
 *
 * @author willalp
 * @date 2022-08-01
 */
public interface HsOrgPersonnelFilesMapper extends BaseMapper<HsOrgPersonnelFiles> {
    /**
     * 查询机构人员档案列表
     *
     * @param hsOrgPersonnelFiles 机构人员档案
     * @return 机构人员档案集合
     */
    List<HsOrgPersonnelFiles> selectHsOrgPersonnelFilesList(HsOrgPersonnelFiles hsOrgPersonnelFiles);


    @Select("SELECT\n" +
            "\thopf.user_name user_code,\n" +
            "\thopf.nick_name as user_name,\n" +
            "\thopf.phonenumber as phone,\n" +
            "\tsuo.user_type\n" +
            "FROM\n" +
            "\tsys_user hopf\n" +
            "\tleft JOIN sys_user_organization suo on hopf.user_name = suo.login_name\n" +
            "\tWHERE suo.organization_code = 'G00000007' " +
            "AND hopf.user_type = '1'" +
            "AND hopf.del_flag = '0'" +
            "\tGROUP BY hopf.user_name")
    List<HsOrgPersonnelFiles> templateHsOrgPersonnelFilesList();


    /**
     * 流程根据ID获取档案信息
     *
     * @param id
     * @return
     */
    Map<String, Object> flowGetFilesById(@Param("id") String id);
}
