最近实习,初接触项目,对好多的东西不是很清楚,看了下面的这篇博客对一个Web服务的实现中使用DTO及MO有了比较清楚的了解!!!
http://www.cnblogs.com/loveis715/p/4379656.html
在三层模型中,service层一般操纵的数据类型是DTO类型的
而dao层则操纵的是底层的PO类型的javabean对象。
如下所示:
public interface GroupShopDao extends GenericDao {
@DAOAction(action = DAOActionType.INSERT)
public int addGroupShoup(@DAOParam(value = "groupShop", type = DAOParamType.ENTITY) GroupShop obj);
@DAOAction(action = DAOActionType.QUERY)
public List<GroupShop> loadGroupShoupByActivityId(@DAOParam(value = "activityId", type = DAOParamType.NORMAL) Integer ActivityId);
@DAOAction(action = DAOActionType.UPDATE)
public int updateGroupShoupById(@DAOParam(value = "obj", type = DAOParamType.ENTITY) GroupShop obj);
@DAOAction(action = DAOActionType.INSERT)
public int batchInsertGroupShoup(@DAOParam(value = "list", type = DAOParamType.NORMAL) List<GroupShop> list);
@DAOAction(action = DAOActionType.DELETE)
public int deleteGroupShopById(@DAOParam(value = "id",type = DAOParamType.NORMAL)Integer id);
}
——————————————————————————————————————————————————————————————
public interface GroupShopService {
/**
* 保存 组队商家信息
* @param obj
* @return 成功 or 失败
*/
public int addGroupShoup(GroupShopDTO obj);
/***
* 根据活动id 获取组队商家信息
* @param ActivityId 活动id
* @return 成功 or 失败
*/
public List<GroupShopDTO> loadGroupShoupByActivityId(Integer ActivityId );
/**
* 根据id修改组队商家信息
* @param obj primary key
* @return success or failure
*/
public int updateGroupShoupById(GroupShopDTO obj);
/**
* 批量添加商家信息
* @param list
* @param userId 用户的id
* @return success or primary key
*/
public int batchInsertGroupShoup(List<GroupShopDTO> list ,int userId);
public int deleteGroupShopById(Integer id);
}