File tree Expand file tree Collapse file tree 2 files changed +0
-15
lines changed
springboot-elasticsearch/src/main/java/cn/abel/service Expand file tree Collapse file tree 2 files changed +0
-15
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .List ;
4
4
import java .util .Map ;
5
5
6
- import cn .abel .config .DynamicDataSource ;
7
- import cn .abel .config .DynamicDataSourceContextHolder ;
8
- import cn .abel .enums .DatabaseTypeEnum ;
9
6
import org .springframework .beans .factory .annotation .Autowired ;
10
7
import org .springframework .stereotype .Service ;
11
8
@@ -18,29 +15,24 @@ public class NewsService {
18
15
private NewsDao newsDao ;
19
16
20
17
public List <News > getByMap (Map <String , Object > map ) {
21
- DynamicDataSourceContextHolder .resetDatabaseType ();
22
18
return newsDao .getByMap (map );
23
19
}
24
20
25
21
public News getById (Integer id ) {
26
- DynamicDataSourceContextHolder .resetDatabaseType ();
27
22
return newsDao .getById (id );
28
23
}
29
24
30
25
public News create (News news ) {
31
- DynamicDataSourceContextHolder .resetDatabaseType ();
32
26
newsDao .create (news );
33
27
return news ;
34
28
}
35
29
36
30
public News update (News news ) {
37
- DynamicDataSourceContextHolder .resetDatabaseType ();
38
31
newsDao .update (news );
39
32
return news ;
40
33
}
41
34
42
35
public int delete (Integer id ) {
43
- DynamicDataSourceContextHolder .resetDatabaseType ();
44
36
return newsDao .delete (id );
45
37
}
46
38
Original file line number Diff line number Diff line change 3
3
import java .util .List ;
4
4
import java .util .Map ;
5
5
6
- import cn .abel .config .DynamicDataSourceContextHolder ;
7
- import cn .abel .enums .DatabaseTypeEnum ;
8
6
import org .springframework .beans .factory .annotation .Autowired ;
9
7
import org .springframework .stereotype .Service ;
10
8
@@ -17,29 +15,24 @@ public class UserService {
17
15
private UserDao userDao ;
18
16
19
17
public List <User > getByMap (Map <String ,Object > map ){
20
- DynamicDataSourceContextHolder .setDatabaseType (DatabaseTypeEnum .USER );
21
18
return userDao .getByMap (map );
22
19
}
23
20
24
21
public User getById (Integer id ){
25
- DynamicDataSourceContextHolder .setDatabaseType (DatabaseTypeEnum .USER );
26
22
return userDao .getById (id );
27
23
}
28
24
29
25
public User create (User user ){
30
- DynamicDataSourceContextHolder .setDatabaseType (DatabaseTypeEnum .USER );
31
26
userDao .create (user );
32
27
return user ;
33
28
}
34
29
35
30
public User update (User user ){
36
- DynamicDataSourceContextHolder .setDatabaseType (DatabaseTypeEnum .USER );
37
31
userDao .update (user );
38
32
return user ;
39
33
}
40
34
41
35
public int delete (Integer id ){
42
- DynamicDataSourceContextHolder .setDatabaseType (DatabaseTypeEnum .USER );
43
36
return userDao .delete (id );
44
37
}
45
38
You can’t perform that action at this time.
0 commit comments