package com.qbd.ssm.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import com.qbd.ssm.model.User;
public interface UserDao {
public List<User> getAll();
public User getUser(User user);
public int delete(User user);
public int update(User user);
public int add(User user);
public List<User> find(Map<String,Object> map);
public Long getTotal(Map<String,Object> map);
}
service这样写
package com.qbd.ssm.service;
import java.util.List;
import java.util.Map;
import com.qbd.ssm.model.User;
public interface UserService {
public List<User> getAll();
public User getUser(User user);
public int delete(User user);
public int update(User user);
public int add(User user);
public List<User> find(Map<String,Object> map);
public Long getTotal(Map<String,Object> map);
}
service的实现:
package com.qbd.ssm.serviceimpl;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qbd.ssm.dao.UserDao;
import com.qbd.ssm.model.User;
import com.qbd.ssm.service.UserService;
@Service("userService")
public class UserServiceImpl implements UserService {
private UserDao userDao;
public UserDao getUserDao() {
return userDao;
}
@Resource
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public List<User> getAll() {
// TODO Auto-generated method stub
return userDao.getAll();
}
public User getUser(User user) {
// TODO Auto-generated method stub
return userDao.getUser(user);
}
public int delete(User user) {
// TODO Auto-generated method stub
return userDao.delete(user);
}
public int update(User user) {
// TODO Auto-generated method stub
return userDao.update(user);
}
public int add(User user) {
// TODO Auto-generated method stub
return userDao.add(user);
}
public List<User> find(Map<String, Object> map) {
// TODO Auto-generated method stub
return userDao.find(map);
}
public Long getTotal(Map<String, Object> map) {
// TODO Auto-generated method stub
return userDao.getTotal(map);
}
}