<?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.ruoyi.oa.mapper.OaRequirementsMapper">

    <resultMap type="com.ruoyi.oa.domain.OaRequirements" id="OaRequirementsResult">
        <result property="requirementId" column="requirement_id"/>
        <result property="title" column="title"/>
        <result property="requesterId" column="requester_id"/>
        <result property="ownerId" column="owner_id"/>
        <result property="projectId" column="project_id"/>
        <result property="description" column="description"/>
        <result property="deadline" column="deadline"/>
        <result property="status" column="status"/>
        <result property="remark" column="remark"/>
        <result property="accessory" column="accessory"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>

    </resultMap>
    <select id="selectVoListPage" resultType="com.ruoyi.oa.domain.vo.OaRequirementsVo">
        SELECT
        r.*,
        u1.nick_name AS requester_nick_name,
        u2.nick_name AS owner_nick_name,
        p.project_name
        FROM oa_requirements r
        LEFT JOIN sys_user u1 ON r.requester_id = u1.user_id
        LEFT JOIN sys_user u2 ON r.owner_id = u2.user_id
        LEFT JOIN sys_oa_project p ON r.project_id = p.project_id
        ${ew.customSqlSegment}
    </select>

    <select id="selectVoListForExport" resultType="com.ruoyi.oa.domain.vo.OaRequirementsVo">
        SELECT
        r.*,
        u1.nick_name AS requester_nick_name,
        u2.nick_name AS owner_nick_name,
        p.project_name
        FROM oa_requirements r
        LEFT JOIN sys_user u1 ON r.requester_id = u1.user_id
        LEFT JOIN sys_user u2 ON r.owner_id = u2.user_id
        LEFT JOIN sys_oa_project p ON r.project_id = p.project_id
        ${ew.customSqlSegment}
    </select>

</mapper>
