人口基本信息- 增加了地区属选择功能

人口基本信息- 增加了关系图查询封装功能
人口基本信息- 修改了生日与年龄不显示Bug
This commit is contained in:
java_cuibaocheng@163.com 2023-11-28 19:58:36 +08:00
parent ae27c7e031
commit 874bcde22a
3 changed files with 169 additions and 131 deletions

View File

@ -76,7 +76,8 @@ public class PopulationInfoBigdataRouteController extends AbstractController {
@GetMapping("jiedao")
public ModelAndView jiedao(String name) {
ModelAndView mv = new ModelAndView("populationinfo/list-bigdata");
mv.addObject("params", "jiedao=" + name);
mv.addObject("params", "creatorArea1=" + name);
mv.addObject("jiedao", name);
return mv;
}

View File

@ -1211,7 +1211,8 @@
t1.othertext,
t1.creator,
t1.creator_area1,
t1.creator_area2
t1.creator_area2,
t1.gmt_create
FROM
population_population_info t1
WHERE
@ -1244,8 +1245,7 @@
AND t1.organization = #{organization}
</if>
<if test="organization != null and organization != '' and organization == '其他'">
AND ( t1.organization != '中国共产党党员' AND t1.organization != '中国共产主义青年团团员' AND
t1.organization != '中国共产党预备党员')
AND ( t1.organization != '中国共产党党员' AND t1.organization != '中国共产主义青年团团员' AND t1.organization != '中国共产党预备党员')
</if>
<if test="type != null and type != '' and type == '常住人口'">
AND (t1.flow_time = '' OR t1.flow_time IS NULL)
@ -1314,9 +1314,6 @@
<if test="age != null and age != '' and age == '50岁以上'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) > 50
</if>
<if test="jiedao != null and jiedao != ''">
AND t1.creator_area1 = #{jiedao}
</if>
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
@ -1330,78 +1327,38 @@
t1.population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>AND</if>
<if test="houseId != null and houseId != ''">t1.population_info_id IN (
SELECT
hp.
population_info_id
FROM
house_population hp
WHERE
hp.
house_id = #{houseId}
)
</foreach>
</if>
) temp
WHERE
1 = 1
<if test="residential != null and residential != ''"><!-- 小区 -->
AND EXISTS(
<if test="(residential != null and residential != '') or (building != null and building != '') or (house != null and house != '') or (houseId != null and houseId != '')">
INNER JOIN
(
SELECT
temp1.id
hp.population_info_id, hh.building_id
FROM
house_population temp1
house_population hp
LEFT JOIN
house_house temp2
house_house hh
ON
temp1.house_id = temp2.house_id
hp.house_id = hh.house_id
WHERE
temp1.is_delete = 0 AND temp1.population_info_id = temp.population_info_id AND temp2.residential_id = #{residential}
)
hp.is_delete = 0
<if test="residential != null and residential != ''"><!-- 小区 -->
AND hh.residential_id = #{residential}
</if>
<if test="building != null and building != ''"><!-- 楼排 -->
AND hh.building_id = #{building}
</if>
<if test="house != null and house != ''"><!-- 房屋 -->
AND hp.house_id = #{house}
</if>
<if test="houseId != null and houseId != ''"><!-- 房屋 -->
AND hp.house_id = #{houseId}
</if>
) AS subquery ON temp.population_info_id = subquery.population_info_id
</if>
<if test="building != null and building != ''"><!-- 楼排 -->
AND EXISTS(
SELECT
temp1.id
FROM
house_population temp1
LEFT JOIN
house_house temp2
ON
temp1.house_id = temp2.house_id
WHERE
temp1.is_delete = 0 AND temp1.population_info_id = temp.population_info_id AND temp2.building_id = #{building}
)
</if>
<if test="building != null and building != ''"><!-- 单元-->
AND EXISTS(
SELECT
temp1.id
FROM
house_population temp1
LEFT JOIN
house_house temp2
ON
temp1.house_id = temp2.house_id
WHERE
temp1.is_delete = 0 AND temp1.population_info_id = temp.population_info_id AND temp2.building_id = #{building} AND temp2.affiliation_unit = #{affiliationUnit}
)
</if>
<if test="affiliationFloors != null and affiliationFloors != ''"><!-- 楼层-->
AND EXISTS(
SELECT
temp1.id
FROM
house_population temp1
LEFT JOIN
house_house temp2
ON
temp1.house_id = temp2.house_id
WHERE
temp1.is_delete = 0 AND temp1.population_info_id = temp.population_info_id AND temp2.building_id = #{building} AND temp2.affiliation_unit = #{affiliationUnit} AND temp2.affiliation_floors = #{affiliationFloors}
)
</if>
ORDER BY t1.gmt_create DESC
ORDER BY
temp.gmt_create DESC
</select>
<!-- 基础人口信息列表 -->

