BasicDao 的抽取

BasicDao 的抽取

Dao 全称为(Data Access Object)数据访问接口,数据访问:顾名思义就是与数据库打交道。又称JavaBean 又称为domain 话不多说,直接上图

在这里插入图片描述

在写JavaBean的时候总是会遇到有相同的操作的地方,因此提出Basic

根据上图写出项目结构

在这里插入图片描述

给出两个表
在这里插入图片描述

根据上图首先对actor表和goods表进行映射

package com.cclStu.domain;

import java.util.Date;

/**
 * @author: 13749
 * @date: 2021/9/23 17:18
 * @description:
 */
public class Actor {
   
    private Integer id ;
    private String name;
    private String sex;
    private Date borndate;
    private String phone;

    public Actor() {
       //底层可能用到反射,反射需要无参构造器
    }

    public Actor(Integer id, String name, String sex, Date borndate, String phone) {
   
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.borndate = borndate;
        this.phone = phone;
    }

    public Integer getId() {
   
        return id;
    }

    public void setId(Integer id) {
   
        this.id = id;
    }

    public String getName() {
   
        return name;
    }

    public void setName(String name) {
   
        this.name = name;
    }

    public String getSex() {
   
        return sex;
    }

    public void setSex(String sex) {
   
        this.sex = sex;
    }

    public Date getBorndate() {
   
        return borndate;
    }

    public void setBorndate(Date borndate) {
   
        this.borndate = borndate;
    }

    public String getPhone() {
   
        return phone;
    }

    public void setPhone(String phone) {
   
        this.phone = phone;
    }

    @Override
    public String toString() {
   
        return "Actor{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", borndate=" + borndate +
                ", phone='" + phone + '\'' +
                '}';
    }
}
package com.cclStu.domain;

/**
 * @author: 13749
 * @date: 2021/9/27 18:58
 * @description:
 */
public class Goods {
   
    private Integer id;
    private String goods_name;
    private String price;

    //反射可能会用到
    public Goods() {
   

    }

    public Goods(Integer id, String goods_name, String price) {
   
        this.id = id;
        this.goods_name 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曹老板么

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值