WorkstationMemberMappingMapper.xml 9.01 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.laowu.mapper.WorkstationMemberMappingMapper">

    <select id="memberManagement" resultType="com.laowu.vo.member.MemberManagementVO">
        SELECT DISTINCT
        t1.id,
        t1.user_name,
        t1.id_card_type,
        t1.id_card,
        t1.telephone,
        t1.host_user_name,
        t1.host_id_card_type,
        t1.host_id_card,
        t1.province,
        t1.city,
        t1.county,
        t1.town,
        t1.village,
        t1.team,
        t1.address,
        t1.province_now,
        t1.city_now,
        t1.county_now,
        t1.town_now,
        t1.village_now,
        t1.address_now,
        t1.family_cnt,
        t1.host_relation,
        t1.gender,
        t1.age,
        t1.nation,
        t1.is_party,
        t1.education,
        t1.health,
        t1.is_poor,
        t1.monitor_type,
        t1.is_migration,
        t1.migration_type,
        t1.migration_name,
        t1.fisherman,
        t1.insured,
        t1.pension_insurance,
        t1.insure_place,
        t1.member_type,
        t1.labor_ability,
        t1.job_status,
        t1.job_type,
        t1.business_id,
        t3.business,
        t1.job_age,
        t1.year_job_month,
        t1.average_salary,
        t1.income_statement,
        t1.employment_willingness,
        t1.province_employment,
        t1.city_employment,
        t1.employment_training_willingness,
        t1.homecoming,
        t1.homecoming_date,
        t1.homecoming_reason,
        t1.comment,
        t1.host_last_update,
        t1.base_last_update,
        t1.employment_last_update,
        t1.create_date
        FROM
        member_dict t1
        LEFT JOIN workstation_member_mapping t5 ON t1.id = t5.member_id and t5.delete_date is null
        LEFT JOIN workstation_dict t4 ON t5.station_id = t4.id AND t4.delete_date IS NULL
        LEFT JOIN member_positions t6 ON t1.id = t6.member_id AND t6.delete_date IS NULL
        left join position_dict t7 on t6.position_id = t7.id and t7.delete_date is null
        left join position_dict t8 ON t7.parent_id = t8.id and t8.delete_date is null
        left join business_dict t3 on t1.business_id = t3.id
        left join (SELECT
        t.member_id,
        t.province,
        t.city,
        t.county,
        t.town,
        t.village,
        t.job_destination,
        t.start_date,
        t.end_date,
        t.create_date
        FROM
        member_job_info t
        RIGHT JOIN ( SELECT t.member_id, max( t.create_date ) create_date FROM member_job_info t GROUP BY t.member_id ) t2 ON t.member_id = t2.member_id
        AND t.create_date = t2.create_date) t9 on t1.id = t9.member_id
        left join member_job_info t10 on t1.id = t10.member_id and t10.delete_date is null
        WHERE
        t1.delete_date IS NULL
        <if test="userName != null and userName != ''">
            and(t1.user_name like concat('%', #{userName}, '%') or t1.id_card like concat('%', #{userName}, '%') or t1.telephone like concat('%', #{userName}, '%') )
        </if>
        <if test="province != null and province != ''">
            and t1.province = #{province}
        </if>
        <if test="city != null and city != ''">
            and t1.city = #{city}
        </if>
        <if test="county != null and county != ''">
            and t1.county = #{county}
        </if>
        <if test="town != null and town != ''">
            and t1.town = #{town}
        </if>
        <if test="village != null and village != ''">
            and t1.village = #{village}
        </if>
        <if test="gender != null and gender != ''">
            and t1.gender = #{gender}
        </if>
        <if test="maxAge != null and maxAge != ''">
            and t1.age &lt;= #{maxAge}
        </if>
        <if test="minAge != null and minAge != ''">
            and t1.age >= #{minAge}
        </if>
        <if test="isParty != null and isParty != ''">
            and t1.is_party = #{isParty}
        </if>
        <if test="education != null and education != ''">
            and t1.education = #{education}
        </if>
        <if test="health != null and health != ''">
            and t1.health = #{health}
        </if>
        <if test="provinceNow != null and provinceNow != ''">
            and t1.province_now = #{provinceNow}
        </if>
        <if test="cityNow != null and cityNow != ''">
            and t1.city_now = #{cityNow}
        </if>
        <if test="countyNow != null and countyNow != ''">
            and t1.county_now = #{countyNow}
        </if>
        <if test="townNow != null and townNow != ''">
            and t1.town_now = #{townNow}
        </if>
        <if test="isPoor != null and isPoor != ''">
            and t1.is_poor = #{isPoor}
        </if>
        <if test="monitorType != null and monitorType != ''">
            and t1.monitor_type = #{monitorType}
        </if>
        <if test="isMigration != null and isMigration != ''">
            and t1.is_migration = #{isMigration}
        </if>
        <if test="migrationType != null and migrationType != ''">
            and t1.migration_type = #{migrationType}
        </if>
        <if test="fisherman != null and fisherman != ''">
            and t1.fisherman = #{fisherman}
        </if>
        <if test="insured != null and insured != ''">
            and t1.insured = #{insured}
        </if>
        <if test="pensionInsurance != null and pensionInsurance != ''">
            and t1.pension_insurance = #{pensionInsurance}
        </if>
        <if test="insurePlace != null and insurePlace != ''">
            and t1.insure_place = #{insurePlace}
        </if>
        <if test="memberType != null and memberType != ''">
            and t1.member_type = #{memberType}
        </if>
        <if test="laborAbility != null and laborAbility != ''">
            and t1.labor_ability = #{laborAbility}
        </if>
        <if test="jobStatus != null and jobStatus != ''">
            and t1.job_status = #{jobStatus}
        </if>
        <if test="jobType != null and jobType !=''">
            and t1.job_type = #{jobType}
        </if>
        <if test="provinceJob != null and provinceJob != ''">
            and t9.province = #{provinceJob}
        </if>
        <if test="cityJob != null and cityJob != ''">
            and t1.city = #{cityJob}
        </if>
        <if test="countyJob != null and countyJob != ''">
            and t1.county = #{countyJob}
        </if>
        <if test="townJob != null and townJob != ''">
            and t1.town = #{townJob}
        </if>
        <if test="jobDestination != null and jobDestination != ''">
            and t9.job_destination = #{jobDestination}
        </if>
        <if test="jobsStartDate != null and jobsStartDate != ''">
            and DATE_FORMAT( t9.start_date, '%Y-%m-%d' ) >= DATE_FORMAT( #{jobsStartDate}, '%Y-%m-%d' )
        </if>
        <if test="jobsEndDate != null and jobsEndDate != ''">
            and DATE_FORMAT( t9.end_date, '%Y-%m-%d' ) &lt;= DATE_FORMAT( #{jobsEndDate}, '%Y-%m-%d' )
        </if>
        <if test="businessId != null and businessId != ''">
            and t1.business_id = #{businessId}
        </if>
        <if test="maxAverageSalary != null and maxAverageSalary != ''">
            and t1.average_salary &lt;= #{maxAverageSalary}
        </if>
        <if test="minAverageSalary != null and minAverageSalary != ''">
            and t1.average_salary >= #{minAverageSalary}
        </if>
        <if test="maxJobAge != null and maxJobAge != ''">
            and t1.job_age &lt;= #{maxJobAge}
        </if>
        <if test="minJobAge != null and minJobAge != ''">
            and t1.job_age >= #{minJobAge}
        </if>
        <if test="employmentWillingness != null and employmentWillingness != ''">
            and t1.employment_willingness = #{employmentWillingness}
        </if>
        <if test="provinceEmployment != null and provinceEmployment != ''">
            and t1.province_employment = #{provinceEmployment}
        </if>
        <if test="cityEmployment != null and cityEmployment != ''">
            and t1.city_employment = #{cityEmployment}
        </if>
        <if test="willingBusinessId != null and willingBusinessId != ''">
            and t1.willing_business_id #{willingBusinessId}
        </if>
        <if test="employmentTrainingWillingness != null and employmentTrainingWillingness != ''">
            and t1.employment_training_willingness = #{employmentTrainingWillingness}
        </if>
        <if test="homecoming != null and homecoming !=''">
            and t1.homecoming = #{homecoming}
        </if>
        <if test="stationId != null and stationId != ''">
            AND t4.id = #{stationId}
        </if>
        <if test="positionId != null and positionId != ''">
            and ( t7.id = #{positionId} or t7.parent_id = #{positionId} or t8.parent_id = #{positionId} )
        </if>
        <if test="trainType != null and trainType != ''">
            and t10.train_type = #{trainType}
        </if>
        order by  t1.create_date
    </select>


</mapper>