国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
admin module
appcontext.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
   "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
     <!--通過JNDI獲得數(shù)據(jù)源的引用-->
     <bean id="MyDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
         <property name="jndiName">
              <value>java:comp/env/jdbc/pos</value>
         </property>
     </bean>
     
     <!--配置Hibernate-->
     <bean
       id="sessionFactory"
       class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
     >
         <!--指定數(shù)據(jù)源-->
         <property name="dataSource">
             <ref local="MyDataSource" />
         </property>
         
         <!--給出映射文件資源-->
         <property name="mappingResources">
             <list>
                 <value>AdminInfo.hbm.xml</value>
                 <value>GoodsInfo.hbm.xml</value>
                 <value>GoodsClassInfo.hbm.xml</value>
                 <value>ConsumerInfo.hbm.xml</value>
                 <value>ProviderInfo.hbm.xml</value>
                 <value>StockInfo.hbm.xml</value>
                 <value>StockDetail.hbm.xml</value>
                 <value>SellInfo.hbm.xml</value>
                 <value>SellDetail.hbm.xml</value>
                 <value>ConsumerBack.hbm.xml</value>
                 <value>ConsumerBackDetail.hbm.xml</value>
                 <value>ProviderBack.hbm.xml</value>
                 <value>ProviderBackDetail.hbm.xml</value>
             </list>
         </property>
         
         <!--定義hibernate配置屬性-->
         <property name="hibernateProperties">
             <props>
                 <prop key="hibernate.dialect">
                     org.hibernate.dialect.MySQLDialect
                 </prop>
                 <prop key="hibernate.show_sql">
                     true
                 </prop>             
             </props>
         </property>     
     </bean>
     <bean id="DButil" class="wyf.zrk.DButil">
         <property name="sf">
              <ref local="sessionFactory" />
         </property>
     </bean>
     <bean id="DBupdate" class="wyf.zrk.DBupdate">
         <property name="sf">
              <ref local="sessionFactory" />
         </property>
         <property name="db">
                     <ref local="DButil" />
         </property>
     </bean>  
     <bean id="DBinsert" class="wyf.zrk.DBinsert">
         <property name="sf">
              <ref local="sessionFactory" />
         </property>
         <property name="db">
                     <ref local="DButil" />
         </property>
     </bean>   
     <bean id="DBdelete" class="wyf.zrk.DBdelete">
         <property name="sf">
              <ref local="sessionFactory" />
         </property>
         <property name="db">
                     <ref local="DButil" />
         </property>
     </bean>  
</beans>

adminlogin
<%@ page contentType="text/html; charset=gbk" %>
<html>
  <head>
    <title>登陸頁面</title>
    <link rel=stylesheet href="css/style.css" type="text/css">
    <script language="JavaScript" src="script/trim.js"></script>
    <script language="JavaScript">
        function check(){
            var uname = document.all.uname.value;
            var upwd = document.all.upwd.value;
            if(uname.trim()==""){
                alert("用戶名為空,請重新輸入!!!");
                return;
            }
            if(upwd.trim()==""){
                alert("密碼為空,請重新輸入!!!");
                return;
            }
            document.all.mf.submit();
        }
    </script>
  </head>
  <body>
      <div class="out">
    <div class="login_style">
      <center>
      <form action="ManageServlet" method="post" id="mf" target="bottom">
        <table>
          <tr>
            <td>用戶名:</td>
            <td><input type="text" id="uname" name="uname" value="zrk"/></td>
          </tr>
          <tr>
            <td>密 碼:</td>
            <td><input type="password" id="upwd" name="upwd" value="12345"/></td>
          </tr>
          <tr>
            <td colspan="2" align="center">
            <img border="0" src="img/ddl.gif" id="lg" onclick="JavaScript:check()"
                style="cursor:hand"
                onmouseover="document.all.lg.src='img/ddla.gif'"
                onmouseout="document.all.lg.src='img/ddl.gif'"
                onmouseup="document.all.lg.src='img/ddla.gif'"           
                onmousedown="document.all.lg.src='img/ddlb.gif'"/>
            <img border="0" src="img/cz.gif" id="cz" onclick="JavaScript:document.all.mf.reset()"
                style="cursor:hand"
                onmouseover="document.all.cz.src='img/cza.gif'"
                onmouseout="document.all.cz.src='img/cz.gif'"
                onmouseup="document.all.cz.src='img/cza.gif'"           
                onmousedown="document.all.cz.src='img/czb.gif'"/></td>
          </tr>
        </table>
        <input type="hidden" name="action" value="login"/>
      </form>
      </center>
    </div>
    </div>
  </body>
</html>

login.jsp
<%@ page contentType="text/html;charset=gbk"  %>
<html>
    <head>
        <title>主頁</title>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
    </head>
    <frameset rows="100,*">
      <frame frameborder="0" name="top" scrolling="NO" noresize src="top.jsp"/>
      <frame frameborder="0" name="bottom" scrolling="NO" noresize src="adminlogin.jsp"/>
    </frameset>
    <body>
    </body>
</html>

ManageServlet.java
package wyf.zrk;

import javax.servlet.http.*;
import java.io.*;
import javax.servlet.*;
import java.util.*;
import org.springframework.web.context.support.*;
import org.springframework.web.context.*;
import org.springframework.beans.factory.*;
import java.text.DateFormat;


public class ManageServlet extends HttpServlet{
    private static final long serialVersionUID = 1L;
    public void doGet(HttpServletRequest request,HttpServletResponse response)
                throws ServletException,IOException{
        this.doPost(request,response);                            //調(diào)用doPost方法
    }
    public void doPost(HttpServletRequest request,HttpServletResponse response)
                throws ServletException,IOException{
        request.setCharacterEncoding("gbk");                    //設(shè)置請求編碼格式
        response.setCharacterEncoding("gbk");                    //設(shè)置響應(yīng)編碼
        response.setContentType("text/html;charset=gbk");        //設(shè)置請求頁面格式
        PrintWriter out = response.getWriter();                    //得到輸出流對象
        HttpSession session = request.getSession();
        UserBean userBean = (UserBean)session.getAttribute("userBean");
        if(userBean==null){
            userBean = new UserBean();
        }
        //獲取WebApplicationContext
        WebApplicationContext wac=
           WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
        DButil db = (DButil)wac.getBean("DButil");
        DBinsert dbin = (DBinsert)wac.getBean("DBinsert");
        DBupdate dbup = (DBupdate)wac.getBean("DBupdate");
        DBdelete dbde = (DBdelete)wac.getBean("DBdelete");
        String action = request.getParameter("action").trim();    //得到請求動作
        if(action.equals("login")){                                //動作為登陸時
            String aname = request.getParameter("uname").trim();//得到用戶名
            String apwd = request.getParameter("upwd").trim();    //得到密碼
            aname = new String(aname.getBytes(),"ISO-8859-1");    //將用戶名轉(zhuǎn)碼
            apwd = new String(apwd.getBytes(),"ISO-8859-1");    //將密碼轉(zhuǎn)碼
            System.out.println(aname+"\t"+apwd);
            String hql = "from AdminInfo as p "+                //hql語句
                "where p.aname='"+aname+"' and p.apwd='"+apwd+"'";
            List<AdminInfo> list = (List<AdminInfo>)db.getInfo(hql);
            String url = "";                                    //記錄提示信息
            if(!list.isEmpty()){
                AdminInfo ai = list.get(0);
                url = "/index.jsp";
                session.setAttribute("admin",aname);            //將管理員名存入session
                session.setAttribute("alevel",ai.getAlevel());    //將管理員級別存入session
            }
            else{
                String msg = "對不起,登陸失敗!!!";
                request.setAttribute("msg",msg);                //將錯誤信息添加到請求中
                url = "/info.jsp";
            }
            ServletContext sc = getServletContext();            //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher(url);
            rd.forward(request,response);                         //頁面跳轉(zhuǎn)
        }
        else if(action.equals("logout")){                        //當(dāng)管理員注銷時
            request.getSession(true).invalidate();                //使session失效
            response.sendRedirect("adminlogin.jsp");            //頁面跳轉(zhuǎn)
        }
        else if(action.equals("search")){                        //請求動作為搜索時
            String key = request.getParameter("key").trim();    //得到搜索關(guān)鍵字
            String type = request.getParameter("type").trim();    //得到搜索類型
            userBean.setNowPage(1);
            key = new String(key.getBytes(),"ISO-8859-1");
            String hql = "";                                    //記錄搜索內(nèi)容
            String tp = "";                                        //記錄搜索內(nèi)容總頁數(shù)
            String url = "";                                    //用來存放跳轉(zhuǎn)地址
            if(type.equals("goodsinfo")){                        //當(dāng)搜索商品表時
                String myradio = request.getParameter("myradio");
                if(myradio!=null&&myradio.trim().equals("class")){
                    hql = "from GoodsInfo as gi where gi.gcid in "+
                            "(select gc.gcid from GoodsClassInfo as "+
                            "gc where gc.gcname like '%"+key+"%')";
                    tp = "select count(*) from GoodsInfo as gi where gi.gcid in "+
                            "(select gc.gcid from GoodsClassInfo as "+
                            "gc where gc.gcname like '%"+key+"%')";
                }
                else{
                    hql = "from GoodsInfo where gname like '%"+key+"%'";
                    tp = "select count(*) from GoodsInfo where gname like '%"+key+"%'";
                }
                url = "/goodsmanage.jsp";                                //跳轉(zhuǎn)頁面
            }
            else if(type.equals("goodsclassinfo")){                        //當(dāng)搜索類別時
                hql = "from GoodsClassInfo where gcname like '%"+key+"%'";//搜索類別的hql
                tp = "select count(*) from GoodsClassInfo where gcname like '%"+key+"%'";//搜索總頁數(shù)的hql
                url = "/goodsclassmanage.jsp";                            //記住跳轉(zhuǎn)頁           
            }
            else if(type.equals("consumerinfo")){                        //當(dāng)搜索客戶時
                hql = "from ConsumerInfo where cname like '%"+key+"%'";    //得到搜索的hql
                tp = "select count(*) from ConsumerInfo where cname like '%"+key+"%'"; //搜索總頁數(shù)的hql
                url = "/consumermanage.jsp";                            //要跳轉(zhuǎn)到的url           
            }
            else if(type.equals("providerinfo")){
                hql = "from ProviderInfo where pname like '%"+key+"%'";    //得到搜索的hql
                tp = "select count(*) from ProviderInfo where pname like '%"+key+"%'"; //搜索總頁數(shù)的hql
                url = "/providermanage.jsp";                            //要跳轉(zhuǎn)到的url           
            }
            else if(type.equals("stockinfo")){
                hql = "from StockInfo where sid like '%"+key+"%'";        //得到搜索的hql
                tp = "select count(*) from StockInfo where sid like '%"+key+"%'";//得到搜索總頁數(shù)的hql
                url = "/stockmanage.jsp";                                //要跳轉(zhuǎn)到的url               
            }
            else if(type.equals("sellinfo")){
                hql = "from SellInfo where eid like '%"+key+"%'";        //得到搜索對象的hql
                tp = "select count(*) from SellInfo where eid like '%"+key+"%'";//得到搜索總頁數(shù)的hql
                url = "/sellmanage.jsp";                                //要跳轉(zhuǎn)到的url       
            }
            else if(type.equals("admininfo")){
                hql = "from AdminInfo where aname like '%"+key+"%'";    //得到搜索對象的hql
                tp = "select count(*) from AdminInfo where aname like '%"+key+"%'";//得到搜索總頁數(shù)的hql
                url = "/adminmanage.jsp";                                //要跳轉(zhuǎn)到的url
            }
            else if(type.equals("sta")){                                //庫存統(tǒng)計
                String myradio = request.getParameter("myradio").trim();
                int gamount = Integer.parseInt(key);
                if(myradio.equals("more")){
                    hql = "from GoodsInfo as gi where gi.gamount>="+gamount;
                    tp = "select count(*) from GoodsInfo as gi where gi.gamount>="+gamount;
                }
                else{
                    hql = "from GoodsInfo as gi where gi.gamount<="+gamount;
                    tp = "select count(*) from GoodsInfo as gi where gi.gamount<="+gamount;
                }
                url = "/statistic.jsp";                                    //要跳轉(zhuǎn)到的url
            }
            else if(type.equals("consumerback")){                        //客戶退貨
                hql = "from ConsumerBack as cb where cb.cbid like '%"+key+"%'";
                tp = "select count(*) from ConsumerBack as cb where cb.cbid like '%"+key+"%'";
                url = "/consumerbackmanage.jsp";               
            }
            else if(type.equals("providerback")){
                hql = "from ProviderBack as pb where pb.pbid like '%"+key+"%'";
                tp = "select count(*) from ProviderBack as pb where pb.pbid like '%"+key+"%'";
                url = "/providerbackmanage.jsp";
            }   
            userBean.setHql(hql);                                        //記住當(dāng)前hql
            userBean.setPageHql(tp);                                    //記住搜索總頁數(shù)的hql
            int totalPage = db.getTotalPage(tp,userBean.getSpan());
            userBean.setTotalPage(totalPage);                            //記住當(dāng)前總頁數(shù)
            List list = db.getPageContent(hql,userBean.getNowPage(),userBean.getSpan());           
            request.setAttribute("goodslist",list);                        //將頁面內(nèi)容放入請求中                                           
            ServletContext sc = getServletContext();                    //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher(url);
            rd.forward(request,response);                                //頁面跳轉(zhuǎn)
        }
        else if(action.equals("changePage")){
            String page = request.getParameter("page").trim();                //得到要跳轉(zhuǎn)到的頁數(shù)
            String url = request.getParameter("pagename").trim();            //得到頁面的名字
            userBean.setNowPage(Integer.parseInt(page));                    //記錄頁數(shù)
            List goodslist = db.getPageContent(userBean.getHql(),
                                userBean.getNowPage(),userBean.getSpan());    //得到商品列表   
            request.setAttribute("goodslist",goodslist);                    //將列表放入請求中
            ServletContext sc = getServletContext();                        //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher(url);
            rd.forward(request,response);                                    //頁面跳轉(zhuǎn)   
        }
        else if(action.equals("addGoods")){
            String gname = request.getParameter("gname").trim();    //得到商品名稱
            String gcname = request.getParameter("gcname").trim();    //得到商品類別
            String gunit = request.getParameter("gunit").trim();    //得到商品單位
            String pin = request.getParameter("gpin").trim();        //得到商品進(jìn)價
            String pout = request.getParameter("gpout").trim();        //得到商品售價
            String amount = request.getParameter("gamount").trim();    //得到商品數(shù)量
            String gid = db.getId("GoodsInfo","gid");                //得到商品的ID
            gname = new String(gname.getBytes(),"ISO-8859-1");        //轉(zhuǎn)碼
            gcname = new String(gcname.getBytes(),"ISO-8859-1");    //轉(zhuǎn)碼
            String hql = "select gg.gcid from GoodsClassInfo as gg where gg.gcname='"+gcname+"'";
            String gcid = (String)((db.getInfo(hql)).get(0));        //得到類別ID           
            String temp = "from GoodsInfo as gi where gi.gname='"+gname+"'";
            List li = db.getInfo(temp);
            String url = "";
            if(li.isEmpty()){
                gunit = new String(gunit.getBytes(),"ISO-8859-1");        //轉(zhuǎn)碼
                double gpin = Double.parseDouble(pin);                    //將String轉(zhuǎn)為double型
                double gpout = Double.parseDouble(pout);                //將String轉(zhuǎn)為double型
                int gamount = Integer.parseInt(amount);                    //將String轉(zhuǎn)為int型
                GoodsInfo gi = new GoodsInfo(gid,gname,gcid,gunit,gpin,gpout,gamount);   
                dbin.insertTable("GoodsInfo",gi);                            //更新表格
                //out.println("eval(\'alert(\'恭喜你,添加成功!!!\')\')");           
                int totalPage = db.getTotalPage(userBean.getPageHql(),userBean.getSpan());
                userBean.setTotalPage(totalPage);                        //記住當(dāng)前總頁數(shù)           
                List goodslist = db.getPageContent(userBean.getHql(),
                            userBean.getNowPage(),userBean.getSpan());    //得到商品列表
                request.setAttribute("goodslist",goodslist);            //將列表放到請求中               
                url = "/goodsmanage.jsp";
            }
            else{
                url = "/info.jsp";
                String msg = "該物品已經(jīng)存在,不可添加!!!";
                request.setAttribute("msg",msg);
            }
            ServletContext sc = getServletContext();                //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher(url);
            rd.forward(request,response);                            //頁面跳轉(zhuǎn)               
        }
        else if(action.equals("lookGoods")){
            String gid = request.getParameter("gid").trim();        //得到商品ID
            GoodsInfo gi = (GoodsInfo)db.getObject("GoodsInfo",gid);//得到商品對象
            request.setAttribute("object",gi);                        //將商品對象放入請求中
            ServletContext sc = getServletContext();                //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher("/modifygoods.jsp");
            rd.forward(request,response);                            //頁面跳轉(zhuǎn)
        }
        else if(action.equals("modifyGoods")){
            String gid = request.getParameter("gid").trim();        //得到商品的ID
            String gname = request.getParameter("gname").trim();    //得到商品名稱
            String gcname = request.getParameter("gcname").trim();    //得到商品類別
            String gunit = request.getParameter("gunit").trim();    //得到商品單位
            String pin = request.getParameter("gpin").trim();        //得到商品進(jìn)價
            String pout = request.getParameter("gpout").trim();        //得到商品售價
            String amount = request.getParameter("gamount").trim();    //得到商品數(shù)量
            gname = new String(gname.getBytes(),"ISO-8859-1");        //轉(zhuǎn)碼           
            gcname = new String(gcname.getBytes(),"ISO-8859-1");    //轉(zhuǎn)碼
            gunit = new String(gunit.getBytes(),"ISO-8859-1");        //轉(zhuǎn)碼
            double gpin = Double.parseDouble(pin);                    //將String轉(zhuǎn)為double型
            double gpout = Double.parseDouble(pout);                //將String轉(zhuǎn)為double型
            int gamount = Integer.parseInt(amount);                    //將String轉(zhuǎn)為int型
            String hql = "select gcid from GoodsClassInfo where gcname='"+gcname+"'";
            String gcid = (String)((db.getInfo(hql)).get(0));        //得到類別ID
            GoodsInfo gi = new GoodsInfo(gid,gname,gcid,gunit,gpin,gpout,gamount);
            dbup.updateTable("GoodsInfo",gi,gid);
            List goodslist = db.getPageContent(userBean.getHql(),
                                userBean.getNowPage(),userBean.getSpan());
            request.setAttribute("goodslist",goodslist);            //
            ServletContext sc = getServletContext();                //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher("/goodsmanage.jsp");
            rd.forward(request,response);                            //頁面跳轉(zhuǎn)
        }
        else if(action.equals("deleteGoods")){                                //當(dāng)動作為刪除商品時
            String gid = request.getParameter("gid").trim();                //得到商品ID
            dbde.deleteTable("GoodsInfo",gid);
            int totalPage = db.getTotalPage(userBean.getPageHql(),userBean.getSpan());
            userBean.setTotalPage(totalPage);                                //記住當(dāng)前總頁數(shù)       
            userBean.setNowPage(1);                                            //設(shè)置當(dāng)前頁為1
            List goodslist = db.getPageContent(userBean.getHql(),
                                userBean.getNowPage(),userBean.getSpan());    //得到商品列表   
            request.setAttribute("goodslist",goodslist);                    //將列表放入請求中
            ServletContext sc = getServletContext();                        //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher("/goodsmanage.jsp");
            rd.forward(request,response);                                    //頁面跳轉(zhuǎn)
        }
        else if(action.equals("addGoodsClass")){                            //當(dāng)動作為添加商品類別時
            String gcname = request.getParameter("gcname").trim();            //得到要添加的類名
            gcname = new String(gcname.getBytes(),"ISO-8859-1");            //將類名轉(zhuǎn)碼           
            String hql = "from GoodsClassInfo as gci where gci.gcname='"+gcname+"'";
            List gclist = db.getInfo(hql);
            String url = "/goodsclassmanage.jsp";
            if(gclist.isEmpty()){
                String gcid = db.getId("GoodsClassInfo","gcid");                //得到要插入的類的ID
                GoodsClassInfo gci = new GoodsClassInfo(gcid,gcname);
                dbin.insertTable("GoodsClassInfo",gci);
                int totalPage = db.getTotalPage(userBean.getPageHql(),userBean.getSpan());           
                userBean.setTotalPage(totalPage);                        //記住當(dāng)前總頁數(shù)           
                List goodslist = db.getPageContent(userBean.getHql(),
                            userBean.getNowPage(),userBean.getSpan());    //得到商品類別列表
                request.setAttribute("goodslist",goodslist);            //將列表放到請求中               
            }
            else{
                url = "/info.jsp";
                String msg = "該類別已經(jīng)存在!!!";
                request.setAttribute("msg",msg);
            }

            ServletContext sc = getServletContext();                //得到上下文
            RequestDispatcher rd = sc.getRequestDispatcher(url);
            rd.forward(request,response);                            //頁面跳轉(zhuǎn)           
        }

Userbean
package wyf.zrk;

public class UserBean{
    private int span = 8;
    private int totalPage = 1;
    private int nowPage = 1;
    private String hql = "";
    private String pageHql = "";
    public int getSpan() {
        return span;
    }
    public void setSpan(int span) {
        this.span = span;
    }
    public int getTotalPage() {
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
    public int getNowPage() {
        return nowPage;
    }
    public void setNowPage(int nowPage) {
        this.nowPage = nowPage;
    }
    public String getHql() {
        return hql;
    }
    public void setHql(String hql) {
        this.hql = hql;
    }
    public String getPageHql(){
        return pageHql;
    }
    public void setPageHql(String pageHql){
        this.pageHql = pageHql;
    }
}

DButil.java
package wyf.zrk;

import java.util.*;
import org.springframework.orm.hibernate3.*;
import org.hibernate.*;

public class DButil {
    private SessionFactory sf;
    public SessionFactory getSf(){
        return this.sf;
    }
    public void setSf(SessionFactory sf){
        this.sf = sf;
    }
    public String getId(String tablename,String columnname){
        Session sess = sf.openSession();                        //創(chuàng)建會話
        String hql = "select Max("+columnname+") from "+tablename;
        Query q = sess.createQuery(hql);                        //進(jìn)行查詢
        List<String> result = q.list();                            //得到結(jié)果列表
        if(result.get(0)==null){                                //當(dāng)表中沒有記錄進(jìn)
            return "10001";
        }
        int id = Integer.parseInt(result.get(0));                //將id轉(zhuǎn)化為int型
        id++;                                                    //將id自加
        sess.close();
        return Integer.valueOf(id).toString();                    //返回id
    }
    public List<?> getInfo(String hql){
        Session sess = sf.openSession();                        //創(chuàng)建會話
        Query q = sess.createQuery(hql);                        //執(zhí)行查詢
        List<?> list = q.list();                                //得到結(jié)果列表
        sess.close();
        return list;                                            //將結(jié)果列表返回
    }
    public List<?> getPageContent(String hql,int page,int span){//得到某頁的內(nèi)容
        List temp = new ArrayList();                            //創(chuàng)建list,用來存放頁面內(nèi)容
        Session sess = sf.openSession();                        //創(chuàng)建會話
        Query q = sess.createQuery(hql);                        //執(zhí)行查詢
        List list = q.list();                                    //得到結(jié)果
        int i = 0;                                                //標(biāo)志位,用來記錄條數(shù)
        while((page-1)*span+i<list.size()&&i<span){                           
            temp.add(list.get((page-1)*span+i));                //將結(jié)果添加到temp中
            i++;                                                //標(biāo)志位自加
        }
        sess.close();
        return temp;                                            //將結(jié)果返回
    }
    public int getTotalPage(String hql,int span){                //用來得到總頁數(shù)
        Session sess = sf.openSession();                        //創(chuàng)建會話
        Query q = sess.createQuery(hql);                        //執(zhí)行查詢
        List<Long> list = q.list();                                //得到結(jié)果列表
        int count = (list.get(0)).intValue();                    //得到總記錄條數(shù)
        int page = (count%span==0)?(count/span):(count/span+1);    //得到總頁數(shù)
        sess.close();
        return page;                                            //將總頁數(shù)返回
    }
    public List<String> getGoodsClass(){
        Session sess = sf.openSession();                        //得到session對象
        String hql = "select gcname from GoodsClassInfo";        //得到所有的類名的hql
        Query q = sess.createQuery(hql);                        //執(zhí)行查詢
        List<String> name = q.list();                            //得到列表
        sess.close();
        return name;                                            //將結(jié)果返回
    }

adminInfo.java
package wyf.zrk;

public class AdminInfo {
    private String aid;
    private String aname;
    private String apwd;
    private String alevel;
    public AdminInfo(){}
    public AdminInfo(String aid,String aname,String apwd,String alevel){
        this.aid = aid;
        this.aname = aname;
        this.apwd = apwd;
        this.alevel = alevel;
    }
    public String getAid() {
        return aid;
    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public String getAname() {
        return aname;
    }

    public void setAname(String aname) {
        this.aname = aname;
    }

    public String getApwd() {
        return apwd;
    }

    public void setApwd(String apwd) {
        this.apwd = apwd;
    }

    public String getAlevel() {
        return alevel;
    }

    public void setAlevel(String alevel) {
        this.alevel = alevel;
    }



    public String toString(){
        return this.aname+"/t"+this.apwd;
    }
}

adminInfo.hbm.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
    package="org.hibernate.auction">

    <class name="wyf.zrk.AdminInfo" table="AdminInfo">
        <id name="aid" type="java.lang.String"></id>
        <property name="aname" not-null="true" length="50" column="`aname`"/>   
        <property name="apwd" not-null="true" length="20" column="`apwd`"/>
        <property name="alevel" not-null="true" length="20" column="`alevel`"/>
    </class>
</hibernate-mapping>



本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
java學(xué)習(xí)筆記
Hibernate的個人整理筆記
Spring中常用的hql查詢方法(getHibernateTemplate()) - d...
Hibernate中常見的20個問題(11-20)
hibernate 一對一實踐
主題:通過hibernate攔截器實現(xiàn)自定義分表策略
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服