| | |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.system.entity.Region; |
| | | import org.springblade.system.entity.Tenant; |
| | | import org.springblade.system.service.IDeptService; |
| | | import org.springblade.system.service.IRegionService; |
| | | import org.springblade.system.service.ITenantService; |
| | | import org.springblade.system.vo.RoleVO; |
| | | import org.springblade.system.vo.TenantVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | |
| | | public class TenantController extends BladeController { |
| | | |
| | | private final ITenantService tenantService; |
| | | |
| | | private final IRegionService iRegionService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "分页", notes = "传入tenant") |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<Tenant>> page(Tenant tenant, Query query) throws ParseException { |
| | | IPage<Tenant> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant); |
| | | public R<IPage<TenantVo>> page(Tenant tenant, Query query) throws ParseException { |
| | | IPage<TenantVo> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant); |
| | | return R.data(pages); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "新增或修改", notes = "传入tenant") |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
| | | public R submit(@Valid @RequestBody Tenant tenant) { |
| | | //判断省市区的值是否为数字或者中文字符串 |
| | | if(null!=tenant.getProvince()){ |
| | | //如果不是数字,则需调用接口匹配数据(直接取区、县参数) |
| | | if (!tenant.getDistrict().matches("^[0-9]*$") && !tenant.getCity().matches("^[0-9]*$")){ |
| | | Region region = iRegionService.selRegionDetail(tenant.getDistrict(),tenant.getCity()); |
| | | if (null!=region){ |
| | | //封装数据 |
| | | tenant.setProvince(region.getProvinceCode()); |
| | | tenant.setCity(region.getCityCode()); |
| | | tenant.setDistrict(region.getDistrictCode()); |
| | | } |
| | | } |
| | | } |
| | | return R.status(tenantService.submitTenant(tenant)); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @PostMapping("/selectList") |
| | | public R selectList(String type) { |
| | | List<Map<String, Object>> list = tenantService.selectList(type); |
| | | @PostMapping("/selectListTe") |
| | | public R selectListTe(String type) { |
| | | List<Map<String, Object>> list = tenantService.selectListTe(type); |
| | | for (int i=0;i<list.size();i++){ |
| | | //医院 |
| | | if (list.get(i).get("type").equals("0")){ |