<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.zcloud.basic.info.persistence.mapper.UserQualificationInfoMapper">

    <select id="selectQualificationInfoPage" resultType="com.zcloud.basic.info.persistence.dataobject.UserQualificationInfoDO">
        select
            a.id,
            a.user_qualificationinfo_id,
            a.corpinfo_id,
            a.user_id,
            a.qualification_name,
            a.certificate_no,
            a.qualificationinfo_type,
            a.qualificationinfo_category,
            a.qualificationinfo_category_name,
            a.operating_project,
            a.operating_project_name,
            a.delete_enum,
            a.tenant_id,
            a.org_id,
            a.version,
            a.create_time,
            a.update_time,
            a.create_id,
            a.update_id,
            a.create_name,
            a.update_name,
            a.remarks,
            a.env,
            u.name as userName,
            case
                when u.employment_flag = '1' then '在职'
                when u.employment_flag = '0' then '离职'
                else '离职'
            end as employmentFlagName,
            d.name as departmentName
        from user_qualification_info a
        left join user u on a.user_id = u.id
        left join department d on u.department_id = d.id
        ${ew.customSqlSegment}
    </select>

    <select id="selectQualificationInfoList" resultType="com.zcloud.basic.info.persistence.dataobject.UserQualificationInfoDO">
        select
            a.id,
            a.user_qualificationinfo_id,
            a.corpinfo_id,
            a.user_id,
            a.qualification_name,
            a.certificate_no,
            a.qualificationinfo_type,
            a.qualificationinfo_category,
            a.qualificationinfo_category_name,
            a.operating_project,
            a.operating_project_name,
            a.delete_enum,
            a.tenant_id,
            a.org_id,
            a.version,
            a.create_time,
            a.update_time,
            a.create_id,
            a.update_id,
            a.create_name,
            a.update_name,
            a.remarks,
            a.env,
            u.name as userName,
            case
                when u.employment_flag = '1' then '在职'
                when u.employment_flag = '0' then '离职'
                else '离职'
            end as employmentFlagName,
            d.name as departmentName
        from user_qualification_info a
        left join user u on a.user_id = u.id
        left join department d on u.department_id = d.id
        ${ew.customSqlSegment}
    </select>
</mapper>

