Blame view

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


6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    <select id="allOperators" resultType="com.subsidy.vo.administer.OperatorsVO">
        SELECT
        distinct
        t2.id as companyId,
        t2.banner,
        t2.short_name,
        t2.company_name,
        t2.logo,
        t2.address,
        t2.supervise_name,
        t2.company_code,
        t2.area_name
        FROM
        company_dict t2
        left join company_field_mapping t3 on t2.id = t3.company_id
        left join service_company_mapping t4 on t2.id = t4.company_id
        WHERE
        t2.delete_date is null
        and t3.delete_date is null
        and service_id = 1
        and t4.delete_date is null
        <if test="companyName != null and companyName != ''">
            and t2.company_name like concat('%',#{companyName} ,'%')
        </if>
        <if test="fieldId != null and fieldId != ''">
            and t3.field_id = #{fieldId}
        </if>
        <if test="superviseName != null and superviseName != ''">
            and t2.supervise_name =#{superviseName}
        </if>
    </select>
涂亚平 committed
37 38 39

    <select id="operators"  resultType="com.subsidy.vo.administer.OperatorsVO">
        SELECT
40 41 42 43 44 45 46 47 48 49
        distinct
        t2.id as companyId,
        t2.banner,
        t2.short_name,
        t2.company_name,
        t2.logo,
        t2.address,
        t2.supervise_name,
        t2.company_code,
        t2.area_name
涂亚平 committed
50
        FROM
51 52 53 54
        company_dict t2
        left join administer_company_mapping t4 on t2.id = t4.company_id
        left join company_field_mapping t3 on t2.id = t3.company_id
        left join service_company_mapping t5 on t2.id = t5.company_id
涂亚平 committed
55
        WHERE
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
        t2.delete_date is null
        and t3.delete_date is null
        and t4.delete_date is null
        and t5.service_id = 1
        and t5.delete_date is null
        <if test="companyName != null and companyName != ''">
            and t2.company_name like concat('%',#{companyName} ,'%')
        </if>
        <if test="fieldId != null and fieldId != ''">
            and t3.field_id = #{fieldId}
        </if>
        <if test="superviseName != null and superviseName != ''">
            and t2.supervise_name =#{superviseName}
        </if>
        <if test="userId != null and userId != ''">
            and t4.administer_id =#{userId}
        </if>
    </select>

涂亚平 committed
75

涂亚平 committed
76

77
    <select id="getAllCompany" parameterType="com.subsidy.model.CompanyDictDO" resultType="com.subsidy.vo.company.GetAllCompanyVO">
涂亚平 committed
78
            SELECT
涂亚平 committed
79 80
                t.id,
                t.company_name
涂亚平 committed
81
            FROM
涂亚平 committed
82 83 84 85 86
                company_dict t
                where t.delete_date is null
                <if test="companyName != null and companyName != ''">
                    and t.company_name like concat('%',#{companyName} ,'%')
                </if>
涂亚平 committed
87 88
        </select>

涂亚平 committed
89
    <select id="getCompanyMembers" resultType="com.subsidy.vo.company.GetCompanyMembersVO">
90 91 92 93 94 95 96 97 98 99 100 101
        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
涂亚平 committed
102
        FROM
103 104 105 106 107 108 109
        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) t5 on t5.member_id = t.id
        LEFT JOIN company_dict t2 ON t5.company_id = t2.id
涂亚平 committed
110 111 112
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
113 114 115
            <if test="companyId != null and companyId != ''">
                and t5.company_id = #{companyId}
            </if>
涂亚平 committed
116
            <if test="userName != null and userName != ''">
117 118 119 120
                and (t.user_name like concat('%',#{userName} ,'%')  or t.telephone like concat('%',#{userName} ,'%') )
            </if>
            <if test="memberStatus != null and memberStatus != ''">
                and t5.member_status = #{memberStatus}
涂亚平 committed
121
            </if>
涂亚平 committed
122 123
    </select>

涂亚平 committed
124
</mapper>