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

📄 classoftypes.java~3~

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

import java.util.*;
import java.sql.ResultSet;
import com.richard.dto.*;


public class ClassOfTypes implements InterfaceOfTypes {
    DBOperate objDBOperate = new DBOperate();
    public ClassOfTypes() {
    }

    /**
     * typesDelete
     *
     * @param objTypes Types
     * @todo Implement this com.richard.dao.InterfaceOfTypes method
     */
    public void typesDelete(Types objTypes) {
    }

    /**
     * typesInsert
     *
     * @param objTypes Types
     * @todo Implement this com.richard.dao.InterfaceOfTypes method
     */
    public void typesInsert(Types objTypes) {
    }

    /**
     * typesQuery
     *
     * @param objTypes Types
     * @return Types
     * @todo Implement this com.richard.dao.InterfaceOfTypes method
     */
    public Types typesQuery(Types objTypes) {
        return null;
    }

    /**
     * typesQueryAll
     *
     * @return ArrayList
     * @todo Implement this com.richard.dao.InterfaceOfTypes method
     */
    public ArrayList typesQueryAll() {
        String sqlCommand = "select * from types";
        ArrayList objArrayList = new ArrayList();
        ResultSet rs = objDBOperate.getResultSet("petclinic", sqlCommand);
        try {
            while (rs.next()) {
                Types objTypes = new Types();
                objTypes.setId(rs.getInt(1));
                objTypes.setName(rs.getString(2));
                objArrayList.add(objTypes);
            }
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        return objArrayList;
    }

    /**
     * typesUpdate
     *
     * @param objTypes Types
     * @todo Implement this com.richard.dao.InterfaceOfTypes method
     */
    public void typesUpdate(Types objTypes) {
    }

    public int nameForId(String name);

    {
        String sqlCommand = "select id from pets where name='" + name + "'";
        int id = 0;
        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 + -