diff --git a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java index 88e71cd6..a676a653 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java @@ -155,24 +155,6 @@ public class MedicaldesController { return R.ok().put("result", page); } - /** - * 学术传承列表按类型、地区 - */ - @RequestMapping(path = "/inheritListByTypeProvId") - public R inheritListByTypeProvId(String type,String provId) { - MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); - wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId); - wrapper.eq(MedicaldesInheritRelation::getTypeId,type); - wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); - wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); - wrapper.selectAll(MedicaldesInherit.class); - wrapper.eq(Province::getProvId,provId); - wrapper.selectAs(MedicaldesInheritRelation::getSort,"sort"); - wrapper.orderByAsc(MedicaldesInheritRelation::getSort); - List list = inheritService.list(wrapper); - return R.ok().put("result", list); - } - //国际医师可能来自国外在省市里加入外国 public String[] getCounts() { //countId 为1 2 3 @@ -190,6 +172,29 @@ public class MedicaldesController { return cityList; } + /** + * 学术传承列表按类型、地区 + */ + @RequestMapping(path = "/inheritListByTypeProvId") + public R inheritListByTypeProvId(String type,String provId) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); + wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId); + wrapper.eq(MedicaldesInheritRelation::getTypeId,type); + wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); + wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); + wrapper.selectAll(MedicaldesInherit.class); + if ("0".equals(provId)){ + //未知地址 + wrapper.in(MedicaldesInherit::getCityId,0,1,2,3); + }else { + wrapper.eq(Province::getProvId,provId); + } + wrapper.selectAs(MedicaldesInheritRelation::getSort,"sort"); + wrapper.orderByAsc(MedicaldesInheritRelation::getSort); + List list = inheritService.list(wrapper); + return R.ok().put("result", list); + } + //获取地址 @RequestMapping(path = "/getMedicaldesProList") public R getMedicaldesProList() { @@ -278,8 +283,8 @@ public class MedicaldesController { wrapper.eq(MedicaldesInheritRelation::getTypeId,type); wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); - wrapper.selectAs(Province::getProvName,"provinceName"); - wrapper.selectAs(Province::getProvId,"provinceId"); + wrapper.select("IFNULL(t3.prov_name, '其他') AS provinceName"); + wrapper.select("IFNULL(t3.prov_id, 0) AS provinceId"); wrapper.select("count(*) as count"); wrapper.groupBy("provinceName"); wrapper.orderByAsc(MedicaldesInheritRelation::getSort);