书店管理系统---User模块.逻辑层(JavaSE综合运用(二))

本文介绍了一个简单用户模块的逻辑层设计,包括接口定义及其实现。通过UserEbi接口和UserEbo类展示了如何调用数据层进行基本的CRUD操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

逻辑层:好吧我现在也理解的不深,感觉就是用来调用数据层。因为是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();
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值