优化
This commit is contained in:
parent
fb83c51556
commit
d841701650
@ -72,6 +72,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/getCityList").permitAll()//根据省编号获取市列表
|
||||
.antMatchers(HttpMethod.GET, "/getCountyList").permitAll()//根据市编号获取区县列表
|
||||
.antMatchers(HttpMethod.GET, "/getStreetList").permitAll()//根据区县编号获取街道列表
|
||||
.antMatchers(HttpMethod.GET, "/getAllRegionList").permitAll()//获取全部的区划信息
|
||||
.antMatchers(HttpMethod.GET, "/api/adm/getProvinceList").permitAll()//获取省列表
|
||||
.antMatchers(HttpMethod.GET, "/api/adm/getCityList").permitAll()//根据省编号获取市列表
|
||||
.antMatchers(HttpMethod.GET, "/api/adm/getCountyList").permitAll()//根据市编号获取区县列表
|
||||
|
14
src/main/java/com/xkrs/dao/SomeThingDao.java
Normal file
14
src/main/java/com/xkrs/dao/SomeThingDao.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.xkrs.dao;
|
||||
|
||||
import com.xkrs.model.entity.SomeThingEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@Component
|
||||
public interface SomeThingDao extends JpaRepository<SomeThingEntity, Long>, JpaSpecificationExecutor<SomeThingEntity> {
|
||||
|
||||
}
|
50
src/main/java/com/xkrs/model/entity/SomeThingEntity.java
Normal file
50
src/main/java/com/xkrs/model/entity/SomeThingEntity.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.xkrs.model.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "some_thing")
|
||||
public class SomeThingEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "some_thing_seq_gen")
|
||||
@SequenceGenerator(name = "some_thing_seq_gen", sequenceName = "some_thing_id_seq", allocationSize = 1)
|
||||
private Long id;
|
||||
|
||||
@Column(length = 4096000, columnDefinition = "varchar(4096000)")
|
||||
private String content;
|
||||
|
||||
public SomeThingEntity() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SomeThingEntity{" +
|
||||
"id=" + id +
|
||||
", content='" + content + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,15 +1,19 @@
|
||||
package com.xkrs.service.impl;
|
||||
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.dao.SomeThingDao;
|
||||
import com.xkrs.dao.StreetDao;
|
||||
import com.xkrs.model.bean.RegionBean;
|
||||
import com.xkrs.model.entity.SomeThingEntity;
|
||||
import com.xkrs.model.entity.StreetEntity;
|
||||
import com.xkrs.service.StreetService;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
|
||||
@Service
|
||||
public class StreetServiceImpl implements StreetService {
|
||||
@ -19,6 +23,10 @@ public class StreetServiceImpl implements StreetService {
|
||||
@Resource
|
||||
private StreetDao streetDao;
|
||||
|
||||
@Resource
|
||||
private SomeThingDao someThingDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<StreetEntity> findByProName(String proName) {
|
||||
return streetDao.findByProName(proName);
|
||||
@ -82,7 +90,45 @@ public class StreetServiceImpl implements StreetService {
|
||||
@Override
|
||||
public String getAllRegionList() {
|
||||
|
||||
Optional<SomeThingEntity> targetOptional = someThingDao.findById(1L);
|
||||
return targetOptional.get().getContent();
|
||||
|
||||
return null;
|
||||
// List<Map<String, String>> provinceList = selectProvinceList();
|
||||
// List<RegionBean> provinceBeanList = new ArrayList<>();
|
||||
// for (Map<String, String> province : provinceList) {
|
||||
// RegionBean provinceBean = new RegionBean();
|
||||
// provinceBean.setCode(province.get("code"));
|
||||
// provinceBean.setName(province.get("name"));
|
||||
// List<Map<String, String>> cityList = selectCityList(province.get("code"));
|
||||
// List<RegionBean> cityBeanList = new ArrayList<>();
|
||||
// for (Map<String, String> city : cityList) {
|
||||
// RegionBean cityBean = new RegionBean();
|
||||
// cityBean.setCode(city.get("code"));
|
||||
// cityBean.setName(city.get("name"));
|
||||
// List<Map<String, String>> countyList = selectCountyList(city.get("code"));
|
||||
// List<RegionBean> countyBeanList = new ArrayList<>();
|
||||
// for (Map<String, String> county : countyList) {
|
||||
// RegionBean countyBean = new RegionBean();
|
||||
// countyBean.setCode(county.get("code"));
|
||||
// countyBean.setName(county.get("name"));
|
||||
//// List<Map<String, String>> streetList = selectStreetList(county.get("name"));
|
||||
//// List<RegionBean> streetBeanList = new ArrayList<>();
|
||||
//// for (Map<String, String> street : streetList) {
|
||||
//// RegionBean streetBean = new RegionBean();
|
||||
//// streetBean.setCode(street.get("code"));
|
||||
//// streetBean.setName(street.get("name"));
|
||||
//// streetBeanList.add(streetBean);
|
||||
//// }
|
||||
//// countyBean.setChildren(streetBeanList);
|
||||
// countyBeanList.add(countyBean);
|
||||
// }
|
||||
// cityBean.setChildren(countyBeanList);
|
||||
// cityBeanList.add(cityBean);
|
||||
// }
|
||||
// provinceBean.setChildren(cityBeanList);
|
||||
// provinceBeanList.add(provinceBean);
|
||||
// }
|
||||
// return outputEncapsulationObject(PromptMessageEnum.SUCCESS, provinceBeanList, locale);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user