Blame view

CompanyDictMapper.xml 3.07 KB
涂亚平 committed
1 2 3 4 5 6
<?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.CompanyDictMapper">

    <select id="operators"  resultType="com.subsidy.dto.company.OperatorsVO">
        SELECT
涂亚平 committed
7 8 9 10 11 12 13
        t1.*,
        t2.account_name,
        t2.`password`
        FROM
        (
        SELECT DISTINCT
        t2.id AS companyId,
涂亚平 committed
14 15 16 17 18 19 20
        t2.banner,
        t2.short_name,
        t2.company_name,
        t2.logo,
        t2.address,
        t2.supervise_name,
        t2.company_code,
涂亚平 committed
21
        t2.area_name
涂亚平 committed
22 23
        FROM
        company_dict t2
涂亚平 committed
24
        LEFT JOIN company_field_mapping t3 ON t2.id = t3.company_id
涂亚平 committed
25
        WHERE
涂亚平 committed
26 27
        t2.delete_date IS NULL
        AND t3.delete_date IS NULL
涂亚平 committed
28 29 30
        <if test="companyName != null and companyName != ''">
            and t2.company_name like concat('%',#{companyName} ,'%')
        </if>
涂亚平 committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44
        ) t1
        LEFT JOIN (
        SELECT
        t.company_id,
        t2.account_name,
        t2.`password`
        FROM
        administer_company_mapping t
        LEFT JOIN administer t2 ON t.administer_id = t2.id
        WHERE
        t2.role = 3
        and t.delete_date IS NULL
        and t2.delete_date IS NULL
        ) t2 ON t1.companyId = t2.company_id
涂亚平 committed
45
        <if test="fieldId != null and fieldId != ''">
涂亚平 committed
46
            and t1.field_id = #{fieldId}
涂亚平 committed
47 48
        </if>
        <if test="superviseName != null and superviseName != ''">
涂亚平 committed
49
            and t1.supervise_name =#{superviseName}
涂亚平 committed
50
        </if>
涂亚平 committed
51
        order by t1.companyId
涂亚平 committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    </select>


    <select id="getCompanyMembers" resultType="com.subsidy.vo.company.GetCompanyMembersVO">
        SELECT
        t.id,
        t.user_name,
        t.id_card,
        ifnull( t.id_card_photo, '尚未完成' ) AS id_card_photo,
        t2.company_name,
        if(t.first_login =1,'是','否') as first_login,
        ifnull( t.check_image, '尚未完成' ) AS check_image,
        t.check_time,
        t.telephone,
        t.account_name,
        t5.member_status
        FROM
        member t
        left join 	( SELECT
        t2.company_id,t2.member_status,t3.member_id
        FROM
        ( SELECT t.member_id, max( t.id ) AS id FROM company_member_mapping t GROUP BY t.member_id ) t3
        LEFT JOIN company_member_mapping t2 ON  t3.id = t2.id and t2.delete_date is null ) t5 on t5.member_id = t.id
        LEFT JOIN company_dict t2 ON t5.company_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        <if test="companyId != null and companyId != ''">
            and t5.company_id = #{companyId}
        </if>
        <if test="userName != null and userName != ''">
            and (t.user_name like concat('%',#{userName} ,'%')  or t.telephone like concat('%',#{userName} ,'%') )
        </if>
        <if test="memberStatus == 1">
            and t5.member_status = #{memberStatus}
        </if>
        <if test="memberStatus == 0">
            and ( t5.member_status = #{memberStatus} or t5.member_status is null)
        </if>
涂亚平 committed
91
        and t.member_type = 2
涂亚平 committed
92 93 94
    </select>

</mapper>