案例49-crm练习获取客户列表带有分页和筛选功能
1 案例分析
2 书写步骤
1.封装PageBean
2.书写Action
3.书写Service
4.书写Dao 注意清空之前设置的聚合函数 dc.setProjection(null);
5.完成strutx以及spring的配置
6.书写前台list.jsp页面
3 代码实现
1 封装PageBean
- package www.test.utils;
- import java.util.List;
- public class PageBean {
- //当前页
- private Integer currentPage;
- //当前页显示的条数
- private Integer pageSize;
- //总页数
- private Integer totalPage;
- //总记录数
- private Integer totalCount;
- //分页列表的数据
- private List list;
- public PageBean(Integer currentPage, Integer pageSize, Integer totalCount) {
- this.currentPage = currentPage;
- this.pageSize = pageSize;
- this.totalCount = totalCount;
- //如果没有指定显示那一页,就显示第一页。
- if (this.currentPage == null) {
- this.currentPage = 1;
- }
- //如果没有指定每页显示几条数据,就默认显示3条。
- if (this.pageSize == null) {
- this.pageSize = 3;
- }
- //计算总页数
- this.totalPage = (this.totalCount + this.pageSize - 1) / this.pageSize;
- //this.totalPage = (int) Math.ceil((this.totalCount*1.0)/this.pageSize);
- //判断当前页数是否超出范围
- //不能小于1
- if (this.currentPage < 1) {
- this.currentPage = 1;
- }
- //不能大于总页数
- if (this.currentPage > this.totalPage) {
- this.currentPage = this.totalPage;
- }
- }
- //计算起始索引
- public Integer getStart() {
- return (this.currentPage - 1) * this.pageSize;
- }
- public Integer getCurrentPage() {
- return currentPage;
- }
- public void setCurrentPage(Integer currentPage) {
- this.currentPage = currentPage;
- }
- public Integer getPageSize() {
- return pageSize;
- }
- public void setPageSize(Integer pageSize) {
- this.pageSize = pageSize;
- }
- public Integer getTotalPage() {
- return totalPage;
- }
- public void setTotalPage(Integer totalPage) {
- this.totalPage = totalPage;
- }
- public Integer getTotalCount() {
- return totalCount;
- }
- public void setTotalCount(Integer totalCount) {
- this.totalCount = totalCount;
- }
- public List getList() {
- return list;
- }
- public void setList(List list) {
- this.list = list;
- }
- }
2.书写Action
- package www.test.web.action;
- import org.apache.commons.lang3.StringUtils;
- import org.hibernate.criterion.DetachedCriteria;
- import org.hibernate.criterion.Restrictions;
- import com.opensymphony.xwork2.ActionContext;
- import com.opensymphony.xwork2.ActionSupport;
- import com.opensymphony.xwork2.ModelDriven;
- import www.test.domain.Customer;
- import www.test.service.CustomerService;
- import www.test.utils.PageBean;
- public class CustomerAction extends ActionSupport implements ModelDriven<Customer>{
- private Customer customer = new Customer();
- private CustomerService cs;
- private Integer currentPage;
- private Integer pageSize;
- //获取客户列表
- public String list() throws Exception {
- //封装离线查询对象
- DetachedCriteria dc = DetachedCriteria.forClass(Customer.class);
- //判断并封装参数
- if(StringUtils.isNotBlank(customer.getCust_name())){
- dc.add(Restrictions.like("cust_name", "%"+customer.getCust_name()+"%"));
- }
- //1 调用Service查询分页数据(PageBean)
- PageBean pb = cs.getPageBean(dc,currentPage,pageSize);
- //2 将PageBean放入request域,转发到列表页面显示
- ActionContext.getContext().put("pageBean", pb);
- return "list";
- }
- @Override
- public Customer getModel() {
- return customer;
- }
- public CustomerService getCs() {
- return cs;
- }
- public void setCs(CustomerService cs) {
- this.cs = cs;
- }
- public Integer getCurrentPage() {
- return currentPage;
- }
- public void setCurrentPage(Integer currentPage) {
- this.currentPage = currentPage;
- }
- public Integer getPageSize() {
- return pageSize;
- }
- public void setPageSize(Integer pageSize) {
- this.pageSize = pageSize;
- }
- }
3.书写Service
- package www.test.service;
- import org.hibernate.criterion.DetachedCriteria;
- import www.test.utils.PageBean;
- public interface CustomerService {
- PageBean getPageBean(DetachedCriteria dc, Integer currentPage, Integer pageSize);
- }
- package www.test.service.impl;
- import java.util.List;
- import org.hibernate.criterion.DetachedCriteria;
- import www.test.dao.CustomerDao;
- import www.test.domain.Customer;
- import www.test.service.CustomerService;
- import www.test.utils.PageBean;
- public class CustomerServiceImpl implements CustomerService {
- private CustomerDao cd;
- @Override
- public PageBean getPageBean(DetachedCriteria dc, Integer currentPage, Integer pageSize) {
- // 1 调用dao层查询总记录数
- Integer totalCount = cd.getTotalCount(dc);
- // 2创建pageBean对象
- PageBean pb = new PageBean(currentPage, pageSize, totalCount);
- // 3查询客户列表
- List<Customer> list = cd.getPageList(dc,pb.getStart(),pb.getPageSize());
- // 4返回pageBean
- pb.setList(list);
- return pb;
- }
- public CustomerDao getCd() {
- return cd;
- }
- public void setCd(CustomerDao cd) {
- this.cd = cd;
- }
- }
4.书写Dao
- package www.test.dao;
- import java.util.List;
- import org.hibernate.criterion.DetachedCriteria;
- import www.test.domain.Customer;
- public interface CustomerDao {
- //查询总记录数
- Integer getTotalCount(DetachedCriteria dc);
- //根据条件查询客户列表
- List<Customer> getPageList(DetachedCriteria dc, Integer start, Integer pageSize);
- }
- package www.test.dao.impl;
- import java.util.List;
- import org.hibernate.criterion.DetachedCriteria;
- import org.hibernate.criterion.Projection;
- import org.hibernate.criterion.Projections;
- import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
- import www.test.dao.CustomerDao;
- import www.test.domain.Customer;
- public class CustomerDaoImpl extends HibernateDaoSupport implements CustomerDao{
- @Override
- public Integer getTotalCount(DetachedCriteria dc) {
- //设置查询聚合函数,总记录数
- dc.setProjection(Projections.rowCount());
- List<Long> list = (List<Long>) super.getHibernateTemplate().findByCriteria(dc);
- //清空之前设置的聚合函数
- dc.setProjection(null);
- if(list!=null&&list.size()>0){
- Long count = list.get(0);
- return count.intValue();
- }else{
- return null;
- }
- }
- @Override
- public List<Customer> getPageList(DetachedCriteria dc, Integer start, Integer pageSize) {
- List<Customer> list = (List<Customer>) super.getHibernateTemplate().findByCriteria(dc, start, pageSize);
- return list;
- }
- }
5.完成strutx以及spring的配置
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <!-- <constant name="struts.devMode" value="true"></constant> -->
- <!--
- #struts.objectFactory = spring 将action的创建交给spring容器
- struts.objectFactory.spring.autoWire = name spring负责装配Action依赖属性
- -->
- <constant name="struts.objectFactory" value="spring"></constant>
- <package name="crm" namespace="/" extends="struts-default">
- <global-exception-mappings>
- <exception-mapping result="error" exception="java.lang.RuntimeException"></exception-mapping>
- </global-exception-mappings>
- <action name="UserAction_*" class="userAction" method="{1}">
- <result name="toHome" type="redirect">/index.htm</result>
- <result name="error" type="dispatcher">/login.jsp</result>
- </action>
- <action name="CustomerAction_*" class="customerAction" method="{1}">
- <result name="list" type="dispatcher">/jsp/customer/list.jsp</result>
- </action>
- </package>
- </struts>
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.2.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-4.2.xsd ">
- <!--5 读取database.properties文件 -->
- <context:property-placeholder location="classpath:database.properties"/>
- <!--6 准备druid连接池 -->
- <bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
- <property name="driverClassName" value="${jdbc.driverClass}"></property>
- <property name="url" value="${jdbc.jdbcUrl}"></property>
- <property name="username" value="${jdbc.user}"></property>
- <property name="password" value="${jdbc.password}"></property>
- </bean>
- <!--7 核心事务管理器 依赖于SessionFactory-->
- <bean name="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <!--8 配置通知 -->
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="save*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="persist*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="update*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="modify*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="delete*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="remove*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
- <tx:method name="find*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true"/>
- <tx:method name="get*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true"/>
- </tx:attributes>
- </tx:advice>
- <!--9 配置将通知织入目标对象 配置切点+配置切面 -->
- <aop:config>
- <aop:pointcut expression="execution(* www.test.service.impl.*ServiceImpl.*(..))" id="txPc"/>
- <aop:advisor advice-ref="txAdvice" pointcut-ref="txPc"/>
- </aop:config>
- <!--1 action -->
- <bean name="userAction" class="www.test.web.action.UserAction" scope="prototype">
- <property name="us" ref="userService"></property>
- </bean>
- <bean name="customerAction" class="www.test.web.action.CustomerAction" scope="prototype">
- <property name="cs" ref="customerService"></property>
- </bean>
- <!--2 service -->
- <bean name="userService" class="www.test.service.impl.UserServiceImpl">
- <property name="ud" ref="userDao"></property>
- </bean>
- <bean name="customerService" class="www.test.service.impl.CustomerServiceImpl">
- <property name="cd" ref="customerDao"></property>
- </bean>
- <!--3 dao -->
- <bean name="userDao" class="www.test.dao.impl.UserDaoImpl">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <bean name="customerDao" class="www.test.dao.impl.CustomerDaoImpl">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <!--4 将SessionFactory配置到spring容器中 -->
- <!-- 加载配置方案1:仍然使用外部的hibernate.cfg.xml配置信息 -->
- <!-- <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
- </bean> -->
- <!-- 加载配置方案2:在spring配置中放置hibernate配置信息 -->
- <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <!-- 将连接池注入到sessionFactory, hibernate会通过连接池获得连接 -->
- <property name="dataSource" ref="dataSource"></property>
- <!-- 配置hibernate基本信息 -->
- <property name="hibernateProperties">
- <props>
- <!-- 必选配置 -->
- <!-- <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
- <prop key="hibernate.connection.url">jdbc:mysql:///hibernate</prop>
- <prop key="hibernate.connection.username">root</prop>
- <prop key="hibernate.connection.password">root</prop> -->
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
- <!-- 可选配置 -->
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.format_sql">true</prop>
- <prop key="hibernate.hbm2ddl.auto">update</prop>
- </props>
- </property>
- <!-- 引入orm元数据,指定orm元数据所在的包路径,spring会自动读取包中的所有配置 -->
- <property name="mappingDirectoryLocations" value="classpath:www/test/domain"></property>
- </bean>
- </beans>
6.书写前台list.jsp页面
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <%@ taglib prefix="s" uri="/struts-tags"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <TITLE>客户列表</TITLE>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <LINK href="${pageContext.request.contextPath }/css/Style.css"
- type=text/css rel=stylesheet>
- <LINK href="${pageContext.request.contextPath }/css/Manage.css"
- type=text/css rel=stylesheet>
- <script type="text/javascript"
- src="${pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
- <SCRIPT language=javascript>
- function changePage(pageNum){
- //alert(pageNum);
- //1 将页码的值放入对应表单隐藏域中
- $("#currentPageInput").val(pageNum);
- //2提交表达
- $("#pageForm").submit();
- }
- function changePageSize(pageSize){
- //alert(pageSize);
- //1 将页码的值放入对应表单隐藏域中
- $("#pageSizeInput").val(pageSize);
- //2提交表达
- $("#pageForm").submit();
- }
- </SCRIPT>
- <META content="MSHTML 6.00.2900.3492" name=GENERATOR>
- </HEAD>
- <BODY>
- <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
- <TBODY>
- <TR>
- <TD width=15><IMG
- src="${pageContext.request.contextPath }/images/new_019.jpg"
- border=0></TD>
- <TD width="100%"
- background="${pageContext.request.contextPath }/images/new_020.jpg"
- height=20></TD>
- <TD width=15><IMG
- src="${pageContext.request.contextPath }/images/new_021.jpg"
- border=0></TD>
- </TR>
- </TBODY>
- </TABLE>
- <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
- <TBODY>
- <TR>
- <TD width=15 background=${pageContext.request.contextPath }
- /images/new_022.jpg><IMG
- src="${pageContext.request.contextPath }/images/new_022.jpg"
- border=0></TD>
- <TD vAlign=top width="100%" bgColor=#ffffff>
- <TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
- <TR>
- <TD class=manageHead>当前位置:客户管理 > 客户列表</TD>
- </TR>
- <TR>
- <TD height=2></TD>
- </TR>
- </TABLE>
- <TABLE borderColor=#cccccc cellSpacing=0 cellPadding=0 width="100%"
- align=center border=0>
- <TBODY>
- <TR>
- <TD height=25>
- <FORM id="pageForm" name="customerForm"
- action="${pageContext.request.contextPath }/CustomerAction_list"
- method=post>
- <!-- 隐藏域 用于传递当前页面 -->
- <input type="hidden" name="currentPage" id="currentPageInput"
- value="<s:property value="#pageBean.currentPage"/>">
- <!-- 隐藏域 用于传递每页显示的条数 -->
- <input type="hidden" name="pageSize" id="pageSizeInput"
- value="<s:property value="#pageBean.pageSize"/>">
- <TABLE cellSpacing=0 cellPadding=2 border=0>
- <TBODY>
- <TR>
- <TD>客户名称:</TD>
- <TD><INPUT class=textbox id=sChannel2
- style="WIDTH: 80px" maxLength=50 name="cust_name"
- value="${param.cust_name}"></TD>
- <TD><INPUT class=button id=sButton2 type=submit
- value=" 筛选 " name=sButton2></TD>
- </TR>
- </TBODY>
- </TABLE>
- </FORM>
- </TD>
- </TR>
- <TR>
- <TD>
- <TABLE id=grid
- style="BORDER-TOP-WIDTH: 0px; FONT-WEIGHT: normal; BORDER-LEFT-WIDTH: 0px; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 0px; BORDER-BOTTOM-COLOR: #cccccc; WIDTH: 100%; BORDER-TOP-COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #cccccc; BORDER-RIGHT-WIDTH: 0px; TEXT-DECORATION: none; BORDER-RIGHT-COLOR: #cccccc"
- cellSpacing=1 cellPadding=2 rules=all border=0>
- <TBODY>
- <TR
- style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
- <TD>客户名称</TD>
- <TD>客户级别</TD>
- <TD>客户来源</TD>
- <TD>联系人</TD>
- <TD>电话</TD>
- <TD>手机</TD>
- <TD>操作</TD>
- </TR>
- <s:iterator value="#pageBean.list" var="cust">
- <TR
- style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
- <TD><s:property value="#cust.cust_name" /></TD>
- <TD><s:property value="#cust.cust_level" /></TD>
- <TD><s:property value="#cust.cust_source" /></TD>
- <TD><s:property value="#cust.cust_linkman" /></TD>
- <TD><s:property value="#cust.cust_phone" /></TD>
- <TD><s:property value="#cust.cust_mobile" /></TD>
- <TD><a
- href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
- <a
- href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
- </TD>
- </TR>
- </s:iterator>
- <%-- <s:iterator value="#list" >
- <TR
- style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
- <TD>
- <s:property value="cust_name" />
- </TD>
- <TD>
- <s:property value="cust_level" />
- </TD>
- <TD>
- <s:property value="cust_source" />
- </TD>
- <TD>
- <s:property value="cust_linkman" />
- </TD>
- <TD>
- <s:property value="cust_phone" />
- </TD>
- <TD>
- <s:property value="cust_mobile" />
- </TD>
- <TD>
- <a href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
-
- <a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
- </TD>
- </TR>
- </s:iterator> --%>
- <%-- <c:forEach items="${list }" var="customer">
- <TR
- style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
- <TD>${customer.cust_name }</TD>
- <TD>${customer.cust_level }</TD>
- <TD>${customer.cust_source }</TD>
- <TD>${customer.cust_linkman }</TD>
- <TD>${customer.cust_phone }</TD>
- <TD>${customer.cust_mobile }</TD>
- <TD>
- <a href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
-
- <a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
- </TD>
- </TR>
- </c:forEach> --%>
- </TBODY>
- </TABLE>
- </TD>
- </TR>
- <TR>
- <TD><SPAN id=pagelink>
- <DIV
- style="LINE-HEIGHT: 20px; HEIGHT: 20px; TEXT-ALIGN: right">
- 共[<B><s:property value="#pageBean.totalCount" /></B>]条记 录,[<B>
- <s:property value="#pageBean.currentPage" />
- </B>]页 ,每页显示
- <select name="pageSize" id="selectPageSize" onchange="changePageSize($('#selectPageSize option:selected').val())" >
- <option value="1" <s:property value="#pageBean.pageSize==1?'selected':''"/>>1</option>
- <option value="2" <s:property value="#pageBean.pageSize==2?'selected':''"/>>2</option>
- <option value="3" <s:property value="#pageBean.pageSize==3?'selected':''"/>>3</option>
- <option value="4" <s:property value="#pageBean.pageSize==4?'selected':''"/>>4</option>
- <option value="5" <s:property value="#pageBean.pageSize==5?'selected':''"/>>5</option>
- </select> 条
- [<A href="javaScript:void(0)"
- onclick="changePage(<s:property value='#pageBean.currentPage-1' />)">前一页</A>]
- <%-- <B>${page}</B> --%>
- [<A href="javaScript:void(0)"
- onclick="changePage(<s:property value='#pageBean.currentPage+1' />)">后一页</A>]
- 到 <input type="text" size="3" id="page" name="page"
- value="<s:property value='#pageBean.currentPage'/>" /> 页 <input
- type="button" value="Go"
- onclick="changePage($('#page').val())" />
- </DIV>
- </SPAN></TD>
- </TR>
- </TBODY>
- </TABLE>
- </TD>
- <TD width=15
- background="${pageContext.request.contextPath }/images/new_023.jpg"><IMG
- src="${pageContext.request.contextPath }/images/new_023.jpg"
- border=0></TD>
- </TR>
- </TBODY>
- </TABLE>
- <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
- <TBODY>
- <TR>
- <TD width=15><IMG
- src="${pageContext.request.contextPath }/images/new_024.jpg"
- border=0></TD>
- <TD align=middle width="100%"
- background="${pageContext.request.contextPath }/images/new_025.jpg"
- height=15></TD>
- <TD width=15><IMG
- src="${pageContext.request.contextPath }/images/new_026.jpg"
- border=0></TD>
- </TR>
- </TBODY>
- </TABLE>
- </BODY>
- </HTML>
案例49-crm练习获取客户列表带有分页和筛选功能的更多相关文章
- 案例42-使用ajax获取crm中的客户列表
1webcontent部分 1 修改menu.jsp代码 2 jsp/customer/list.jsp代码 <%@ page language="java" content ...
- 案例43-crm练习获取客户列表使用struts2
1 src下配置文件 1 struts.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYP ...
- crm --- 1.admin , 展示列表 和 分页
一.admin (创建超级用户) 1.注册: 1.创建一个超级管理员,使用如下命令: python manage.py createsuperuser 2.输入打算使用的登录名: username:m ...
- 一步一步搭建客服系统 (4) 客户列表 - JS($.ajax)调用WCF 遇到的各种坑
本文以一个生成.获取“客户列表”的demo来介绍如何用js调用wcf,以及遇到的各种问题. 1 创建WCF服务 1.1 定义接口 创建一个接口,指定用json的格式: [ServiceContra ...
- 【JAVAEE学习笔记】hibernate04:查询种类、HQL、Criteria、查询优化和练习为客户列表增加查询条件
一.查询种类 1.oid查询-get 2.对象属性导航查询 3.HQL 4.Criteria 5.原生SQL 二.查询-HQL语法 //学习HQL语法 public class Demo { //基本 ...
- JAVAEE学习——hibernate04:查询种类、HQL、Criteria、查询优化和练习为客户列表增加查询条件
一.查询种类 1.oid查询-get 2.对象属性导航查询 3.HQL 4.Criteria 5.原生SQL 二.查询-HQL语法 //学习HQL语法 public class Demo { //基本 ...
- 案例52-crm练习新增客户中加入文件上传功能(struts2文件上传)
1 jsp/customer/add.jsp 完整代码: <%@ page language="java" contentType="text/html; char ...
- SSM项目使用GoEasy 获取客户端上下线实时状态变化及在线客户列表
一.背景 上篇SSM项目使用GoEasy 实现web消息推送服务是GoEasy的一个用途,今天我们来看GoEasy的第二个用途:订阅客户端上下线实时状态变化.获取当前在线客户数量和在线客户列表.截止我 ...
- Python-装饰器-案例-获取文件列表
import os def get_all_path(fun): '''装饰器.功能:获取全路径文件名.如:D:/tmp/12.txt :param fun: :return:file_path_li ...
随机推荐
- C# 写 LeetCode easy #14 Longest Common Prefix
14.Longest Common Prefix Write a function to find the longest common prefix string amongst an array ...
- c#操作json 使用JavaScriptSerializer
需要引用:System.Web.Extensions /// <summary> /// json的信息.保证定义的变量和json的字段一样(也可以使用struct) /// </s ...
- centoOS下安装python3 和 pip: command not found
在更新python3的时候会自动安装pip3,但是安装完成后,pip -V发现出错:command not found,找了好久,发现在建立软连接的时候路径写错了. 总结一下安装python3和发现p ...
- UGUI 深度優化提升手遊效能
https://hackmd.io/s/S1z1ByaGb#UGUI-%E6%B7%B1%E5%BA%A6%E5%84%AA%E5%8C%96%E6%8F%90%E5%8D%87%E6%89%8B%E ...
- (Python OpenGL)【3】着色器 PyOpenGL
(Python OpenGL)现在开始我们使用着色器来进行渲染.着色器是目前做3D图形最流行的方式. OpenGL的渲染管线流程: 数据传输到OpenGL—>顶点处理器—>细分着色—> ...
- 模板【洛谷P3390】 【模板】矩阵快速幂
P3390 [模板]矩阵快速幂 题目描述 给定n*n的矩阵A,求A^k 矩阵A的大小为n×m,B的大小为n×k,设C=A×B 则\(C_{i,j}=\sum\limits_{k=1}^{n}A_{i, ...
- CF581D Three Logos 暴力
Three companies decided to order a billboard with pictures of their logos. A billboard is a big squa ...
- 勤哲excel服务器WEB网页环境搭建问题解决
因为客户希望在浏览器上使用勤哲的功能,因此希望大家勤哲excel服务器的web环境. 他们用的是勤哲2010版,需要装到64位环境下.在搭建的时候,遇到2个主要问题. 问题1:编译器错误消息: BC3 ...
- Eclipse导入GitHub项目两处报错处理
1.项目出现Could not calculate build plan:pligin 错误解决办法: 删除本地.m2仓库中 org.apache.maven.plugins:maven-resour ...
- SprimgMVC学习笔记(七)—— 上传图片
一.配置虚拟目录 在tomcat上配置图片虚拟目录,在tomcat下conf/server.xml中添加: <Context docBase="D:\upload\temp" ...