View File

@ -34,8 +34,12 @@
<script id="streetNameSelectTemplate" type="text/html">
<select id="street" name="street" lay-filter="street" lay-verify="required" lay-search>
<option value="">请选择街道</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# for(var i = 0, item; item = d.list[i++];) { }}
{{# if(d.jiedao == item.name){ }}
<option selected value="{{item.id}}">{{item.name}}</option>
{{# } else { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
{{# } }}
</select>
</script>
@ -74,20 +78,20 @@
<select id="buildingId" name="buildingId" lay-filter="buildingId" lay-verify="required" lay-search>
<option value="">请选择楼/排</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.buildingId}}_{{item.unitNum}}_{{item.floorsNum}}">{{item.name}}</option>
<option value="{{item.buildingId}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所在单元/列<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="unit" name="unit" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="unitNameSelectTemplateBox" lay-filter="unitNameSelectTemplateBox"></div>
<script id="unitNameSelectTemplate" type="text/html">
<select id="unitId" name="unitId" lay-filter="buildingId" lay-verify="required" lay-search>
<option value="">请选择单元/列</option>
<label class="layui-form-label">所在房屋<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="house" name="house" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="houseNameSelectTemplateBox" lay-filter="houseNameSelectTemplateBox"></div>
<script id="houseNameSelectTemplate" type="text/html">
<select id="houseId" name="houseId" lay-filter="houseId" lay-verify="required" lay-search>
<option value="">请选择房屋</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.unitId}}_{{item.unitNum}}_{{item.floorsNum}}">{{item.name}}</option>
<option value="{{item.houseId}}">{{item.affiliationUnit}} / {{item.affiliationFloors}} / {{item.houseNum}}</option>
{{# } }}
</select>
</script>
@ -151,6 +155,13 @@
var resizeTimeout = null;
var tableUrl = 'api/populationinfo/listpage?[[${params}]]';
// 初始化街道下拉选择
var jiedao = "[[${jiedao}]]";
initStreetNameSelect();
initResidentialNameSelect('9999', '9999');
initBuildingNameSelect("9999");
initHouseNameSelect("9999");
// 初始化街道下拉选择
function initStreetNameSelect(selectedValue) {
$.ajax({
@ -158,7 +169,7 @@
type: 'get',
dataType: 'json',
success: function (data) {
laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render(data, function(html) {
laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render({jiedao: jiedao , list: data}, function(html) {
document.getElementById('streetNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'streetNameSelectTemplateBox');
@ -168,13 +179,16 @@
selectObj['street'] = selectedValue;
form.val('dataForm', selectObj);
}
if (jiedao) {
$("#creatorArea1").val(jiedao);
initCommunityNameSelect($("#street").val());
}else{
initCommunityNameSelect('9999');
}
}
});
}
// 初始化街道下拉选择
initStreetNameSelect();
// 初始化街道变化
form.on('select(street)', function(data){
var selectedText = data.elem[data.elem.selectedIndex].text;
@ -184,7 +198,6 @@
}else {
initCommunityNameSelect('9999');
}
reloadTable();
});
// 初始化社区变化
@ -197,44 +210,9 @@
}else {
initResidentialNameSelect(streetValue, '');
}
reloadTable();
});
// 初始化小区变化
form.on('select(residentialId)', function(data){
$("#residential").val(data.value);
if(data.value) {
initBuildingNameSelect(data.value);
}else {
initBuildingNameSelect('9999');
}
reloadTable();
});
// 初始化小区下拉选择
initResidentialNameSelect('9999', '9999');
function initResidentialNameSelect(street, community, selectedValue) {
$.ajax({
url: 'api/residential/list?street=' + street + '&community=' + community,
type: 'get',
dataType: 'json',
success: function (data) {
laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('residentialNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'residentialNameSelectTemplateBox');
if(selectedValue) {
var selectObj = {};
selectObj['residentialId'] = selectedValue;
form.val('dataForm', selectObj);
}
}
});
}
// 初始化社区下拉选择
initCommunityNameSelect('9999');
function initCommunityNameSelect(areaId, selectedValue) {
$.ajax({
url: 'api/residential/getCommunityList?areaId=' + areaId,
@ -251,24 +229,69 @@
selectObj['community'] = selectedValue;
form.val('dataForm', selectObj);
}
initResidentialNameSelect('9999', '9999');
initBuildingNameSelect("9999");
initHouseNameSelect("9999");
}
});
}
// 初始化小区变化
form.on('select(residentialId)', function(data){
$("#residential").val(data.value);
if(data.value) {
initBuildingNameSelect(data.value);
}else {
initBuildingNameSelect('9999');
}
});
// 初始化小区下拉选择
function initResidentialNameSelect(street, community, selectedValue) {
$.ajax({
url: 'api/residential/list?street=' + street + '&community=' + community,
type: 'get',
dataType: 'json',
success: function (data) {
laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('residentialNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'residentialNameSelectTemplateBox');
if(selectedValue) {
var selectObj = {};
selectObj['residentialId'] = selectedValue;
form.val('dataForm', selectObj);
}
initBuildingNameSelect("9999");
initHouseNameSelect("9999");
}
});
}
// 初始化楼栋变化
form.on('select(buildingId)', function(data){
$("#building").val(data.value);
reloadTable();
if(data.value) {
initHouseNameSelect(data.value);
}else {
initHouseNameSelect('9999');
}
});
// 初始化楼/排下拉选择
initBuildingNameSelect("9999");
function initBuildingNameSelect(residentialId, selectedValue) {
$.ajax({
url: 'api/building/list?residentialId=' + residentialId,
type: 'get',
dataType: 'json',
success: function (data) {
if(data.length < 1 && residentialId != 9999) {
layer.msg("该小区暂无录入楼/排");
}
laytpl(document.getElementById('buildingNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('buildingNameSelectTemplateBox').innerHTML = html;
});
@ -279,10 +302,41 @@
selectObj['buildingId'] = selectedValue;
form.val('dataForm', selectObj);
}
initHouseNameSelect("9999");
}
});
}
// 初始化房屋下拉选择
function initHouseNameSelect(buildingId, selectedValue) {
$.ajax({
url: 'api/house/list?buildingId=' + buildingId,
type: 'get',
dataType: 'json',
success: function (data) {
if(data.length < 1 && buildingId != 9999) {
layer.msg("该楼/排暂无录入房屋");
}
laytpl(document.getElementById('houseNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('houseNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'houseNameSelectTemplateBox');
if(selectedValue) {
var selectObj = {};
selectObj['houseId'] = selectedValue;
form.val('dataForm', selectObj);
}
}
});
}
// 初始化楼栋变化
form.on('select(houseId)', function(data){
$("#house").val(data.value);
});
// 初始化证件类型下拉选择
function initIdcardTypeSelect() {
$.ajax({
@ -412,14 +466,7 @@
function reloadTable(currentPage) {
table.reload('dataTable', {
url: tableUrl,
where: {
name: $('#name').val(),
idcardType: $('#idcardType').val(),
idcard: $('#idcard').val(),
creatorArea1: $("#creatorArea1").val() == undefined || $("#creatorArea1").val() == "" ? "" : $("#creatorArea1").val(),
creatorArea2: $("#creatorArea2").val() == undefined || $("#creatorArea2").val() == "" ? "" : $("#creatorArea2").val(),
residential: $("#residential").val() == undefined || $("#residential").val() == "" ? "" : $("#residential").val(),
},
where: getParams(),
page: {
curr: currentPage
},
@ -427,6 +474,39 @@
});
}
var getParams = function() {
var data = {name: $('#name').val(), idcardType: $('#idcardType').val(), idcard: $('#idcard').val()};
if ($("#creatorArea1").val() == undefined || $("#creatorArea1").val() == "" ) {
return data;
}else{
data.creatorArea1 = $("#creatorArea1").val();
}
if ($("#creatorArea2").val() == undefined || $("#creatorArea2").val() == "" ) {
return data;
}else{
data.creatorArea2 = $("#creatorArea2").val();
}
if ($("#residential").val() == undefined || $("#residential").val() == "" ) {
return data;
}else{
data.residential = $("#residential").val();
}
if ($("#building").val() == undefined || $("#building").val() == "" ) {
return data;
}else{
data.residential = "";
data.building = $("#building").val();
}
if ($("#house").val() == undefined || $("#house").val() == "" ) {
return data;
}else{
data.residential = "";
data.building = "";
data.house = $("#house").val();
}
return data;
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {