逻辑层:好吧我现在也理解的不深,感觉就是用来调用数据层。因为是User模块,主要是调用本模块内部信息管理,所以并不复杂。代码献上。
首先是 接口
package cn.hncu.bookStore.user.business.ebi; import java.util.List; import cn.hncu.bookStore.user.vo.UserVO; import cn.hncu.bookStore.user.vo.UserQueryVO; public interface UserEbi { public boolean create(UserVO user); public boolean delete(String uuid); public boolean update(UserVO user); public UserVO getSingle(String uuid); public List<UserVO> getAll(); public List<UserVO> getByCondition(UserQueryVO uqm ); //TODO:user接口中的其它方法回头想到再来加 }实现层ebo 很简单 基本上就是调用数据层方法
package cn.hncu.bookStore.user.business.ebo; import java.util.List; import cn.hncu.bookStore.user.business.ebi.UserEbi; import cn.hncu.bookStore.user.dao.dao.Userdao; import cn.hncu.bookStore.user.dao.factory.UserDaoFactory; import cn.hncu.bookStore.user.vo.UserQueryVO; import cn.hncu.bookStore.user.vo.UserVO; public class UserEbo implements UserEbi{ //注入DAo Userdao dao = UserDaoFactory.getUserdao(); @Override public boolean create(UserVO user) { return dao.create(user); } @Override public boolean delete(String uuid) { // TODO Auto-generated method stub return dao.detele(uuid); } @Override public boolean update(UserVO user) { // TODO Auto-generated method stub return dao.update(user); } @Override public UserVO getSingle(String uuid) { // TODO Auto-generated method stub return dao.getSingle(uuid); } @Override public List<UserVO> getAll() { // TODO Auto-generated method stub return dao.getAll(); } @Override public List<UserVO> getByCondition(UserQueryVO uqm) { // TODO Auto-generated method stub return dao.getByCondtion(uqm); } }最后就是工厂方法
package cn.hncu.bookStore.user.business.factory; import cn.hncu.bookStore.user.business.ebi.UserEbi; import cn.hncu.bookStore.user.business.ebo.UserEbo; public class UserEbiFactory { private UserEbiFactory(){ } public static UserEbi getUserEbi(){ return new UserEbo(); } }