Blame view

CompanyDictMapper.xml 3.53 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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.laowu.mapper.CompanyDictMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, company_name, place_id, position_id, company_code, account, desc
    </sql>

    <select id="company" resultType="com.laowu.vo.company.CompanyVO">
        SELECT
15
        t.id,
16
        t3.id as business_id,
17
        t.company_name,
18
        t3.business,
19
        t.company_code,
涂亚平 committed
20
        t.company_property,
21 22 23 24 25
        t.company_desc,
        t.province,
        t.city,
        t.county,
        t.company_origin
涂亚平 committed
26
        FROM
27
        company_dict t
28
        LEFT JOIN business_dict t3 ON t.business_id = t3.id
涂亚平 committed
29
        WHERE
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 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
        t.delete_date IS NULL
        AND t3.delete_date IS NULL
        <if test="province != null and province != ''">
            and t.province = #{province}
        </if>
        <if test="city != null and city != ''">
            and t.city = #{city}
        </if>
        <if test="county != null and county != ''">
            and t.county = #{county}
        </if>
        <if test="companyName != null and companyName != ''">
            AND t.company_name LIKE concat('%', #{companyName}, '%')
        </if>
    </select>

    <select id="stationCompanyCount" parameterType="long" resultType="integer">
        SELECT
            count(distinct(t4.id))
        FROM
            workstation_dict t1
            LEFT JOIN workstation_alone_mapping t2 ON t1.id = t2.station_id
            LEFT JOIN position_alone_info t3 ON t2.alone_id = t3.id
            LEFT JOIN company_dict t4 ON t3.company_id = t4.id
        WHERE
            t1.id = 1
            AND t1.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL UNION
        SELECT
            t1.id,
            t4.company_name
        FROM
            workstation_dict t1
            LEFT JOIN workstation_require_mapping t2 ON t1.id = t2.station_id
            LEFT JOIN position_require_item t3 ON t2.require_id = t3.id
            LEFT JOIN company_dict t4 ON t3.company_id = t4.id
        WHERE
            t1.id = 1
            AND t1.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
    </select>


    <select id="stationCompany" resultType="com.laowu.vo.company.CompanyVO">
        SELECT
        t2.id,
80
        t2.business_id,
81
        t2.company_name,
82
        t3.business,
83 84 85
        t2.company_code,
        t2.company_desc,
        t2.province,
涂亚平 committed
86
        t2.company_property,
87 88 89 90 91
        t2.city,
        t2.county
        FROM
        company_relate_work t
        LEFT JOIN company_dict t2 ON t.company_id = t2.id
92
        LEFT JOIN business_dict t3 ON t2.business_id = t3.id
93 94
        WHERE
        t.delete_date IS NULL
涂亚平 committed
95 96
        AND t2.delete_date IS NULL
        AND t3.delete_date IS NULL
97 98 99 100 101 102 103 104 105 106 107 108 109
        and t.station_id = #{stationId}
        <if test="province != null and province != ''">
            and t2.province = #{province}
        </if>
        <if test="city != null and city != ''">
            and t2.city = #{city}
        </if>
        <if test="county != null and county != ''">
            and t2.county = #{county}
        </if>
        <if test="companyName != null and companyName != ''">
            AND t2.company_name LIKE concat('%', #{companyName}, '%')
        </if>
涂亚平 committed
110 111 112
    </select>

</mapper>