Skip to content

Commit

Permalink
delete note
Browse files Browse the repository at this point in the history
  • Loading branch information
527515025 committed Apr 3, 2019
1 parent 14c45d2 commit 0fc34ec
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import java.util.List;
import java.util.Map;

import cn.abel.config.DynamicDataSource;
import cn.abel.config.DynamicDataSourceContextHolder;
import cn.abel.enums.DatabaseTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -18,29 +15,24 @@ public class NewsService {
private NewsDao newsDao;

public List<News> getByMap(Map<String, Object> map) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.getByMap(map);
}

public News getById(Integer id) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.getById(id);
}

public News create(News news) {
DynamicDataSourceContextHolder.resetDatabaseType();
newsDao.create(news);
return news;
}

public News update(News news) {
DynamicDataSourceContextHolder.resetDatabaseType();
newsDao.update(news);
return news;
}

public int delete(Integer id) {
DynamicDataSourceContextHolder.resetDatabaseType();
return newsDao.delete(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.List;
import java.util.Map;

import cn.abel.config.DynamicDataSourceContextHolder;
import cn.abel.enums.DatabaseTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -17,29 +15,24 @@ public class UserService {
private UserDao userDao;

public List<User> getByMap(Map<String,Object> map){
DynamicDataSourceContextHolder.setDatabaseType(DatabaseTypeEnum.USER);
return userDao.getByMap(map);
}

public User getById(Integer id){
DynamicDataSourceContextHolder.setDatabaseType(DatabaseTypeEnum.USER);
return userDao.getById(id);
}

public User create(User user){
DynamicDataSourceContextHolder.setDatabaseType(DatabaseTypeEnum.USER);
userDao.create(user);
return user;
}

public User update(User user){
DynamicDataSourceContextHolder.setDatabaseType(DatabaseTypeEnum.USER);
userDao.update(user);
return user;
}

public int delete(Integer id){
DynamicDataSourceContextHolder.setDatabaseType(DatabaseTypeEnum.USER);
return userDao.delete(id);
}

Expand Down

0 comments on commit 0fc34ec

Please sign in to comment.