• jdbc action 接口示例


    package com.gylhaut.action;

    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;

    import com.gylhaut.dao.GoddessDao;
    import com.gylhaut.model.Goddess;

    public class GoddessAction {
    public void add(Goddess goddess) throws Exception{
    GoddessDao dao= new GoddessDao();
    dao.addGoddess(goddess);
    }
    public Goddess get(Integer id) throws Exception{
    GoddessDao dao= new GoddessDao();
    return dao.get(id);
    }
    public void edit(Goddess goddess) throws Exception{
    GoddessDao dao= new GoddessDao();
    dao.updateGoddess(goddess);
    }
    public void del(Integer id) throws Exception{
    GoddessDao dao= new GoddessDao();
    dao.delGoddess(id);
    }
    public List<Goddess> query() throws Exception{
    GoddessDao dao= new GoddessDao();
    return dao.query();
    }
    public List<Goddess> query(List<Map<String,Object>> params) throws Exception{
    GoddessDao dao= new GoddessDao();
    return dao.query(params);
    }
    /* public static void main(String[] args) throws Exception{
    GoddessDao g= new GoddessDao();
    //List<Goddess> gs = g.query("小妹");
    List<Map<String,Object>> params = new ArrayList<Map<String,Object>>();
    Map<String,Object> param = new HashMap<String,Object>();
    param.put("name", "user_name");
    param.put("rela","=");
    param.put("value","'小妹'");
    params.add(param);
    List<Goddess> gs =g.query(params);
    for(Goddess goddess : gs){
    System.out.println(goddess.toString());
    }*/
    // Goddess g1= new Goddess();
    // g1.setUser_name("小夏");
    // g1.setAge(21);
    // g1.setSex(1);
    // g1.setBirthday(new Date());
    // g1.setEmail("xiaoxia@163.com");
    // g1.setMoblie("18500029090");
    // g1.setUpdate_user("gylhaut");
    // g1.setIsdel(1);
    // //g1.setId(3);
    // //g.delGoddess(3);
    // //g.updateGoddess(g1);
    // g.addGoddess(g1);
    // Goddess gs1 = g.get(4);
    // System.out.println(gs1.toString());

    // }
    }

  • 相关阅读:
    python 学习分享-进程
    python 学习分享-实战篇类 Fabric 主机管理程序开发
    python 学习分享-线程
    python 学习分享-paramiko模块
    linux ubuntu开启sshd
    python 学习分享-实战篇高级的ftp
    python 学习分享-socketserver
    python 学习分享-socket编程
    Java学习笔记--Java开发坏境搭建
    C# 泛型
  • 原文地址:https://www.cnblogs.com/gylhaut/p/7637855.html
Copyright © 2020-2023  润新知