<?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.bonus.material.clz.mapper.IwsProjectMapper">

    <!-- 查询工程及分公司信息 -->
    <select id="selectIwsProjectVoByProjectId" resultType="com.bonus.material.clz.domain.IwsProjectBean">
        select
            project.id as projectId, project.pc_no as projectNo, project.project_name as projectName,
            project.stat as projectStatus, project.oname as orgName, org.org_id as orgId, org.org_id as orgCode
        from
            `data_center`.ods_i8_project_table project
        left join
            `data_center`.wznew_process_config_org org on project.oname = org.name
        where
            project.id = #{projectId}
        limit
            1
    </select>

    <!-- 查询分公司的审核人员配置 -->
    <select id="selectIwsAuditConfigPersonByOrgCode" resultType="com.bonus.material.clz.domain.vo.IwsProjectVo">
        select
            r.id,
            r.role_name as roleName,
            r.org_code as orgCode,
            GROUP_CONCAT(p.cname) as name,
            GROUP_CONCAT(p.cno) as username
        from
            wznew_process_config_role r
        LEFT JOIN
            wznew_process_config_role_personnel p ON r.id = p.role_id
        WHERE
            r.org_code = #{orgCode}
        GROUP BY
            r.id
    </select>
</mapper>