ServiceCompanyMappingMapper.xml 1.66 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.ServiceCompanyMappingMapper">


    <select id="getServiceCompanies" resultType="com.subsidy.dto.service.GetServiceCompaniesVO">
        SELECT
        t2.id,
        t2.company_name,
        t2.short_name,
        t2.area_name,
        t2.logo,
        t2.supervise_name ,
        t2.address,
        IF(t.id is null,'未授权','已授权') as authStatus,
        t.id as serviceCompanyId
        FROM
        company_dict  t2
        LEFT JOIN service_company_mapping t ON t.company_id = t2.id and t.delete_date is null AND t.service_id = #{serviceId}
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        <if test="companyName != null and companyName != ''">
            AND t2.company_name like concat('%',#{companyName} ,'%')
        </if>
        <if test="authStatus == '已授权'">
            and t.id is not null
        </if>
        <if test="authStatus =='未授权'">
            and t.id is null
        </if>
    </select>

    <select id="serviceCompanies" resultType="com.subsidy.dto.service.ServiceCompaniesVO">
        SELECT
        t2.id,
        t2.company_name
        FROM
        service_company_mapping t
        LEFT JOIN company_dict t2 ON t.company_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t.service_id = #{serviceId}
        <if test="companyName != null and companyName != ''">
            AND t2.company_name like concat('%',#{companyName} ,'%')
        </if>
    </select>

</mapper>