|
@@ -1,31 +0,0 @@
|
|
|
-package com.ruoyi.zzb.demo.controller;
|
|
|
-
|
|
|
-import com.ruoyi.common.annotation.DataSource;
|
|
|
-import com.ruoyi.common.enums.DataSourceType;
|
|
|
-import com.ruoyi.zzb.demo.domain.User;
|
|
|
-import com.ruoyi.zzb.demo.mapper.UserMapper;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-@RestController
|
|
|
-@RequestMapping("/user")
|
|
|
-public class UserController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserMapper userMapper;
|
|
|
-
|
|
|
- @GetMapping( "/getUserById")
|
|
|
- @DataSource(value = DataSourceType.MASTER)
|
|
|
- public User getUserById(int id){
|
|
|
- return userMapper.selectById(id);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping( "/getUserById2")
|
|
|
- @DataSource(value = DataSourceType.SLAVE)
|
|
|
- public User getUserById2(int id){
|
|
|
- return userMapper.selectById(id);
|
|
|
- }
|
|
|
-
|
|
|
-}
|