| | |
| | | package com.ltkj.web.controller.swagger; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.enums.DataSourceType; |
| | | import com.ltkj.db.DataSourceConfig; |
| | | import com.ltkj.db.DataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.DictHosp; |
| | | import com.ltkj.hosp.service.IDictHospService; |
| | | import jodd.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * swagger 接口 |
| | |
| | | @Controller |
| | | @RequestMapping("/tool/swagger") |
| | | public class SwaggerController extends BaseController { |
| | | @Autowired |
| | | private DataSourceConfig dataSourceConfig; |
| | | @Autowired |
| | | private IDictHospService dictHospService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('tool:swagger:view')") |
| | | @GetMapping() |
| | | public String index() { |
| | | public String index(HttpServletRequest request) { |
| | | dataSourceConfig.addDataSource(DataSourceType.MASTER.name()); |
| | | DataSourceContextHolder.setDataSourceKey(DataSourceType.MASTER.name()); |
| | | // String hospId = request.getHeader("hospId"); |
| | | // LambdaQueryWrapper<DictHosp> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(DictHosp::getCode,hospId); |
| | | // DictHosp hosp = dictHospService.getOne(wrapper); |
| | | // if (hosp != null && StringUtil.isNotBlank(hosp.getDbname())) { |
| | | // dataSourceConfig.addDataSource(hosp.getDbname()); |
| | | // DataSourceContextHolder.setDataSourceKey(hosp.getDbname()); |
| | | // } |
| | | return redirect("/doc.html"); |
| | | } |
| | | } |