|
@@ -1,9 +1,9 @@
|
|
|
-package com.ruoyi.zzb.controller;
|
|
|
+package com.ruoyi.zzb.demo.controller;
|
|
|
|
|
|
import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
-import com.ruoyi.zzb.domain.User;
|
|
|
-import com.ruoyi.zzb.mapper.UserMapper;
|
|
|
+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;
|
|
@@ -17,13 +17,13 @@ public class UserController {
|
|
|
private UserMapper userMapper;
|
|
|
|
|
|
@GetMapping( "/getUserById")
|
|
|
- @DataSource(value = DataSourceType.MASTER)
|
|
|
+ @DataSource(value = DataSourceType.MASTER) //指定
|
|
|
public User getUserById(int id){
|
|
|
return userMapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
@GetMapping( "/getUserById2")
|
|
|
- @DataSource(value = DataSourceType.SLAVE)
|
|
|
+ @DataSource(value = DataSourceType.SLAVE) //指定
|
|
|
public User getUserById2(int id){
|
|
|
return userMapper.selectById(id);
|
|
|
}
|