and address_code in
#{houseCode}
and address_code in ('')
SELECT
jda.*
FROM
jczz_doorplate_address jda LEFT JOIN jczz_district jd on jda.aoi_code=jd.aoi_code
where 1=1
and jda.aoi_name like concat('%',#{doorplateAddress.aoiName},'%')
and jda.address_name like concat('%',#{doorplateAddress.addressName},'%')
and jda.town_street_code like concat('%',#{doorplateAddress.townStreetCode},'%')
and jda.house_name like concat('%',#{doorplateAddress.houseName},'%')
and jda.building_name like concat('%',#{doorplateAddress.buildingName},'%')
and jda.unit_name like concat('%',#{doorplateAddress.unitName},'%')
and jd.id in
#{districtId}
select br.town_code as id,br.town_name as name from jczz_grid jg
left join blade_region br on jg.community_code = br.code
where jg.is_deleted = 0
and br.name = '万达社区居民委员会'
group by br.town_code,br.town_name
union
select br.town_code as id,br.town_name as name from jczz_police_affairs_grid jpag
left join blade_region br on jpag.community_code = br.code
where jpag.is_deleted = 0 and br.town_code is not null
group by br.town_code,br.town_name
select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_grid jg
left join blade_region br on jg.community_code = br.code
where jg.is_deleted = 0
and nei_name = '万达社区居民委员会'
union
select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_police_affairs_grid jpag
left join blade_region br on jpag.community_code = br.code
where jpag.is_deleted = 0 and br.village_code is not null
select aoi_code as id,aoi_name as name,1 as addressType from jczz_doorplate_address
where 1=1
and aoi_name !=''
and aoi_code !=''
and nei_name = #{houseParam.name}
and nei_code = #{houseParam.code}
group by aoi_code,aoi_name
union all
(
select aoi_code as id,sub_aoi as name,1 as addressType from jczz_doorplate_address
where 1=1
and aoi_code !=''
and aoi_name is null
and sub_aoi != ''
and nei_name = #{houseParam.name}
and nei_code = #{houseParam.code}
group by aoi_code,sub_aoi
)
union all
(
select nei_code as id,'自建房/商铺' as name,2 as addressType from jczz_doorplate_address
where 1=1
and aoi_code is null
and nei_name = #{houseParam.name}
and nei_code = #{houseParam.code}
group by nei_code
)
union all
(
select '企业商超' as id,'企业商超' as name,4 as addressType from jczz_place_rel jpl
join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
where jpl.is_deleted = 0
and community_name like concat('%',#{houseParam.communityName},'%')
and community_code = #{houseParam.code}
limit 1
)
(
select building_code as id,ifnull(building_name,'1栋') as name,1 as addressType from jczz_doorplate_address
where 1=1
and aoi_code = #{houseParam.code}
and building_code !=''
and doorplate_type = '户室牌'
group by building_code,building_name
order by building_name
)
union all
(
select address_code as id,doorplate_name as name,2 as addressType from jczz_doorplate_address
where 1=1
and aoi_code = #{houseParam.code}
and building_name is null
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
)
(
select
jda.id,ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,
jda.address_code addressCode,
jh.name as realName,jh.relationship as roleType,1 as addressType,
juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id,
juhlh.color as houseColor
from jczz_doorplate_address jda
left join
(
SELECT house_code, NAME, relationship FROM jczz_household WHERE id in(
SELECT max(id) FROM jczz_household where is_deleted =0 and relationship = 1 GROUP BY house_code
)
) jh
on jda.address_code = jh.house_code
left join jczz_user_house_label juhl on juhl.house_code = jda.address_code and juhl.lable_type=1
left join jczz_user_house_label juhlh on juhlh.house_code = jda.address_code and juhlh.lable_type=2
where 1=1
and floor != ''
and house_name != ''
and doorplate_type = '户室牌'
and building_code = #{houseParam.code}
and jh.name like concat('%',#{houseParam.searchKey},'%')
)
union all
(
select jda2.id,'' as unitName,address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode,
'' as realName,'' as roleType,2 as addressType,
juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id,
juhlh.color as houseColor
from jczz_doorplate_address jda2
left join jczz_user_house_label juhl on juhl.house_code = jda2.address_code and juhl.lable_type=1
left join jczz_user_house_label juhlh on juhlh.house_code = jda2.address_code and juhlh.lable_type=2
where 1=1
and building_code = #{houseParam.code}
and building_name != ''
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
)
select * from jczz_doorplate_address where address_code = #{code}
SELECT town_street_code as code,town_street_name as name FROM jczz_doorplate_address group by town_street_code , town_street_name
SELECT nei_code as code,nei_name as name FROM jczz_doorplate_address WHERE town_street_code =#{code} GROUP BY nei_code,nei_name
SELECT street_ru_code as code,street_ru_name as name
FROM jczz_doorplate_address
WHERE nei_code =#{code}
and street_ru_code is not null and street_ru_code !=''
and street_ru_name is not null and street_ru_name !=''
GROUP BY street_ru_code,street_ru_name
SELECT aoi_code as code,aoi_name as name
FROM jczz_doorplate_address
WHERE street_ru_code =#{code}
and aoi_code is not null and aoi_code !=''
and aoi_name is not null and aoi_name !=''
GROUP BY aoi_code,aoi_name
SELECT building_code as code,building_name as name
FROM jczz_doorplate_address
WHERE aoi_code =#{code}
and building_code is not null and building_code !=''
and building_name is not null and building_name !=''
GROUP BY building_code,building_name
select street_ru_code as id,street_ru_name as name,3 as addressType from jczz_doorplate_address
where 1=1
and aoi_code is null
and nei_name = #{houseParam.name}
and nei_code = #{houseParam.code}
group by street_ru_code,street_ru_name
select address_code as addressCode,
IFNULL(CONCAT(doorplate_num,sub_door_plate_no), IF(doorplate_num IS NULL, sub_door_plate_no, doorplate_num)) as floor,
3 as addressType
from jczz_doorplate_address
where 1=1
and street_ru_code = #{houseParam.code}
and nei_code = #{houseParam.name}
and aoi_code is null
and doorplate_type = '中门牌'
order by doorplate_num,sub_door_plate_no
SELECT
jda.*,
jp.id as cid,jp.*,jp.create_time as pcreateTime,
bu.real_name as createUserName
FROM jczz_doorplate_address jda
left join jczz_place jp on jda.address_code = jp.house_code= and jp.is_deleted = 0
left join blade_user bu on bu.id = jp.create_user and bu.is_deleted = 0
WHERE 1=1
AND address_code = #{vo.stdId}
AND building_code = #{vo.buildingCode}
SELECT * FROM jczz_doorplate_address
WHERE 1=1
AND address_code = #{vo.stdId}
AND building_code = #{vo.buildingCode}
select
jda.id,
jda.address_code,
jda.aoi_code,
jda.aoi_name,
jda.x,
jda.y
from jczz_doorplate_address jda
left join jczz_grid_range jgr on jda.address_code = jgr.house_code
where 1=1 and jgr.id is null
and jda.nei_name = #{doorplateAddressEntity.neiName}
and jda.town_street_name = #{doorplateAddressEntity.townStreetName}
SELECT
aoi_code as code,
aoi_name as name,
nei_code as parentCode
FROM jczz_doorplate_address
WHERE nei_code = #{houseParam.code}
and aoi_code is not null and aoi_code !=''
and aoi_name is not null and aoi_name !=''
GROUP BY aoi_code,aoi_name,nei_code
union all
(
SELECT
building_code as code,
building_name as name,
aoi_code as parentCode
FROM jczz_doorplate_address
WHERE nei_code = #{houseParam.code}
and building_code is not null and building_code !=''
and building_name is not null and building_name !=''
GROUP BY building_code,building_name,aoi_code
)
union all
(
select
jda.unit_code as code,
ifnull(jda.unit_name,"一单元") name,
jda.building_code as parentCode
from jczz_doorplate_address jda
where 1=1
and floor != ''
and house_name != ''
and doorplate_type = '户室牌'
and nei_code = #{houseParam.code}
group by unit_name,unit_code,building_code
)
union all
(
select
jda.address_code as code,
jda.house_name as name,
jda.unit_code as parentCode
from jczz_doorplate_address jda
where 1=1
and floor != ''
and house_name != ''
and doorplate_type = '户室牌'
and nei_code = #{houseParam.code}
)
select jda.* from jczz_doorplate_address jda
left join jczz_house jh on jh.house_code = jda.address_code
where 1=1
and jh.house_code is null
and doorplate_type = '户室牌'
and jda.town_street_name like concat('%',#{townName},'%')
limit 0,1000
select building_name as id,building_name as name,4 as addressType from jczz_place_rel jpl
join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
where jpl.is_deleted = 0
and community_name like concat('%',#{houseParam.communityName},'%')
group by building_name
select jp.id as addressCode,
jpl.grid_name as unitName,
jpl.community_code as unitCode,
doorplate_num as floor,
4 as addressType
from jczz_place_rel jpl
join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
where jpl.is_deleted = 0
and doorplate_num!=''
and community_name like concat('%',#{houseParam.communityName},'%')
and building_name = #{houseParam.buildingName}
select nei_code,aoi_code,ifnull(aoi_name,sub_aoi) as aoi_name,x,y,address_name from jczz_doorplate_address
where 1=1
and id in
#{id}
and id in ('')
select
min(id)
from jczz_doorplate_address
where aoi_code != "" and aoi_name !=""
and doorplate_type = '大门牌'
GROUP BY aoi_code
union all
(
select
min(id)
from jczz_doorplate_address
where aoi_code != "" and sub_aoi != ""
and doorplate_type = '大门牌'
group by aoi_code
)
select jda.* from jczz_doorplate_address jda
left join jczz_place jp on jda.address_code=jp.house_code and jp.is_deleted = 0
where 1=1
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
and jp.id is null
and jda.town_street_name like concat('%',#{townName},'%')
limit 0,1000
select count(*) from jczz_doorplate_address jda
left join jczz_place jp on jda.address_code=jp.house_code and jp.is_deleted = 0
where 1=1
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
and jp.id is null
and jda.town_street_name like concat('%',#{townName},'%')
select jda.*
from jczz_doorplate_address jda
left join jczz_grid_range jgr on jda.address_code = jgr.house_code
where 1=1
-- and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
and jda.address_name like concat('%',#{doorplateAddress.addressName},'%')
and jda.poi like concat('%',#{doorplateAddress.poi},'%')
and jda.address_code in
#{addressCode}
and jgr.grid_code in
#{code}
and jgr.grid_code in ('')
and jda.nei_code in
#{code}
and jda.nei_code in ('')
and
(
jgr.grid_code in
#{code}
or
jda.nei_code in
#{code}
)
and
(
jgr.grid_code in ('') or jda.nei_code in ('')
)
limit 0,#{size}
select
jda.*,
jh.id as hid,
jh.name as hname,
jh.phone_number,
jh.card_no,
jh.occupation,
jh.current_address,
jp.id as pid,
jp.principal,
jp.principal_phone,
jp.principal_id_card,
case
when jh.id is not null then 1
when jp.id is not null then 2
when jp.id is not null and jh.id is not null then 3
when jp.id is null and jh.id is null then 4
end as addType
from jczz_doorplate_address jda
left join jczz_place jp on jp.house_code = jda.address_code and jp.is_deleted = 0
left join jczz_household jh on jh.house_code = jda.address_code and jh.is_deleted = 0 and jh.relationship = 1
where address_code = #{doorplateAddress.addressCode}
SELECT DISTINCT
jda.building_code,
jda.building_name
FROM
jczz_doorplate_address jda
LEFT JOIN jczz_district jd ON jd.aoi_code = jda.aoi_code
WHERE
jd.id = #{districtId}
and jda.building_code is not null
select count(*) from jczz_doorplate_address jda
left join jczz_house jh on jh.house_code = jda.address_code
where 1=1
and jh.house_code is null
and doorplate_type = '户室牌'
and jda.town_street_name like concat('%',#{townName},'%')
limit 0,1000
select count(*) from jczz_doorplate_address jda
left join jczz_grid_range jgr on jgr.house_code = jda.address_code
where 1=1
and jgr.house_code is null
and jda.town_street_name like concat('%',#{townName},'%')
and jda.nei_name like concat('%',#{communityName},'%')
limit 0,1000
select
jda.address_code,
jda.aoi_code,
jda.building_code,
jda.x,
jda.y
from jczz_doorplate_address jda
left join jczz_grid_range jgr on jgr.house_code = jda.address_code
where 1=1
and jgr.house_code is null
and jda.town_street_name like concat('%',#{townName},'%')
and jda.nei_name like concat('%',#{communityName},'%')
limit 0,1000
select
jda.*
from jczz_doorplate_address jda
left join jczz_house jh on jh.house_code = jda.address_code and jh.is_deleted = 0
where 1=1
and jh.id = #{houseId}