吴门医述-学术传承-外国地址修改为数据字典取值
This commit is contained in:
@@ -156,17 +156,18 @@ public class MedicaldesController {
|
||||
}
|
||||
|
||||
//国际医师可能来自国外在省市里加入外国
|
||||
public String[] getCounts() {
|
||||
//countId 为1 2 3
|
||||
String[] count = {"马来西亚","越南","加拿大"};
|
||||
return count;
|
||||
public List<SysDictDataEntity> getCounts() {
|
||||
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(SysDictDataEntity::getDictLabel,"inheritPro");
|
||||
List<SysDictDataEntity> dataList = sysDictDataService.list(wrapper);
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public List getCityList(String count,int countId) {
|
||||
public List getCityList(String cityName,int countId) {
|
||||
List<City> cityList = new ArrayList<>();
|
||||
City city = new City();
|
||||
city.setProvId((long)countId);
|
||||
city.setCityName(count);
|
||||
city.setCityName(cityName);
|
||||
city.setCityId((long)countId);
|
||||
cityList.add(city);
|
||||
return cityList;
|
||||
@@ -184,8 +185,14 @@ public class MedicaldesController {
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAll(MedicaldesInherit.class);
|
||||
if ("0".equals(provId)){
|
||||
int[] val = new int[] {0};
|
||||
//未知地址
|
||||
wrapper.in(MedicaldesInherit::getCityId,0,1,2,3);
|
||||
if (getCounts()!=null&&getCounts().size() > 0){
|
||||
for (int i=1;i<=getCounts().size(); i++){
|
||||
val[i] = i;
|
||||
}
|
||||
}
|
||||
wrapper.in(MedicaldesInherit::getCityId,val);
|
||||
}else {
|
||||
wrapper.eq(Province::getProvId,provId);
|
||||
}
|
||||
@@ -200,12 +207,12 @@ public class MedicaldesController {
|
||||
public R getMedicaldesProList() {
|
||||
String s = redisTemplate.opsForValue().get("Province");
|
||||
List<Province> provinceList = new ArrayList<>();
|
||||
if (getCounts() != null){
|
||||
for (int i=0;i<getCounts().length;i++){
|
||||
if (getCounts() != null&&getCounts().size() > 0){
|
||||
for (int i=0;i<getCounts().size();i++){
|
||||
Province p = new Province();
|
||||
p.setProvName(getCounts()[i]);
|
||||
p.setProvId((long)i+1);
|
||||
p.setCityList(getCityList(getCounts()[i],i+1));
|
||||
p.setProvName(getCounts().get(i).getDictValue());
|
||||
p.setProvId(Long.valueOf(getCounts().get(i).getDictType()));
|
||||
p.setCityList(getCityList(getCounts().get(i).getDictValue(),Integer.parseInt(getCounts().get(i).getDictType())));
|
||||
provinceList.add(p);
|
||||
}
|
||||
}
|
||||
@@ -226,13 +233,17 @@ public class MedicaldesController {
|
||||
@RequestMapping(path = "/getCityByPro")
|
||||
public R getCityByPro(@RequestParam("provId") Integer provId) {
|
||||
List<City> prov = new ArrayList<>();
|
||||
if (1==provId){
|
||||
prov.addAll(getCityList(getCounts()[0],1));
|
||||
}else if (2==provId){
|
||||
prov.addAll(getCityList(getCounts()[1],2));
|
||||
}else if (3==provId){
|
||||
prov.addAll(getCityList(getCounts()[2],3));
|
||||
}else {
|
||||
List<SysDictDataEntity> list = getCounts();
|
||||
boolean flag = false;
|
||||
if (list != null && list.size() > 0) {
|
||||
for (SysDictDataEntity data:list) {
|
||||
if (provId==Integer.parseInt(data.getDictType())){
|
||||
prov.addAll(getCityList(data.getDictValue(),Integer.parseInt(data.getDictType())));
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>()
|
||||
.eq("prov_id", provId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user