⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classofvets.java~1~

📁 基于mvc的宠物管理系统。servlet+jsp
💻 JAVA~1~
字号:
package com.richard.dao;

import java.util.*;

import com.richard.dto.*;
import com.richard.dao.*;
import java.sql.*;
import java.util.*;
import java.io.*;

public class ClassOfVets implements InterfaceOfVets {

    DBOperate objDBOperate=new DBOperate();
    public ClassOfVets() {
    }

    /**
     * VetsQueryAll
     *
     * @return ArrayList
     * @todo Implement this com.richard.dao.InterfaceOfVets method
     */
    public ArrayList VetsQueryAll() {
        return null;
    }

    /**
     * VetsQueryOfVetsName
     *
     * @param objVets Vets
     * @return ArrayList
     * @todo Implement this com.richard.dao.InterfaceOfVets method
     */
    public ArrayList VetsQueryOfVetsName(Vets objVets) {
        return null;
    }

    /**
     * vetsAdd
     *
     * @param objVets Vets
     * @todo Implement this com.richard.dao.InterfaceOfVets method
     */
    public void vetsAdd(Vets objVets) {
        int id=objVets.getId();
        String name=objVets.getName();
        String sqlCommand="insert into vets(id,name) values(?,?)";
        try {
            PreparedStatement ps=objDBOperate.getPreparedStatement("petclinic",sqlCommand);
            ps.setInt(1,id);
            ps.setString(2,name);
            ps.execute();
        } catch (Exception ex) {
           System.out.println(ex.getMessage());
        }

    }

    /**
     * vetsDelete
     *
     * @param objVets Vets
     * @todo Implement this com.richard.dao.InterfaceOfVets method
     */
    public void vetsDelete(Vets objVets) {
    }

    /**
     * vetsUpdate
     *
     * @param objVets Vets
     * @todo Implement this com.richard.dao.InterfaceOfVets method
     */
    public void vetsUpdate(Vets objVets) {
    }

    public int NameForId(Vets objVets)
    {
        String name=objVets.getName();
        int id=0;
        String sqlCommand="select id from vets where name='"+name+"'";
        try {
            ResultSet rs=objDBOperate.getResultSet("petclinic",sqlCommand);
            while(rs.next())
            {
                id=rs.getInt(1);
            }

        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        return id;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -