<?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.IwsTeamUserMapper">

    <select id="selectUserInfoByUserName" resultType="com.bonus.material.clz.domain.vo.IwsTeamUserVo">
        select
            id, name, mobile as userPhone, user_name as userName, id_card as idCard
        from
            `uni_org`.org_user
        <where>
            and (state = 1 or state = 4)
            and user_name = #{userName}
        </where>
        limit 1
    </select>

    <select id="selectProjectTeamInfoByIdCard" resultType="com.bonus.material.clz.domain.vo.IwsTeamUserVo">
        select
        DISTINCT
            bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as relName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
            bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId,
            bzgl_bz.project_name as projectName, org_user.mobile as relPhone
        from
            `micro-tool`.bzgl_bz bzgl_bz
        left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card
        <where>
             bzgl_bz.bz_status = 3
            and bzgl_bz.sfjs = 0
            and bzgl_bz.bzz_idcard = #{idCard}
        </where>
    </select>

    <select id="selectProjectTeamInfoByProjectIds" resultType="com.bonus.material.clz.domain.vo.IwsTeamUserVo">
        select
        DISTINCT
        bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as relName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
        bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId, bzgl_bz.project_name as projectName,
        bzgl_bz.bzz_idcard as teamLeaderIdCard, org_user.mobile as relPhone
        from
        `micro-tool`.bzgl_bz bzgl_bz
        left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card
        WHERE bzgl_bz.project_id IN
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
</mapper>