Blame view

MemberDictMapper.xml 7.64 KB
1 2 3 4 5 6 7 8 9 10 11 12 13
<?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.MemberDictMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, user_name, status, telephone, id_card_type, id_card, province, city, town, address, education, education_type, college_id, start_date, end_date, major_id, rank, is_poor, is_migration, is_party, job_status
    </sql>

    <select id="allMembers" resultType="com.laowu.vo.member.AllMembersVO">
涂亚平 committed
14
        SELECT DISTINCT
15 16 17 18 19 20 21 22 23 24 25 26
            t.id,
            t.user_name,
            t.STATUS,
            t.telephone,
            t.id_card_type,
            t.id_card,
            t.province,
            t.city,
            t.county,
            t.address
        FROM
            member_dict t
涂亚平 committed
27 28 29
        LEFT JOIN member_positions t2 ON t.id = t2.member_id
        LEFT JOIN position_dict t3 ON t2.position_id = t3.id
        left join position_dict t4 ON t3.parent_id = t4.id
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
        WHERE
            t.delete_date IS NULL
            <if test="status != null and status != ''">
                AND t.STATUS = #{status}
            </if>
            <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="userName != null and userName != ''">
                AND t.user_name like concat('%', #{userName}, '%')
            </if>
涂亚平 committed
47 48 49
            <if test="positionId != null and positionId != ''">
                and (t3.id = #{positionId} or t3.parent_id = #{positionId} or t4.parent_id = #{positionId})
            </if>
50
        order by t.create_date
51 52 53 54 55 56 57 58 59 60 61 62 63
    </select>

    <select id="members" parameterType="long" resultType="long">
        SELECT
            t.id
        FROM
            member_dict t
            left join member_team_mapping t2 on t.id = t2.member_id
        WHERE
            t.delete_date IS NULL
            and t2.delete_date is null
            AND t2.team_id = #{teamId}
    </select>
涂亚平 committed
64 65 66 67 68 69 70 71 72 73 74 75 76

    <select id="memberPositions" parameterType="long" resultType="com.laowu.model.PositionDictDO">
        SELECT
            t2.*
        FROM
            member_positions t
            LEFT JOIN position_dict t2 ON t.position_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.member_id = #{memberId}
    </select>

涂亚平 committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
    <select id="laborAbility" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            AND t.labor_ability IN ( '技能劳动力', '普通劳动力', '部分丧失劳动力' )
            AND t.province = #{province}
            AND t.city = #{city}
            <if test="county != null and county != ''">
                and t.county = #{county}
            </if>
            <if test="isPoor != null and isPoor != ''">
                and t.is_poor = #{isPoor}
            </if>
    </select>

    <select id="cityEmployeeCnt" parameterType="string" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            AND ( t.province_now = '上海市'
                    OR t.province_employment = '上海市')
                and t.province = #{province}
                AND t.city = #{city}
    </select>

    <select id="migrationCnt" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            and t.is_migration = #{isMigration}
            AND ( t.province_now = '上海市'
                    OR t.province_employment = '上海市')
                and t.province = #{province}
                AND t.city = #{city}
    </select>

    <select id="memberCertCnt" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
            LEFT JOIN ( SELECT t.member_id FROM member_certs t WHERE t.delete_date IS NULL GROUP BY t.member_id HAVING count( 1 )> 0 ) t2 ON t.id = t2.member_id
        WHERE
            t.delete_date IS NULL
            AND t2.member_id IS NOT NULL
            AND ( t.province_now = '上海市'
                    OR t.province_employment = '上海市')
                and t.province = #{province}
                AND t.city = #{city}
    </select>

    <select id="businessTop7" resultType="com.laowu.vo.station.BusinessTop7VO">
       SELECT
            t2.business,
            count( 1 ) AS cnt
        FROM
            member_dict t
            LEFT JOIN business_dict t2 ON t.business_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t.business_id IS NOT NULL
            AND t.business_id = 5
            AND ( t.province_now = '上海市' OR t.province_employment = '上海市')
            and t.province = #{province}
            AND t.city = #{city}
                UNION
        SELECT
            t2.business,
            cnt
        FROM
            (
            SELECT
                t.business_id,
                count( 1 ) AS cnt
            FROM
                member_dict t
            WHERE
                t.delete_date IS NULL
                AND t.business_id IS NOT NULL
                AND t.business_id != 5
                AND ( t.province_now = '上海市' OR t.province_employment = '上海市')
                and t.province = #{province}
                AND t.city = #{city}
            GROUP BY
                t.business_id
            ORDER BY
                count( 1 ) DESC
            ) t
            LEFT JOIN business_dict t2 ON t.business_id = t2.id
            LIMIT 7
    </select>

    <select id="middleSalary" resultType="double">
        SELECT
            t.average_salary
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            AND ( t.province_now = '上海市'
                    OR t.province_employment = '上海市')
                and t.province = #{province}
                AND t.city = #{city}
        ORDER BY
            t.average_salary
    </select>

    <select id="education" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            AND t.education = #{education}
        <if test="destinationProvince != null and destinationProvince != ''">
            AND ( t.province_now = #{destinationProvince}
            OR t.province_employment = #{destinationProvince})
        </if>
        and t.province = #{province}
        AND t.city = #{city}
            <if test="county != null and county != ''">
                and t.county = #{county}
            </if>
    </select>

    <select id="ageLabor" resultType="integer">
        SELECT
            count( 1 )
        FROM
            member_dict t
        WHERE
            t.delete_date IS NULL
            AND t.province = #{province}
            AND t.city = #{city}
            <if test="county != null and county != ''">
                and t.county = #{county}
            </if>
            AND t.labor_ability IN ( '技能劳动力', '普通劳动力', '部分丧失劳动力' )
            <if test="maxAge != null and maxAge != ''">
                and t.age &lt;= #{maxAge}
            </if>
            <if test="minAge != null and minAge != ''">
                and t.age >= #{minAge}
            </if>
    </select>

233
</mapper>