From 874bcde22a1538f8f5ff35fc7f9a59ab248ee347 Mon Sep 17 00:00:00 2001 From: "java_cuibaocheng@163.com" Date: Tue, 28 Nov 2023 19:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=8F=A3=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF-=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=9C=B0=E5=8C=BA?= =?UTF-8?q?=E5=B1=9E=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD=20=E4=BA=BA?= =?UTF-8?q?=E5=8F=A3=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF-=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E5=85=B3=E7=B3=BB=E5=9B=BE=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B0=81=E8=A3=85=E5=8A=9F=E8=83=BD=20=E4=BA=BA=E5=8F=A3?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF-=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=E7=94=9F=E6=97=A5=E4=B8=8E=E5=B9=B4=E9=BE=84=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BABug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PopulationInfoBigdataRouteController.java | 3 +- .../populationinfo/population-info-mapper.xml | 97 +++------ .../populationinfo/list-bigdata.html | 200 ++++++++++++------ 3 files changed, 169 insertions(+), 131 deletions(-) diff --git a/src/main/java/com/cm/population/controller/route/populationinfo/PopulationInfoBigdataRouteController.java b/src/main/java/com/cm/population/controller/route/populationinfo/PopulationInfoBigdataRouteController.java index 94c5ab6..7e7f3ed 100644 --- a/src/main/java/com/cm/population/controller/route/populationinfo/PopulationInfoBigdataRouteController.java +++ b/src/main/java/com/cm/population/controller/route/populationinfo/PopulationInfoBigdataRouteController.java @@ -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; } diff --git a/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml b/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml index f4e89dc..599c067 100644 --- a/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml +++ b/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml @@ -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} - AND ( t1.organization != '中国共产党党员' AND t1.organization != '中国共产主义青年团团员' AND - t1.organization != '中国共产党预备党员') + AND ( t1.organization != '中国共产党党员' AND t1.organization != '中国共产主义青年团团员' AND t1.organization != '中国共产党预备党员') AND (t1.flow_time = '' OR t1.flow_time IS NULL) @@ -1314,9 +1314,6 @@ AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) > 50 - - AND t1.creator_area1 = #{jiedao} - AND ( @@ -1330,78 +1327,38 @@ t1.population_info_id IN #{populationInfoIds[${index}]} - AND - t1.population_info_id IN ( - SELECT - hp. - population_info_id - FROM - house_population hp - WHERE - hp. - house_id = #{houseId} - ) + ) temp - WHERE - 1 = 1 - - AND EXISTS( + + 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 + + AND hh.residential_id = #{residential} + + + AND hh.building_id = #{building} + + + AND hp.house_id = #{house} + + + AND hp.house_id = #{houseId} + + ) AS subquery ON temp.population_info_id = subquery.population_info_id - - 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 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 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} - ) - - ORDER BY t1.gmt_create DESC + ORDER BY + temp.gmt_create DESC diff --git a/src/main/resources/templates/populationinfo/list-bigdata.html b/src/main/resources/templates/populationinfo/list-bigdata.html index abadfbe..4ff43e2 100644 --- a/src/main/resources/templates/populationinfo/list-bigdata.html +++ b/src/main/resources/templates/populationinfo/list-bigdata.html @@ -34,8 +34,12 @@ @@ -74,20 +78,20 @@
- - -
- @@ -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() {