人口基本信息- 修改全国地区下拉加载慢的问题
解决方法, 现在将全国所有的地区信息分级缓存到Java静态区中, 增加后台的查询速度(最终响应速度取决于服务器网速与用户网速)
This commit is contained in:
parent
87cc7562d3
commit
0b16d57f05
@ -18,6 +18,7 @@ import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.vos.correct.CorrectVO;
|
||||
import com.cm.population.service.correct.ICorrectService;
|
||||
import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.utils.AreaUtils;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -39,6 +40,8 @@ public class AreaTreeController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private IPopulationInfoService iPopulationInfoService;
|
||||
@Autowired
|
||||
private AreaUtils areaUtils;
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{areaCode}")
|
||||
public Map<String, Object> get(@PathVariable("areaCode") String areaCode) {
|
||||
@ -51,38 +54,38 @@ public class AreaTreeController extends AbstractController {
|
||||
return objectMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全国地区属
|
||||
* @return
|
||||
*/
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list2")
|
||||
public List<DataAreaDTO> list2() {
|
||||
List<DataAreaDTO> list = iPopulationInfoService.getAreaList();
|
||||
for(DataAreaDTO dto : list) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(dto.getAreaName());
|
||||
getParent(names, dto.getAreaParentId());
|
||||
dto.setAreaMergerMame(StringUtils.join(names, "/"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
// /**
|
||||
// * 全国地区属
|
||||
// * @return
|
||||
// */
|
||||
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
// @GetMapping("list2")
|
||||
// public List<DataAreaDTO> list2() {
|
||||
// List<DataAreaDTO> list = iPopulationInfoService.getAreaList();
|
||||
// for(DataAreaDTO dto : list) {
|
||||
// ArrayList<String> names = new ArrayList<>();
|
||||
// names.add(dto.getAreaName());
|
||||
// getParent(names, dto.getAreaParentId());
|
||||
// dto.setAreaMergerMame(StringUtils.join(names, "/"));
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("newtree")
|
||||
public List<Map<String, Object>> tree1(String id) {
|
||||
String parentId = id == null ? "0" : id;
|
||||
List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for(AreaZtreeDTO dto : list) {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
objectMap.put("label", dto.getName());
|
||||
objectMap.put("code", dto.getAreaCode());
|
||||
objectMap.put("value", dto.getId());
|
||||
result.add(objectMap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
// @GetMapping("newtree")
|
||||
// public List<Map<String, Object>> tree1(String id) {
|
||||
// String parentId = id == null ? "0" : id;
|
||||
// List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
// List<Map<String, Object>> result = new ArrayList<>();
|
||||
// for(AreaZtreeDTO dto : list) {
|
||||
// Map<String, Object> objectMap = new HashMap<>();
|
||||
// objectMap.put("label", dto.getName());
|
||||
// objectMap.put("code", dto.getAreaCode());
|
||||
// objectMap.put("value", dto.getId());
|
||||
// result.add(objectMap);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("huji")
|
||||
@ -147,14 +150,7 @@ public class AreaTreeController extends AbstractController {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
parentId = "752234";
|
||||
}
|
||||
List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
for(AreaZtreeDTO dto : list) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(dto.getName());
|
||||
getParent(names, dto.getpId());
|
||||
dto.setTitle(StringUtils.join(names, "/"));
|
||||
}
|
||||
return list;
|
||||
return areaUtils.getList(parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,18 +161,7 @@ public class AreaTreeController extends AbstractController {
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("list")
|
||||
public List<AreaZtreeDTO> list(String id) {
|
||||
String parentId = id;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
parentId = "0"; // 默认查找全国
|
||||
}
|
||||
List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
for(AreaZtreeDTO dto : list) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(dto.getName());
|
||||
getParent(names, dto.getpId());
|
||||
dto.setTitle(StringUtils.join(names, "/"));
|
||||
}
|
||||
return list;
|
||||
return areaUtils.getList(id);
|
||||
}
|
||||
|
||||
public void getParent(ArrayList names, String pId) {
|
||||
|
@ -7,6 +7,7 @@ import com.cm.common.pojo.dtos.ZTreeDTO;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.population.pojo.dtos.areatree.AreaZtreeDTO;
|
||||
import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.utils.AreaUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
@ -33,6 +34,14 @@ public class AreaTreeAppController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private IPopulationInfoService iPopulationInfoService;
|
||||
@Autowired
|
||||
private AreaUtils areaUtils;
|
||||
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "用来测试地区的-不参与业务", response = ErrorResult.class)})
|
||||
@GetMapping("hu")
|
||||
public List<AreaZtreeDTO> huji1(String id) {
|
||||
return areaUtils.getList(id);
|
||||
}
|
||||
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("huji")
|
||||
@ -97,14 +106,7 @@ public class AreaTreeAppController extends AbstractController {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
parentId = "752234";
|
||||
}
|
||||
List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
for(AreaZtreeDTO dto : list) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(dto.getName());
|
||||
getParent(names, dto.getpId());
|
||||
dto.setTitle(StringUtils.join(names, "/"));
|
||||
}
|
||||
return list;
|
||||
return areaUtils.getList(parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,18 +117,7 @@ public class AreaTreeAppController extends AbstractController {
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<AreaZtreeDTO> list(String id) {
|
||||
String parentId = id;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
parentId = "0"; // 默认查找全国
|
||||
}
|
||||
List<AreaZtreeDTO> list = iPopulationInfoService.listAreaTree(parentId);
|
||||
for(AreaZtreeDTO dto : list) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(dto.getName());
|
||||
getParent(names, dto.getpId());
|
||||
dto.setTitle(StringUtils.join(names, "/"));
|
||||
}
|
||||
return list;
|
||||
return areaUtils.getList(id);
|
||||
}
|
||||
|
||||
public void getParent(ArrayList names, String pId) {
|
||||
|
@ -18,4 +18,8 @@ public interface IAreatreeDao {
|
||||
Integer countByParentId(String parentId);
|
||||
|
||||
List<DataAreaDTO> list(Map<String, Object> params);
|
||||
|
||||
List<AreaZtreeDTO> listCache(Map<String, Object> params);
|
||||
|
||||
AreaZtreeDTO getAreaByAreaId(Map<String, Object> params);
|
||||
}
|
||||
|
@ -2,9 +2,29 @@ package com.cm.population.pojo.dtos.areatree;
|
||||
|
||||
import com.cm.common.pojo.dtos.ZTreeDTO;
|
||||
|
||||
public class AreaZtreeDTO extends ZTreeDTO {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AreaZtreeDTO extends ZTreeDTO implements Serializable {
|
||||
|
||||
private String areaCode;
|
||||
private String areaLevel;
|
||||
private Integer subCount;
|
||||
|
||||
public String getAreaLevel() {
|
||||
return areaLevel;
|
||||
}
|
||||
|
||||
public void setAreaLevel(String areaLevel) {
|
||||
this.areaLevel = areaLevel;
|
||||
}
|
||||
|
||||
public Integer getSubCount() {
|
||||
return subCount;
|
||||
}
|
||||
|
||||
public void setSubCount(Integer subCount) {
|
||||
this.subCount = subCount;
|
||||
}
|
||||
|
||||
public AreaZtreeDTO(){
|
||||
super();
|
||||
|
@ -27,8 +27,17 @@ public interface IPopulationInfoService {
|
||||
void getTuoMin(PopulationInfoDTO dto);
|
||||
void getTuoMin(PopulationInfoBaseDTO dto);
|
||||
|
||||
/**
|
||||
* 按照level查询地区
|
||||
* @param level 地区级别
|
||||
* @param page 0为不分页 , 每次默认10000条
|
||||
* @return
|
||||
*/
|
||||
List<AreaZtreeDTO> getAreaListByLevel(String level, Integer page);
|
||||
|
||||
DataAreaDTO getAreaByCode(String code);
|
||||
DataAreaDTO getAreaById(String id);
|
||||
AreaZtreeDTO getAreaByAreaId(String id);
|
||||
List<AreaZtreeDTO> listAreaTree(String parentId);
|
||||
|
||||
PopulationInfoBaseDTO getBase(String populationInfoId);
|
||||
|
@ -42,6 +42,7 @@ import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.service.populationlog.IPopulationLogService;
|
||||
import com.cm.population.service.release.IReleaseService;
|
||||
import com.cm.population.service.security.ISecurityService;
|
||||
import com.cm.population.utils.AreaDTO;
|
||||
import com.cm.population.utils.IdCardVerifyUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@ -84,6 +85,13 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
return iAreatreeDao.getArea(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AreaZtreeDTO getAreaByAreaId(String id) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("areaId", id);
|
||||
return iAreatreeDao.getAreaByAreaId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataAreaDTO> getAreaList() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@ -91,6 +99,18 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaZtreeDTO> getAreaListByLevel(String level, Integer page) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("level", StringUtils.isEmpty(level) ? "-1" : level);
|
||||
if (-1 != page) {
|
||||
params.put("startPage", page * 10000);
|
||||
System.err.println(level + "正在缓存:" + (page * 10000) + "-" + ((page * 10000) + 10000) ) ;
|
||||
}
|
||||
List<AreaZtreeDTO> list = iAreatreeDao.listCache(params);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTuoMin(PopulationInfoDTO dto) {
|
||||
String idcard = dto.getIdcard();
|
||||
|
54
src/main/java/com/cm/population/utils/AreaDTO.java
Normal file
54
src/main/java/com/cm/population/utils/AreaDTO.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.cm.population.utils;
|
||||
|
||||
public class AreaDTO{
|
||||
|
||||
private String name;
|
||||
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String pId;
|
||||
|
||||
private String names;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
|
||||
public void setpId(String pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
|
||||
public String getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
public void setNames(String names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
158
src/main/java/com/cm/population/utils/AreaUtils.java
Normal file
158
src/main/java/com/cm/population/utils/AreaUtils.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.cm.population.utils;
|
||||
|
||||
import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO;
|
||||
import com.cm.population.pojo.dtos.areatree.AreaZtreeDTO;
|
||||
import com.cm.population.service.populationinfo.IPopulationInfoService;
|
||||
import com.cm.population.service.populationinfo.impl.PopulationInfoServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
@Component
|
||||
public class AreaUtils {
|
||||
|
||||
@Autowired
|
||||
private IPopulationInfoService PopulationInfoService;
|
||||
private static IPopulationInfoService PopulationInfoStaticService;
|
||||
private static final Map<Integer, Map<String, AreaZtreeDTO>> aree = new ConcurrentSkipListMap<Integer, Map<String, AreaZtreeDTO>>();
|
||||
private static final Map<String, AreaZtreeDTO> area0 = new ConcurrentSkipListMap<String, AreaZtreeDTO>();//省
|
||||
private static final Map<String, AreaZtreeDTO> area1 = new ConcurrentSkipListMap<String, AreaZtreeDTO>();//市
|
||||
private static final Map<String, AreaZtreeDTO> area2 = new ConcurrentSkipListMap<String, AreaZtreeDTO>();//线
|
||||
private static final Map<String, AreaZtreeDTO> area3 = new ConcurrentSkipListMap<String, AreaZtreeDTO>();//街道
|
||||
private static final Map<String, AreaZtreeDTO> area4 = new ConcurrentSkipListMap<String, AreaZtreeDTO>();//社区
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
PopulationInfoStaticService = PopulationInfoService;
|
||||
initArea0();
|
||||
initArea1();
|
||||
initArea2();
|
||||
initArea3();
|
||||
initArea4();
|
||||
aree.put(0, area0);
|
||||
aree.put(1, area1);
|
||||
aree.put(2, area2);
|
||||
aree.put(3, area3);
|
||||
aree.put(4, area4);
|
||||
}
|
||||
|
||||
public List<AreaZtreeDTO> getList(String id) {
|
||||
id = "0".equals(id) ? "" : id;
|
||||
List<AreaZtreeDTO> list = new ArrayList<AreaZtreeDTO>();
|
||||
Integer level = -1;
|
||||
Integer subCount = 0;
|
||||
// 确定级别
|
||||
if (!StringUtils.isEmpty(id) ) {
|
||||
AreaZtreeDTO areaDTO = PopulationInfoStaticService.getAreaByAreaId(id);
|
||||
level = Integer.valueOf(areaDTO.getAreaLevel());
|
||||
subCount = areaDTO.getSubCount();
|
||||
}
|
||||
Map<String, AreaZtreeDTO> dataMap = aree.get(level + 1);
|
||||
if (dataMap != null) {
|
||||
// 找出所有的子类
|
||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||
AreaZtreeDTO ztreeDTO = m.getValue();
|
||||
String pId = ztreeDTO.getpId();
|
||||
String title = ztreeDTO.getTitle();
|
||||
if(!StringUtils.isEmpty(id) && pId.equals(id)) {
|
||||
if (StringUtils.isEmpty(title)) {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
getParent(level, names, id);
|
||||
String newName = StringUtils.join(names, "/") + "/" + ztreeDTO.getName();
|
||||
ztreeDTO.setTitle(newName);
|
||||
}
|
||||
list.add(ztreeDTO);
|
||||
if (list.size() == subCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(StringUtils.isEmpty(id)) {
|
||||
ztreeDTO.setTitle(ztreeDTO.getName());
|
||||
list.add(ztreeDTO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 递归拼接全名称
|
||||
public void getParent(Integer level, ArrayList<String> names, String pId) {
|
||||
Map<String, AreaZtreeDTO> dataMap = aree.get(level);
|
||||
if (level > -1 && dataMap != null) {
|
||||
level--;
|
||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||
String id = m.getValue().getId();
|
||||
if(pId.equals(id)) {
|
||||
names.add(0, m.getValue().getName());
|
||||
getParent(level, names, m.getValue().getpId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void initArea0() {
|
||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("0", -1);
|
||||
for(AreaZtreeDTO areaDTO : dto) {
|
||||
if (areaDTO.getSubCount() > 0 ) {
|
||||
areaDTO.setIsParent(true);
|
||||
}
|
||||
area0.put(areaDTO.getId(), areaDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initArea1() {
|
||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("1", -1);
|
||||
for(AreaZtreeDTO areaDTO : dto) {
|
||||
if (areaDTO.getSubCount() > 0 ) {
|
||||
areaDTO.setIsParent(true);
|
||||
}
|
||||
area1.put(areaDTO.getId(), areaDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initArea2() {
|
||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("2", -1);
|
||||
for(AreaZtreeDTO areaDTO : dto) {
|
||||
if (areaDTO.getSubCount() > 0 ) {
|
||||
areaDTO.setIsParent(true);
|
||||
}
|
||||
area2.put(areaDTO.getId(), areaDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initArea3() {
|
||||
for(int i = 0 ; i < 9 ; i++ ) {
|
||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("3", i);
|
||||
for(AreaZtreeDTO areaDTO : dto) {
|
||||
if (areaDTO.getSubCount() > 0 ) {
|
||||
areaDTO.setIsParent(true);
|
||||
}
|
||||
area3.put(areaDTO.getId(), areaDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void initArea4() {
|
||||
for(int i = 0 ; i < 67 ; i++ ) {
|
||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("4", i);
|
||||
for(AreaZtreeDTO areaDTO : dto) {
|
||||
if (areaDTO.getSubCount() > 0 ) {
|
||||
areaDTO.setIsParent(true);
|
||||
}
|
||||
area4.put(areaDTO.getId(), areaDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.cm.population.utils;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SystemPopulationUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if(SystemPopulationUtil.applicationContext == null) {
|
||||
SystemPopulationUtil.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
//获取applicationContext
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
//通过name获取 Bean.
|
||||
public static Object getBean(String name){
|
||||
return getApplicationContext().getBean(name);
|
||||
}
|
||||
|
||||
//通过class获取Bean.
|
||||
public static <T> T getBean(Class<T> clazz){
|
||||
return getApplicationContext().getBean(clazz);
|
||||
}
|
||||
|
||||
//通过name,以及Clazz返回指定的Bean
|
||||
public static <T> T getBean(String name,Class<T> clazz){
|
||||
return getApplicationContext().getBean(name, clazz);
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,15 @@
|
||||
|
||||
<cache></cache>
|
||||
|
||||
<resultMap id="areaZtreeDTO" type="com.cm.population.pojo.dtos.areatree.AreaZtreeDTO">
|
||||
<id property="id" column="area_id"/>
|
||||
<result property="pId" column="area_parent_id"/>
|
||||
<result property="name" column="area_name"/>
|
||||
<result property="areaCode" column="area_code"/>
|
||||
<result property="areaLevel" column="area_level"/>
|
||||
<result property="subCount" column="subCount"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="areaDTO" type="com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO">
|
||||
<id property="areaId" column="area_id"/>
|
||||
<result property="areaParentId" column="area_parent_id"/>
|
||||
@ -16,6 +25,7 @@
|
||||
<result property="areaLevel" column="area_level"/>
|
||||
<result property="areaLng" column="area_lng"/>
|
||||
<result property="areaLat" column="area_lat"/>
|
||||
<result property="subCount" column="subCount"/>
|
||||
<result property="areaPinyin" column="area_pinyin"/>
|
||||
<result property="areaFirst" column="area_first"/>
|
||||
</resultMap>
|
||||
@ -37,6 +47,26 @@
|
||||
is_delete = 0 AND area_parent_id = #{areaParentId}
|
||||
</select>
|
||||
|
||||
<select id="listCache" parameterType="map" resultMap="areaZtreeDTO" useCache="true">
|
||||
SELECT
|
||||
t1.area_id,
|
||||
t1.area_parent_id,
|
||||
t1.area_name,
|
||||
t1.area_code,
|
||||
(SELECT COUNT(1) FROM data_area t2 WHERE t2.is_delete = 0 AND t2.area_parent_id = t1.area_id) AS subCount
|
||||
FROM
|
||||
data_area t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="level != null and level != ''">
|
||||
AND t1.area_level = #{level}
|
||||
</if>
|
||||
ORDER BY t1.area_id
|
||||
<if test="startPage != null">
|
||||
LIMIT ${startPage} , 10000
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultMap="areaDTO" useCache="true">
|
||||
SELECT
|
||||
t1.area_id,
|
||||
@ -47,6 +77,21 @@
|
||||
data_area t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
ORDER BY t1.area_id
|
||||
</select>
|
||||
|
||||
<select id="getAreaByAreaId" parameterType="map" resultMap="areaZtreeDTO" useCache="true">
|
||||
SELECT
|
||||
t1.area_id,
|
||||
t1.area_parent_id,
|
||||
t1.area_name,
|
||||
t1.area_code,
|
||||
t1.area_level,
|
||||
(SELECT COUNT(1) FROM data_area t2 WHERE t2.is_delete = 0 AND t2.area_parent_id = t1.area_id) AS subCount
|
||||
FROM
|
||||
data_area t1
|
||||
WHERE
|
||||
t1.is_delete = 0 AND t1.area_id = #{areaId}
|
||||
</select>
|
||||
|
||||
<select id="getArea" parameterType="map" resultMap="areaDTO" useCache="true">
|
||||
@ -64,7 +109,8 @@
|
||||
t1.area_lat,
|
||||
t1.area_pinyin,
|
||||
t1.area_first,
|
||||
t2.area_name area_parent_name
|
||||
t2.area_name area_parent_name,
|
||||
(SELECT COUNT(1) FROM data_area t2 WHERE t2.is_delete = 0 AND t2.area_parent_id = t1.area_id) AS subCount
|
||||
FROM
|
||||
data_area t1
|
||||
LEFT JOIN
|
||||
@ -83,6 +129,7 @@
|
||||
AND
|
||||
t1.area_id = #{areaId}
|
||||
</if>
|
||||
ORDER BY t1.area_id
|
||||
</select>
|
||||
|
||||
<select id="countByParentId" parameterType="String" resultType="Integer" useCache="true">
|
||||
|
@ -101,7 +101,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -132,7 +132,7 @@
|
||||
initAreaTree("cult");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -101,7 +101,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -128,7 +128,7 @@
|
||||
initAreaTree("cult");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -590,7 +590,7 @@
|
||||
<input type="hidden" class="store_Lat" />
|
||||
<input type="hidden" class="store_Address" />
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -707,7 +707,7 @@
|
||||
initAreaTree("case");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
@ -716,7 +716,7 @@
|
||||
initAreaTree("party");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -590,7 +590,7 @@
|
||||
<input type="hidden" class="store_Lat" />
|
||||
<input type="hidden" class="store_Address" />
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -711,7 +711,7 @@
|
||||
initAreaTree("case");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -247,7 +247,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -449,7 +449,7 @@
|
||||
initHuJiAreaTree("domicile");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -822,7 +822,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -904,8 +904,8 @@
|
||||
initHuJiAreaTree("domicile");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: (cityOffset.top - 250) + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
||||
@ -913,7 +913,7 @@
|
||||
initAreaTree("disability");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -820,7 +820,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -848,8 +848,8 @@
|
||||
initHuJiAreaTree("domicile");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: (cityOffset.top - 250) + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
||||
@ -857,7 +857,7 @@
|
||||
initAreaTree("disability");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -179,7 +179,7 @@
|
||||
<input type="hidden" class="store_Lat" />
|
||||
<input type="hidden" class="store_Address" />
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -209,7 +209,7 @@
|
||||
initAreaTree("security");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
@ -180,7 +180,7 @@
|
||||
<input type="hidden" class="store_Lat" />
|
||||
<input type="hidden" class="store_Address" />
|
||||
</div>
|
||||
<div id="companiesTree" class="companiesTree" style="display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<div id="companiesTree" class="companiesTree" style="border:solid 1px #808080; display: none;background: #f9f9f9; position: absolute;z-index: 10;height: 250px;overflow: auto;overflow-x: hidden;">
|
||||
<ul id="treeDemo" class="ztree" style="width:400px;">
|
||||
</ul>
|
||||
</div>
|
||||
@ -211,7 +211,7 @@
|
||||
initAreaTree("security");
|
||||
var cityObj = $(this);
|
||||
var cityOffset = cityObj.offset();
|
||||
var width = Number(cityObj.width()) + 13;
|
||||
var width = Number(cityObj.width()) + 10;
|
||||
$("#companiesTree").css({width: width + "px", left: cityOffset.left + "px", top: cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast");
|
||||
$("body").bind("mousedown", onBodyDown);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user