package com.ruoyi.web.controller.sqlserver; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.system.domain.OrderClassDTO; import com.ruoyi.system.service.IOrderClassDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * SQL Server 字典数据查询 Controller * * 专门用于从 SQL Server 数据库查询字典数据 * * @author ruoyi * @date 2025-10-19 */ @RestController @RequestMapping("/sqlserver/dictionary") @DataSource(DataSourceType.SQLSERVER) public class SqlServerDictionaryController extends BaseController { @Autowired private IOrderClassDataService orderClassDataService; /** * 查询单据类型列表(ServiceOrdAreaType) * * 数据源:SQL Server (dictionary表) * SQL: SELECT vID, vtext FROM dictionary WHERE vtitle='ServiceOrdAreaType' AND vType=1 ORDER BY vOrder * * @return 单据类型列表 */ @GetMapping("/serviceOrdAreaTypes") public AjaxResult getServiceOrdAreaTypes() { try { List list = orderClassDataService.getServiceOrdAreaTypes(); return AjaxResult.success("查询成功", list); } catch (Exception e) { logger.error("查询单据类型数据失败", e); return AjaxResult.error("查询单据类型数据失败:" + e.getMessage()); } } /** * 查询服务单编码列表 * * 数据源:SQL Server (dictionary表) * * @return 服务单编码列表 */ @GetMapping("/serviceOrderClass") public AjaxResult getServiceOrderClass() { try { List list = orderClassDataService.getServiceOrderClass(); return AjaxResult.success("查询成功", list); } catch (Exception e) { logger.error("查询服务单编码数据失败", e); return AjaxResult.error("查询服务单编码数据失败:" + e.getMessage()); } } /** * 查询调度单编码列表 * * 数据源:SQL Server (dictionary表) * * @return 调度单编码列表 */ @GetMapping("/dispatchOrderClass") public AjaxResult getDispatchOrderClass() { try { List list = orderClassDataService.getDispatchOrderClass(); return AjaxResult.success("查询成功", list); } catch (Exception e) { logger.error("查询调度单编码数据失败", e); return AjaxResult.error("查询调度单编码数据失败:" + e.getMessage()); } } /** * 查询服务订单类型列表(ServiceOrderType) * * 数据源:SQL Server (dictionary表) * SQL: SELECT vID, vtext FROM dictionary WHERE vtitle='ServiceOrderType' AND vType>=1 ORDER BY vOrder * * @return 服务订单类型列表 */ @GetMapping("/serviceOrderTypes") public AjaxResult getServiceOrderTypes() { try { List list = orderClassDataService.getServiceOrderTypes(); return AjaxResult.success("查询成功", list); } catch (Exception e) { logger.error("查询服务订单类型数据失败", e); return AjaxResult.error("查询服务订单类型数据失败:" + e.getMessage()); } } /** * 查询医院科室列表(HospitalDepartment) * * 数据源:SQL Server (dictionary表) * SQL: SELECT vID, vtext FROM dictionary WHERE vtitle='HospitalDepartment' AND vType=1 ORDER BY vOrder * * @return 医院科室列表 */ @GetMapping("/hospitalDepartments") public AjaxResult getHospitalDepartments() { try { List list = orderClassDataService.getHospitalDepartments(); return AjaxResult.success("查询成功", list); } catch (Exception e) { logger.error("查询医院科室数据失败", e); return AjaxResult.error("查询医院科室数据失败:" + e.getMessage()); } } }