wlzboy
2025-12-02 d294abb765e4ed349907c92ce313689c6299ba7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.ruoyi.web.controller.sqlserver;
 
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 com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.UserSyncDTO;
import com.ruoyi.system.mapper.UserSyncMapper;
 
import java.util.List;
 
/**
 * SQL Server 用户数据查询 Controller
 * 
 * 专门用于从 SQL Server 数据库查询用户数据
 * 不涉及任何 MySQL 数据库操作
 * 
 * @author ruoyi
 * @date 2025-10-18
 */
@RestController
@RequestMapping("/sqlserver/user")
public class SqlServerUserController extends BaseController
{
    @Autowired
    private UserSyncMapper userSyncMapper;
 
    /**
     * 查询 SQL Server 中的 OA 用户列表
     * 
     * 数据源:SQL Server (OA_User 表)
     * 
     * @return OA 用户列表
     */
    @PreAuthorize("@ss.hasPermi('sqlserver:user:list')")
    @GetMapping("/list")
    public AjaxResult getOaUsers()
    {
        try
        {
            // 从 SQL Server 查询数据
            // Mapper 上的 @DataSource(DataSourceType.SQLSERVER) 注解确保使用 SQL Server 数据源
            List<UserSyncDTO> list = userSyncMapper.selectOaUsers();
            
            return AjaxResult.success("查询成功", list);
        }
        catch (Exception e)
        {
            logger.error("查询 SQL Server 用户数据失败", e);
            return AjaxResult.error("查询 SQL Server 用户数据失败:" + e.getMessage());
        }
    }
}