MemberMapper.xml 1.87 KB
<?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.subsidy.mapper.MemberMapper">

    <select id="queryMembers" resultType="com.subsidy.vo.member.QueryMembersVO">
        SELECT
            t.id AS mappingId,
            t2.id,
            t2.user_name,
            t2.gender,
            t2.telephone,
            t2.payroll_account,
            t2.bank,
            t2.id_card,
            if( t2.open_id IS NULL, '未绑定', '已绑定' ) AS wechatStatus
        FROM
            group_member_mapping t
            LEFT JOIN member t2 ON t.member_id = t2.id
        WHERE
            t2.delete_date IS NULL
            and t.delete_date is null
            AND t.group_id = #{groupId}
            <if test="userInfo != null and userInfo != ''">
                and (t2.user_name like concat('%', #{userInfo},'%') or  t2.telephone like concat('%', #{userInfo},'%') or  t2.id_card like concat('%', #{userInfo},'%')  )
            </if>
    </select>

    <select id="checkTalentMember" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member t
            LEFT JOIN member_role t2 ON t.id = t2.member_id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t2.role_type = 3
            AND (
            t.id_card = #{idCard}
            OR t.telephone = #{telephone})
            <if test=" id != null">
                and t.id != #{id}
            </if>
    </select>

    <select id="checkMember">
        SELECT
        count( 1 )
        FROM
        member t
        LEFT JOIN member_role t2 ON t.id = t2.member_id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND (
        t.id_card = #{idCard}
        OR t.telephone = #{telephone})
    </select>

</mapper>