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