| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="householdResultMap" type="org.springblade.modules.house.entity.HouseholdEntity"> |
| | | <result column="id" property="id"/> |
| | | <result column="house_code" property="houseCode"/> |
| | | <result column="name" property="name"/> |
| | | <result column="phone_number" property="phoneNumber"/> |
| | | <result column="associated_user_id" property="associatedUserId"/> |
| | | <result column="relationship" property="relationship"/> |
| | | <!-- <result column="primary_contact" property="primaryContact"/>--> |
| | | <result column="residential_status" property="residentialStatus"/> |
| | | <result column="gender" property="gender"/> |
| | | <result column="birthday" property="birthday"/> |
| | | <result column="id_card" property="idCard"/> |
| | | <result column="ethnicity" property="ethnicity"/> |
| | | <result column="education" property="education"/> |
| | | <result column="hukou_registration" property="hukouRegistration"/> |
| | | <result column="work_status" property="workStatus"/> |
| | | <result column="employer" property="employer"/> |
| | | <result column="marital_status" property="maritalStatus"/> |
| | | <result column="card_number" property="cardNumber"/> |
| | | <result column="other_contact" property="otherContact"/> |
| | | <result column="current_address" property="currentAddress"/> |
| | | <result column="disability_cert" property="disabilityCert"/> |
| | | <!-- <result column="data_status" property="dataStatus"/>--> |
| | | <result column="role_type" property="roleType"/> |
| | | <result column="party_ember" property="partyEmber"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | <result column="confirm_flag" property="confirmFlag"/> |
| | | <result column="housing_rental_id" property="housingRentalId"/> |
| | | <result property="id" column="id" /> |
| | | <result property="houseCode" column="house_code" /> |
| | | <result property="name" column="name" /> |
| | | <result property="phoneNumber" column="phone_number" /> |
| | | <result property="associatedUserId" column="associated_user_id" /> |
| | | <result property="roleType" column="role_type" /> |
| | | <result property="relationship" column="relationship" /> |
| | | <result property="isPrimaryContact" column="is_primary_contact" /> |
| | | <result property="residentialStatus" column="residential_status" /> |
| | | <result property="gender" column="gender" /> |
| | | <result property="birthday" column="birthday" /> |
| | | <result property="idCard" column="id_card" /> |
| | | <result property="cardType" column="card_type" /> |
| | | <result property="cardNo" column="card_no" /> |
| | | <result property="ethnicity" column="ethnicity" /> |
| | | <result property="education" column="education" /> |
| | | <result property="residentType" column="resident_type" /> |
| | | <result property="hukouRegistration" column="hukou_registration" /> |
| | | <result property="residentAdcode" column="resident_adcode" /> |
| | | <result property="nativePlaceAdcode" column="native_place_adcode" /> |
| | | <result property="religiousBelief" column="religious_belief" /> |
| | | <result property="healthStatus" column="health_status" /> |
| | | <result property="diseaseName" column="disease_name" /> |
| | | <result property="workStatus" column="work_status" /> |
| | | <result property="employer" column="employer" /> |
| | | <result property="occupation" column="occupation" /> |
| | | <result property="cmpyRegAddr" column="cmpy_reg_addr" /> |
| | | <result property="goOutAddr" column="go_out_addr" /> |
| | | <result property="goOutWhere" column="go_out_where" /> |
| | | <result property="goOutTime" column="go_out_time" /> |
| | | <result property="goOutReason" column="go_out_reason" /> |
| | | <result property="maritalStatus" column="marital_status" /> |
| | | <result property="cardNumber" column="card_number" /> |
| | | <result property="otherContact" column="other_contact" /> |
| | | <result property="homeAdcode" column="home_adcode" /> |
| | | <result property="currentAddress" column="current_address" /> |
| | | <result property="disabilityCert" column="disability_cert" /> |
| | | <result property="partyEmber" column="party_ember" /> |
| | | <result property="housingRentalId" column="housing_rental_id" /> |
| | | <result property="confirmFlag" column="confirm_flag" /> |
| | | <result property="createUser" column="create_user" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateUser" column="update_user" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="isDeleted" column="is_deleted" /> |
| | | <result property="volunteerOrg" column="volunteer_org" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectHousehold"> |
| | | select id, |
| | | house_code, |
| | | name, |
| | | phone_number, |
| | | associated_user_id, |
| | | role_type, |
| | | relationship, |
| | | is_primary_contact, |
| | | residential_status, |
| | | gender, |
| | | birthday, |
| | | id_card, |
| | | ethnicity, |
| | | education, |
| | | hukou_registration, |
| | | work_status, |
| | | employer, |
| | | marital_status, |
| | | card_number, |
| | | other_contact, |
| | | current_address, |
| | | disability_cert, |
| | | party_ember, |
| | | create_user, |
| | | create_time, |
| | | update_user, |
| | | update_time, |
| | | remark, |
| | | is_deleted, |
| | | confirm_flag, |
| | | housing_rental_id |
| | | from jczz_household |
| | | select |
| | | id, |
| | | house_code, |
| | | name, |
| | | phone_number, |
| | | associated_user_id, |
| | | role_type, |
| | | relationship, |
| | | is_primary_contact, |
| | | residential_status, |
| | | gender, |
| | | birthday, |
| | | id_card, |
| | | card_type, |
| | | card_no, |
| | | ethnicity, |
| | | education, |
| | | resident_type, |
| | | hukou_registration, |
| | | resident_adcode, |
| | | native_place_adcode, |
| | | religious_belief, |
| | | health_status, |
| | | disease_name, |
| | | work_status, |
| | | employer, |
| | | occupation, |
| | | cmpy_reg_addr, |
| | | go_out_addr, |
| | | go_out_where, |
| | | go_out_time, |
| | | go_out_reason, |
| | | marital_status, |
| | | card_number, |
| | | other_contact, |
| | | home_adcode, |
| | | current_address, |
| | | disability_cert, |
| | | party_ember, |
| | | housing_rental_id, |
| | | confirm_flag, |
| | | create_user, |
| | | create_time, |
| | | update_user, |
| | | update_time, |
| | | remark, |
| | | is_deleted, |
| | | volunteer_org |
| | | from |
| | | jczz_household |
| | | </sql> |
| | | |
| | | <resultMap id="householdAndLabelMap" type="org.springblade.modules.house.vo.HouseholdVO" autoMapping="true"> |
| | |
| | | jg.grid_name, |
| | | jhs.building, |
| | | jhs.district_code aoiCode, |
| | | jh.volunteer_org, |
| | | case |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 then 2 |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 then 1 |
| | | end as minors, |
| | | jhs.unit |
| | | FROM |
| | | jczz_household jh |
| | |
| | | LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | <where> |
| | | <if test="household.labelIdList !=null and household.labelIdList.size() >0 "> |
| | | EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | jczz_user_house_label juhl |
| | | LEFT JOIN jczz_label jl ON juhl.label_id = jl.id |
| | | where juhl.household_id = jh.id |
| | | and juhl.lable_type = 1 |
| | | AND juhl.household_id IS NOT NULL |
| | | AND jl.id in |
| | | <foreach collection="household.labelIdList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="household.userId!=null"> |
| | | AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id = |
| | | #{household.userId} |
| | | ) |
| | | </if> |
| | | |
| | | <if test="household.searchKey!=null and household.searchKey!=''"> |
| | | and CONCAT(jh.name,jh.phone_number) like CONCAT ('%', #{household.searchKey},'%') |
| | | </if> |
| | | |
| | | <if test="household.name!=null and household.name !=''"> |
| | | and jh.name like concat('%',#{household.name},'%') |
| | | </if> |
| | | <if test="household.volunteerOrg != null and household.volunteerOrg != ''"> |
| | | and jh.volunteer_org like concat('%',#{household.volunteerOrg},'%') |
| | | </if> |
| | | <if test="household.houseCode!=null and household.houseCode !=''"> |
| | | and jh.house_code = #{household.houseCode} |
| | | </if> |
| | | |
| | | <if test="household.communityCode!=null and household.communityCode !=''"> |
| | | and jg.community_code = #{household.communityCode} |
| | | </if> |
| | | <!-- 等于18 就是租户 --> |
| | | <if test="household.relationship!=null and household.relationship == 18"> |
| | | and jh.relationship = #{household.relationship} |
| | | |
| | | <if test="household.minors!=null and household.minors ==2"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 |
| | | </if> |
| | | <if test="household.minors!=null and household.minors ==1"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 |
| | | </if> |
| | | </if> |
| | | <!-- 不等于18 就是非租户 --> |
| | | <if test="household.relationship!=null and household.relationship != 18"> |
| | | and jh.relationship != #{household.relationship} |
| | | </if> |
| | | |
| | | <if test="household.phoneNumber!=null and household.phoneNumber !=''"> |
| | | and jh.phone_number like concat('%',#{household.phoneNumber},'%') |
| | | </if> |
| | |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <!-- <if test="isAdministrator==2">--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">--> |
| | | <!-- and jg.community_code in--> |
| | | <!-- <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">--> |
| | | <!-- #{code}--> |
| | | <!-- </foreach>--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- and jg.community_code in ('')--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <!-- </if>--> |
| | | <if test="household.building!=null and household.building!=''"> |
| | | and jhs.building like concat(#{household.building},'%') |
| | | </if> |
| | |
| | | concat( jhs.building, " ", unit, " ", room ) AS address, |
| | | jda.town_street_name AS townStreetName, |
| | | jda.nei_name AS neiName, |
| | | jh.volunteer_org, |
| | | jg.grid_name |
| | | FROM |
| | | jczz_household jh |
| | |
| | | jh.remark, |
| | | jh.confirm_flag, |
| | | jh.housing_rental_id, |
| | | jh.volunteer_org, |
| | | if(jda.id is not null, substring(jda.town_street_code, 1, 9), jh.home_adcode) as home_adcode, |
| | | br1.name as residentAdName, |
| | | br1.province_code as residentProvinceAdCode, |
| | |
| | | jh.is_primary_contact isPrimaryContact,jh.residential_status residentialStatus,jh.gender, |
| | | jh.birthday,jh.id_card idCard,jh.ethnicity,jh.education, |
| | | jh.hukou_registration hukouRegistration,jh.work_status workStatus,jh.employer,jh.marital_status maritalStatus, |
| | | jh.card_number cardNumber,jh.other_contact otherContact,jh.current_address currentAddress, |
| | | jh.card_number cardNumber,jh.other_contact otherContact,jh.current_address currentAddress,jh.volunteer_org, |
| | | jh.disability_cert disabilityCert,jh.party_ember partyEmber,jh.remark, |
| | | jhs.district_name aoiName, |
| | | concat(jhs.building," ",unit," ",room) as address |
| | |
| | | LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | <where> |
| | | <if test="household.neiCode != null and household.neiCode != ''"> |
| | | and jda.nei_code = #{household.neiCode} |
| | | <if test="household.communityCode != null and household.communityCode != ''"> |
| | | and jg.community_code = #{household.communityCode} |
| | | </if> |
| | | <if test="household.confirmFlag != null and household.confirmFlag != ''"> |
| | | <if test="household.confirmFlag != null"> |
| | | and jh.confirm_flag = #{household.confirmFlag} |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | |
| | | jh.remark, |
| | | jh.confirm_flag, |
| | | jh.housing_rental_id, |
| | | jh.volunteer_org, |
| | | IF |
| | | ( jda.id IS NOT NULL, substring( jda.town_street_code, 1, 9 ), jh.home_adcode ) AS home_adcode, |
| | | jhs.district_name aoiName, |