<?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="org.springblade.manager.mapper.SaveUserInfoByProjectMapper">


    <!-- 通用查询映射结果 -->
    <resultMap id="contractInfoResultMap" type="org.springblade.manager.dto.SaveUserInfoByProjectDTO">
        <result column="id" property="id"/>
        <result column="project_id" property="projectId"/>
        <result column="contract_id" property="contractId"/>
        <result column="role_id" property="roleId"/>
        <result column="post_id" property="postId"/>
        <result column="user_id" property="userId"/>
        <result column="create_time" property="createTime"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>


    <select id="queryCurrentUserDownAllContractAndProjectId" resultMap="contractInfoResultMap">
        select project_id, contract_id from m_project_assignment_user where is_deleted = 0 and user_id = #{userId}
    </select>

    <select id="queryProjectBusinessUser" resultMap="contractInfoResultMap">
        select * from m_project_assignment_user where is_deleted = 0 and project_id = #{projectId} and contract_id is NULL
    </select>

</mapper>