Blame view

ServiceCompanyMappingMapper.xml 2.77 KB
涂亚平 committed
1 2 3 4 5 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 37 38 39 40 41 42 43 44 45 46
<?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.vo.service.GetServiceCompaniesVO">
        SELECT
        t2.id,
        t2.company_name,
        t2.short_name,
        t2.area_name,
        t2.supervise_name ,
        IF(t.id=null,'授权','未授权') as authStatus
        FROM
        company_dict  t2
        LEFT JOIN service_company_mapping t 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>
        <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.vo.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>

47
    <select id="companyService" parameterType="long" resultType="com.subsidy.vo.administer.AdministerServicesVO">
涂亚平 committed
48
        SELECT
49 50
            t2.*,
            t.id as service_company_id
涂亚平 committed
51 52 53 54 55 56 57 58 59
        FROM
            service_company_mapping t
            LEFT JOIN service_dict t2 ON t.service_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.company_id = #{companyId}
    </select>

60
    <select id="companyAdministerService" resultType="com.subsidy.vo.administer.AdministerServicesVO">
涂亚平 committed
61 62
       SELECT
            t2.*
涂亚平 committed
63
        FROM
涂亚平 committed
64
            service_administer_mapping t
65
            LEFT JOIN service_dict t2 ON t.service_id = t2.id
涂亚平 committed
66 67 68 69 70 71 72 73 74 75 76
            INNER JOIN (
            SELECT
                t2.*
            FROM
                service_company_mapping t
                LEFT JOIN service_dict t2 ON t.service_id = t2.id
            WHERE
                t.delete_date IS NULL
                AND t2.delete_date IS NULL
                AND t.company_id = #{companyId}
            ) t3 ON t2.id = t3.id
涂亚平 committed
77 78 79
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
涂亚平 committed
80 81
            AND t.administer_id = #{administerId}
        order by t2.id
涂亚平 committed
82 83
    </select>
</mapper>