CompanyDictMapper.xml 2.38 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.CompanyDictMapper">


    <select id="allOperators" resultType="com.subsidy.vo.company.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
        WHERE
        t2.delete_date is null
        and t3.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>
        order by t2.id
    </select>


    <select id="operators"  resultType="com.subsidy.vo.company.OperatorsVO">
        SELECT
        distinct
        t2.id as companyId,
        IFNULL(t5.user_name,t2.company_name) as user_name,
        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 administer_company_mapping t4 on t2.id = t4.company_id
        left join company_field_mapping t3 on t2.id = t3.company_id
        LEFT JOIN administer t5 on t5.id = t4.administer_id
        WHERE
        t2.delete_date is null
        and t3.delete_date is null
        and t4.delete_date is null
        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>
        order by t2.id
    </select>


</mapper>