Spring+IBatis整合各层设计(I)
????? 针对Spring和IBatis的整合文章很多,鄙人自己搭建的框架,提供三层结构如下,以供学习之用,如用好的建议和意见以便沟通,希望大家一起学习,谢谢.
?
?
?
?
?
?
package easyway.tbs.app.service.imp;import java.util.List;import java.util.Map;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import easyway.tbs.app.constants.IBatisSQLConstants;import easyway.tbs.app.dao.iface.ChannelDAO;import easyway.tbs.app.model.ChannelVo;import easyway.tbs.app.service.generics.BaseServiceImpl;import easyway.tbs.app.service.iface.ChannelService;import easyway.tbs.file.transport.core.dto.FileChannel;/** *通道服务的实现类 * 备注:注意此处使用@Service和@Autowired 自动注入的功能实现 * * @author longgangbai * */@Servicepublic class ChannelServiceImpl extends BaseServiceImpl<ChannelVo, Integer, ChannelDAO> implements ChannelService {private static Log log = LogFactory.getLog(ChannelServiceImpl.class);/** * 注解通道的数据访问对象 */@Autowired@Overridepublic void setEntityDao(ChannelDAO entityDao) {super.setEntityDao(entityDao);}/** * 根据节点ID查询相关的通道的列表 * @param nodeId 节点的ID * @return */@SuppressWarnings("unchecked")public List<ChannelVo> getChannelListByNodeId(Map<String,Integer> paramsMap){return entityDao.queryForList(IBatisSQLConstants.Channel_QueryChannelDetailListByNodeId, paramsMap);} public List<FileChannel> getChannelListByNodeIp(String nodeIp) {return entityDao.queryForList(IBatisSQLConstants.Channel_QueryChannelListByNodeIp, nodeIp);}/** * 根据节点id查询相关的接收端通道信息 * @param nodeId * @return */@SuppressWarnings("unchecked")public List<ChannelVo> queryChannelListByRecNodeId(Integer nodeId){return entityDao.queryForList(IBatisSQLConstants.Channel_QueryChannelListByRecNodeId, nodeId);}}?