lige
2023-12-11 926dc4daf0ea8be960647ecaeec389e866037ef9
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.ltkj.web.controller.sqlserver;
 
import com.ltkj.common.core.controller.BaseController;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.enums.DataSourceType;
import com.ltkj.framework.datasource.DynamicDataSourceContextHolder;
import com.ltkj.hosp.service.LtkjMiddleDetailService;
import com.ltkj.hosp.service.LtkjMiddleHeadService;
import com.ltkj.hosp.service.TjvLtkjvtjpatService;
import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail;
import com.ltkj.hosp.sqlDomain.LtkjMiddleHead;
import com.ltkj.hosp.sqlDomain.LtkjTjPat;
import com.ltkj.hosp.mapper.TestMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
 
@RestController
@RequestMapping("/sqlserver/getdata")
@Api(tags = "获取从库数据")
public class TjSqlController extends BaseController {
    @Resource
    private TestMapper testMapper;
 
    @Resource
    private TjvLtkjvtjpatService tjvLtkjvtjpatService;
 
    @Resource
    private LtkjMiddleDetailService middleDetailService;
 
    @Resource
    private LtkjMiddleHeadService headService;
 
 
    @GetMapping("/getMiddleDetail")
    @ApiOperation(value = "查看列表")
    public AjaxResult getMiddleDetail() {
        List<LtkjMiddleDetail> list = testMapper.getMiddleDetail();
        return AjaxResult.success(list);
    }
 
 
    @GetMapping("/getMiddleHead")
    @ApiOperation(value = "查看列表")
    public AjaxResult getMiddleHead() {
        List<LtkjMiddleHead> list = testMapper.getMiddleHead();
        return AjaxResult.success(list);
    }
 
//    @GetMapping("/getVbjitem")
//    @ApiOperation(value = "查看列表")
//    public AjaxResult getVbjitem() {
//        List<LtkjVbjitem> list = testMapper.getVbjitem();
//        return AjaxResult.success(list);
//    }
 
 
    @GetMapping("/getTjPat")
    @ApiOperation(value = "查看列表")
    public AjaxResult getTjPat() {
        List<LtkjTjPat> list = testMapper.getTjPat();
        return AjaxResult.success(list);
    }
 
 
    @GetMapping("/getLtkjTjPatById")
    @ApiOperation(value = "根据id查,存进mysql")
    public AjaxResult getLtkjTjPatById(String id) {
        LtkjTjPat one = testMapper.getTjPatById(id);
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
        final boolean save = tjvLtkjvtjpatService.save(one);
        DynamicDataSourceContextHolder.clearDataSourceType();
        return AjaxResult.success(save);
    }
 
 
    @GetMapping("/getMiddleDetailById")
    @ApiOperation(value = "根据id查,存进mysql")
    public AjaxResult getMiddleDetailById(String id) {
        LtkjMiddleDetail one = testMapper.getMiddleDetailById(id);
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
        final boolean save = middleDetailService.save(one);
        DynamicDataSourceContextHolder.clearDataSourceType();
        return AjaxResult.success(save);
    }
 
 
    @GetMapping("/getMiddleHeadById")
    @ApiOperation(value = "根据id查,存进mysql")
    public AjaxResult getMiddleHeadById(String id) {
        LtkjMiddleHead one = testMapper.getMiddleHeadById(id);
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
        final boolean save = headService.save(one);
        DynamicDataSourceContextHolder.clearDataSourceType();
        return AjaxResult.success(save);
    }
 
}