SSM框架整合,以CRM为例子

日期:2019-10-26编辑作者:www.6165.com

5.2.3. Mapper.xml

编写BaseDictMapper.xml

 1 <?xml version="1.0" encoding="UTF-8" ?>
 2 <!DOCTYPE mapper
 3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 5 <mapper namespace="cn.itcast.crm.mapper.BaseDictMapper">
 6 
 7     <!-- 根据类别代码查询数据 -->
 8     <select id="queryBaseDictByDictTypeCode" parameterType="String"
 9         resultType="cn.itcast.crm.pojo.BaseDict">
10         SELECT * FROM base_dict WHERE dict_type_code =
11         #{dict_type_code}
12     </select>
13 
14 </mapper>

SSM框架整合,以CRM为例子。 

 

  1. 格外管理器

4)配置此接口的完毕类 Springmvc.xml配置CommonsMultipartFileResolver   id=multipartFileResolver

3.5.8. Web.xml

配置Spring、SpringMVC、消除post乱码难点

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3     xmlns="http://java.sun.com/xml/ns/javaee"
 4     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 5     id="WebApp_ID" version="2.5">
 6     <display-name>boot-crm</display-name>
 7     <welcome-file-list>
 8         <welcome-file>index.jsp</welcome-file>
 9     </welcome-file-list>
10 
11     <!-- 配置spring -->
12     <context-param>
13         <param-name>contextConfigLocation</param-name>
14         <param-value>classpath:spring/applicationContext-*.xml</param-value>
15     </context-param>
16 
17     <!-- 配置监听器加载spring -->
18     <listener>
19         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
20     </listener>
21 
22     <!-- 配置过滤器,解决post的乱码问题 -->
23     <filter>
24         <filter-name>encoding</filter-name>    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
25     <init-param>
26             <param-name>encoding</param-name>
27             <param-value>UTF-8</param-value>
28     </init-param>
29     </filter>
30     <filter-mapping>
31         <filter-name>encoding</filter-name>
32         <url-pattern>/*</url-pattern>
33     </filter-mapping>
34 
35     <!-- 配置SpringMVC -->
36     <servlet>
37         <servlet-name>boot-crm</servlet-name>
38         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
39         <init-param>
40             <param-name>contextConfigLocation</param-name>
41             <param-value>classpath:spring/springmvc.xml</param-value>
42         </init-param>
43         <!-- 配置springmvc什么时候启动,参数必须为整数 -->
44         <!-- 如果为0或者大于0,则springMVC随着容器启动而启动 -->
45         <!-- 如果小于0,则在第一次请求进来的时候启动 -->
46         <load-on-startup>1</load-on-startup>
47     </servlet>
48     <servlet-mapping>
49         <servlet-name>boot-crm</servlet-name>
50         <!-- 所有的请求都进入springMVC -->
51         <url-pattern>/</url-pattern>
52     </servlet-mapping>
53 </web-app>

 

5.   完成查询条件最早化

 

 

CRM系统

5.3.2. BaseDictServiceImpl 实现类

 1 @Service
 2 public class BaseDictServiceImpl implements BaseDictService {
 3 
 4     @Autowired
 5     private BaseDictMapper baseDictMapper;
 6 
 7     @Override
 8     public List<BaseDict> queryBaseDictByDictTypeCode(String dictTypeCode) {
 9 
10         List<BaseDict> list = this.baseDictMapper.queryBaseDictByDictTypeCode(dictTypeCode);
11         return list;
12     }
13 }

 

 

 

2.   创立数据库

数据库sql文件如下:

 

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50611
Source Host           : localhost:3306
Source Database       : crm

Target Server Type    : MYSQL
Target Server Version : 50611
File Encoding         : 65001

Date: 2016-05-12 00:07:42
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for base_dict
-- ----------------------------
DROP TABLE IF EXISTS `base_dict`;
CREATE TABLE `base_dict` (
  `dict_id` varchar(32) NOT NULL COMMENT '数据字典id(主键)',
  `dict_type_code` varchar(10) NOT NULL COMMENT '数据字典类别代码',
  `dict_type_name` varchar(64) NOT NULL COMMENT '数据字典类别名称',
  `dict_item_name` varchar(64) NOT NULL COMMENT '数据字典项目名称',
  `dict_item_code` varchar(10) DEFAULT NULL COMMENT '数据字典项目代码(可为空)',
  `dict_sort` int(10) DEFAULT NULL COMMENT '排序字段',
  `dict_enable` char(1) NOT NULL COMMENT '1:使用 0:停用',
  `dict_memo` varchar(64) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`dict_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of base_dict
-- ----------------------------
INSERT INTO `base_dict` VALUES ('1', '001', '客户行业', '教育培训 ', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('10', '003', '公司性质', '民企', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('12', '004', '年营业额', '1-10万', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('13', '004', '年营业额', '10-20万', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('14', '004', '年营业额', '20-50万', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('15', '004', '年营业额', '50-100万', null, '4', '1', null);
INSERT INTO `base_dict` VALUES ('16', '004', '年营业额', '100-500万', null, '5', '1', null);
INSERT INTO `base_dict` VALUES ('17', '004', '年营业额', '500-1000万', null, '6', '1', null);
INSERT INTO `base_dict` VALUES ('18', '005', '客户状态', '基础客户', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('19', '005', '客户状态', '潜在客户', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('2', '001', '客户行业', '电子商务', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('20', '005', '客户状态', '成功客户', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('21', '005', '客户状态', '无效客户', null, '4', '1', null);
INSERT INTO `base_dict` VALUES ('22', '006', '客户级别', '普通客户', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('23', '006', '客户级别', 'VIP客户', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('24', '007', '商机状态', '意向客户', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('25', '007', '商机状态', '初步沟通', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('26', '007', '商机状态', '深度沟通', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('27', '007', '商机状态', '签订合同', null, '4', '1', null);
INSERT INTO `base_dict` VALUES ('3', '001', '客户行业', '对外贸易', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('30', '008', '商机类型', '新业务', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('31', '008', '商机类型', '现有业务', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('32', '009', '商机来源', '电话营销', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('33', '009', '商机来源', '网络营销', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('34', '009', '商机来源', '推广活动', null, '3', '1', null);
INSERT INTO `base_dict` VALUES ('4', '001', '客户行业', '酒店旅游', null, '4', '1', null);
INSERT INTO `base_dict` VALUES ('5', '001', '客户行业', '房地产', null, '5', '1', null);
INSERT INTO `base_dict` VALUES ('6', '002', '客户信息来源', '电话营销', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('7', '002', '客户信息来源', '网络营销', null, '2', '1', null);
INSERT INTO `base_dict` VALUES ('8', '003', '公司性质', '合资', null, '1', '1', null);
INSERT INTO `base_dict` VALUES ('9', '003', '公司性质', '国企', null, '2', '1', null);

-- ----------------------------
-- Table structure for customer
-- ----------------------------
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
  `cust_id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '客户编号(主键)',
  `cust_name` varchar(32) NOT NULL COMMENT '客户名称(公司名称)',
  `cust_user_id` bigint(32) DEFAULT NULL COMMENT '负责人id',
  `cust_create_id` bigint(32) DEFAULT NULL COMMENT '创建人id',
  `cust_source` varchar(32) DEFAULT NULL COMMENT '客户信息来源',
  `cust_industry` varchar(32) DEFAULT NULL COMMENT '客户所属行业',
  `cust_level` varchar(32) DEFAULT NULL COMMENT '客户级别',
  `cust_linkman` varchar(64) DEFAULT NULL COMMENT '联系人',
  `cust_phone` varchar(64) DEFAULT NULL COMMENT '固定电话',
  `cust_mobile` varchar(16) DEFAULT NULL COMMENT '移动电话',
  `cust_zipcode` varchar(10) DEFAULT NULL,
  `cust_address` varchar(100) DEFAULT NULL,
  `cust_createtime` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`cust_id`),
  KEY `FK_cst_customer_source` (`cust_source`),
  KEY `FK_cst_customer_industry` (`cust_industry`),
  KEY `FK_cst_customer_level` (`cust_level`),
  KEY `FK_cst_customer_user_id` (`cust_user_id`),
  KEY `FK_cst_customer_create_id` (`cust_create_id`)
) ENGINE=InnoDB AUTO_INCREMENT=162 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of customer
-- ----------------------------
INSERT INTO `customer` VALUES ('14', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:01');
INSERT INTO `customer` VALUES ('15', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:01');
INSERT INTO `customer` VALUES ('16', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:01');
INSERT INTO `customer` VALUES ('17', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:02');
INSERT INTO `customer` VALUES ('22', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:03');
INSERT INTO `customer` VALUES ('24', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:03');
INSERT INTO `customer` VALUES ('25', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:03');
INSERT INTO `customer` VALUES ('26', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:03');
INSERT INTO `customer` VALUES ('28', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:04');
INSERT INTO `customer` VALUES ('29', '令狐冲', null, null, '7', '1', '23', '任盈盈', '0108888886', '13888888886', '6123456', '北京三里桥6', '2016-04-08 16:32:04');
INSERT INTO `customer` VALUES ('30', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:04');
INSERT INTO `customer` VALUES ('31', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:04');
INSERT INTO `customer` VALUES ('33', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:04');
INSERT INTO `customer` VALUES ('34', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:05');
INSERT INTO `customer` VALUES ('35', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:05');
INSERT INTO `customer` VALUES ('36', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:05');
INSERT INTO `customer` VALUES ('37', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:05');
INSERT INTO `customer` VALUES ('38', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:05');
INSERT INTO `customer` VALUES ('39', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:06');
INSERT INTO `customer` VALUES ('40', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:06');
INSERT INTO `customer` VALUES ('41', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:06');
INSERT INTO `customer` VALUES ('42', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:06');
INSERT INTO `customer` VALUES ('43', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:06');
INSERT INTO `customer` VALUES ('44', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('45', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('46', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('47', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('48', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('49', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:07');
INSERT INTO `customer` VALUES ('50', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('51', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('52', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('53', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('54', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('55', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:08');
INSERT INTO `customer` VALUES ('56', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:09');
INSERT INTO `customer` VALUES ('57', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:09');
INSERT INTO `customer` VALUES ('58', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:09');
INSERT INTO `customer` VALUES ('59', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:29');
INSERT INTO `customer` VALUES ('60', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:29');
INSERT INTO `customer` VALUES ('61', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:29');
INSERT INTO `customer` VALUES ('62', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:29');
INSERT INTO `customer` VALUES ('63', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('64', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('65', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('66', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('67', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('68', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:30');
INSERT INTO `customer` VALUES ('69', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:31');
INSERT INTO `customer` VALUES ('70', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:31');
INSERT INTO `customer` VALUES ('71', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:31');
INSERT INTO `customer` VALUES ('72', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:31');
INSERT INTO `customer` VALUES ('73', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:31');
INSERT INTO `customer` VALUES ('74', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('75', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('76', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('77', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('78', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('79', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:32');
INSERT INTO `customer` VALUES ('80', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('81', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('82', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('83', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('84', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('85', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:33');
INSERT INTO `customer` VALUES ('86', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('87', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('88', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('89', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('90', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('91', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:34');
INSERT INTO `customer` VALUES ('92', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:35');
INSERT INTO `customer` VALUES ('93', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:35');
INSERT INTO `customer` VALUES ('94', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:35');
INSERT INTO `customer` VALUES ('95', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:35');
INSERT INTO `customer` VALUES ('96', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:35');
INSERT INTO `customer` VALUES ('97', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('98', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('99', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('100', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('101', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('102', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:36');
INSERT INTO `customer` VALUES ('103', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:37');
INSERT INTO `customer` VALUES ('104', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:37');
INSERT INTO `customer` VALUES ('105', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:37');
INSERT INTO `customer` VALUES ('106', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:37');
INSERT INTO `customer` VALUES ('107', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:37');
INSERT INTO `customer` VALUES ('108', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('109', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('110', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('111', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('112', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('113', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:38');
INSERT INTO `customer` VALUES ('114', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:39');
INSERT INTO `customer` VALUES ('115', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:39');
INSERT INTO `customer` VALUES ('116', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:39');
INSERT INTO `customer` VALUES ('117', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:39');
INSERT INTO `customer` VALUES ('118', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:39');
INSERT INTO `customer` VALUES ('119', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('120', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('121', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('122', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('123', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('124', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:40');
INSERT INTO `customer` VALUES ('125', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:41');
INSERT INTO `customer` VALUES ('126', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:41');
INSERT INTO `customer` VALUES ('127', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:41');
INSERT INTO `customer` VALUES ('128', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:41');
INSERT INTO `customer` VALUES ('129', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:41');
INSERT INTO `customer` VALUES ('130', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('131', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('132', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('133', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('134', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('135', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:42');
INSERT INTO `customer` VALUES ('136', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:43');
INSERT INTO `customer` VALUES ('137', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:43');
INSERT INTO `customer` VALUES ('138', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:43');
INSERT INTO `customer` VALUES ('139', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:43');
INSERT INTO `customer` VALUES ('140', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:43');
INSERT INTO `customer` VALUES ('141', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('142', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('143', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('144', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('145', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('146', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:44');
INSERT INTO `customer` VALUES ('147', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:45');
INSERT INTO `customer` VALUES ('148', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:45');
INSERT INTO `customer` VALUES ('149', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:45');
INSERT INTO `customer` VALUES ('150', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:45');
INSERT INTO `customer` VALUES ('151', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:45');
INSERT INTO `customer` VALUES ('152', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('153', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('154', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('155', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('156', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('157', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:46');
INSERT INTO `customer` VALUES ('158', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:47');
INSERT INTO `customer` VALUES ('159', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:47');
INSERT INTO `customer` VALUES ('160', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:47');
INSERT INTO `customer` VALUES ('161', '马云', null, null, '6', '2', '22', '马化腾', '0108888887', '13888888888', '123456', '北京三里桥', '2016-04-08 16:32:47');

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
  `user_id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `user_code` varchar(32) NOT NULL COMMENT '用户账号',
  `user_name` varchar(64) NOT NULL COMMENT '用户名称',
  `user_password` varchar(32) NOT NULL COMMENT '用户密码',
  `user_state` char(1) NOT NULL COMMENT '1:正常,0:暂停',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES ('5', 'm0003', '小军', '123', '1');
INSERT INTO `sys_user` VALUES ('6', 'm0001', '小红', '123', '1');
INSERT INTO `sys_user` VALUES ('7', 'm0001', '小明', '123', '1');
INSERT INTO `sys_user` VALUES ('8', 'm0001', '小红', '123', '1');

  

 

创建crm数据库,执行sql

 

功能如下图:

 图片 1

 

 

4.2. 页面展现难题

拜谒页面,发掘不可能寻常展现

 图片 2

 

开辟开拓者工具,选拔Network,

发觉css、js等能源文件不能够加载

 图片 3

 

 

缘由:web.xml配置时,是设置有着的伸手都踏入SpringMVC。可是SpringMVC      无法管理css、js等静态能源,所以不恐怕平常呈现

 

消除方案:

  1. 在springmvc.xml中配置

 

1 <!-- 解决静态资源无法被springMVC处理的问题 -->
2     <mvc:default-servlet-handler />

 

 

  1. 改进web.xml,让全数以action结尾的乞请都踏入SpringMVC

 

1 <servlet-mapping>
2         <servlet-name>boot-crm</servlet-name>
3         <!-- 所有的请求都进入springMVC -->
4         <url-pattern>*.action</url-pattern>
5     </servlet-mapping>

 

 

消除后的效劳如下图,能够健康展现页面样式:

 图片 4

 

 

大家采纳第三种办法缓和,因为此项目中的页面包车型客车伏乞都以以action结尾的,所以选择第二种方式,在web.xml里面实行相应的布置

   

1 <servlet-mapping>
2         <servlet-name>boot-crm</servlet-name>
3         <!-- 所有以action结尾的请求都进入springMVC -->
4         <url-pattern>*.action</url-pattern>
5     </servlet-mapping>

 

 

7.3.3. Service接口

编辑CustomerService.接口方法

/**
 * 根据id查询数据
 * 
 * @param id
 * @return
 */
Customer queryCustomerById(Long id);

 

 

 

<input type  name=itemList[${s.index}].name />

7.5.5. Controller

在CustomerController编写方法

内需科学的响应,要告知前端更新成功。重返值有没有都足以。

此间供给加@ResponseBody注脚,使其不走视图解析器。

/**
 * 根据id查询用户,返回更新后客户的json格式数据
 * 
 * @param id
 * @return
 */
@RequestMapping("update")
@ResponseBody
public String updateCustomerById(Customer customer) {
    Customer result = this.customerService.updateCustomerById(customer);
    return "OK";
}

 

 

 

1)Form  上传图片了  action上传路线

自定义优良管理类 完毕HandlerEexceptionResolver 

8.2.3. Service接口

在CustomerService编写接口方法

/**
 * 根据id删除客户
 * 
 * @param id
 */
void deleteCustomerById(Long id);

 

 

7.3.4. 瑟维斯接口兑现类

在CustomerServiceImpl完毕接口方法

@Override
public Customer queryCustomerById(Long id) {
    Customer customer = this.customerMapper.queryCustomerById(id);
    return customer;
}

SSM框架整合,以CRM为例子。 

6.3.2. Mapper

创建CustomerMapper 接口

public interface CustomerMapper {

    /**
     * 根据queryVo分页查询数据
     * 
     * @param queryVo
     * @return
     */
    List<Customer> queryCustomerByQueryVo(QueryVo queryVo);

    /**
     * 根据queryVo查询数据条数
     * 
     * @param queryVo
     * @return
     */
    int queryCountByQueryVo(QueryVo queryVo);

}

 

 

7.3.5. Controller

在CustomerController编写方法

/**
 * 根据id查询用户,返回json格式数据
 * 
 * @param id
 * @return
 */
@RequestMapping("edit")
@ResponseBody
public Customer queryCustomerById(Long id) {
    Customer customer = this.customerService.queryCustomerById(id);
    return customer;
}

 

 

7.1. 需求

页面效果如下图:

 图片 5

 

1、顾客列表中式茶食击“校勘”开关弹出客商消息改革窗,并开端化客商消息

2、点击“保存改过”按键将改革后的结果保存到数据库中

 

SSM框架整合,以CRM为例子。 

 

 

3.5.2. applicationContext-dao.xml

内需配备:

加载properties文件,数据源,SqlSessionFactory,Mapper扫描

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
 4     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
 5     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 7     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
 8     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
 9     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
10 
11     <!-- 配置 读取properties文件 jdbc.properties -->
12     <context:property-placeholder location="classpath:jdbc.properties" />
13 
14     <!-- 配置 数据源 -->
15     <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
16         <property name="driverClassName" value="${jdbc.driver}" />
17         <property name="url" value="${jdbc.url}" />
18         <property name="username" value="${jdbc.username}" />
19         <property name="password" value="${jdbc.password}" />
20     </bean>
21 
22     <!-- 配置SqlSessionFactory -->
23     <bean class="org.mybatis.spring.SqlSessionFactoryBean">
24         <!-- 设置MyBatis核心配置文件 -->
25         <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" />
26         <!-- 设置数据源 -->
27         <property name="dataSource" ref="dataSource" />
28     </bean>
29 
30     <!-- 配置Mapper扫描 -->
31     <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
32         <!-- 设置Mapper扫描包 -->
33         <property name="basePackage" value="cn.itcast.crm.mapper" />
34     </bean>
35 </beans>

 

 

<input type  name=ids />  多个

 

  1. 回顾

 

7.4. 落实编辑顾客数量

在编辑框,点击保存修正按键,应该张开数量保存,如下图所示:

 

 图片 6

 

号令号令如下图:

 图片 7

 

 

在页面找到的央浼逻辑是:

function updateCustomer() {
    $.post("<%=basePath%>customer/update.action",$("#edit_customer_form").serialize(),function(data){
        alert("客户信息更新成功!");
        window.location.reload();
    });
}

 

 

 

6.3. 实现DAO

分析:

1. 前台发起倡议,供给吸收乞请过来的查询条件数据,能够运用pojo接受数据。需求依此编写查询逻辑。

2. 前台供给分页突显,依据预备好的分页达成,应该回到分页类Page,而创设Page分页类须要多少总条数,所以也亟需查询数据总条数的逻辑。

 

基于解析,DAO供给编写制定多个章程:

  1. 急需依据准绳分页查询客商消息

  2. 供给依附准绳查询数据总条数

 

5.3.1. BaseDictService 接口

 1 public interface BaseDictService {
 2 
 3     /**
 4      * 根据类别代码查询
 5      * 
 6      * @param dictTypeCode
 7      * @return
 8      */
 9     List<BaseDict> queryBaseDictByDictTypeCode(String dictTypeCode);
10 }

 

 

 

3.5.1. SqlMapConfig.xml

空文件就可以

1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-config.dtd">
4 <configuration>
5 
6  
7 
8 </configuration>

 

 

 

3)选用此图片  形参上绑定 MultipartFile picturePic 接口

Mybatis、SpringMVC练习

7.5.3. Service接口

编纂CustomerService.接口方法

/**

 *SSM框架整合,以CRM为例子。 依据id编辑客商数据

 *

 * @param customer

 */

void updateCustomerById(Customer customer);

 

5.4. 实现Controller开发

3.   工程搭建

使用的Bootstrap前端框架,官方网站

 

工程使用Springmvc、spring、mybatis框架整合完毕。

 

 

 

拦截器 应用 (练习)

5.4.3. 硬编码难题

此处是基于dict_type_code体系代码查询数据,这里的询问条件是写死的,有硬编码难题。能够把项目代码提取到布置文件中,再选择@value注脚举办加载。

6.3.3. Mapper.xml

创建CustomerMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.itcast.crm.mapper.CustomerMapper">
    <sql id="customerQueryVo">
        <where>
            <if test="custName != null and custName != ''">
                AND a.cust_name LIKE '%${custName}%'
            </if>
            <if test="custSource != null and custSource != ''">
                AND a.cust_source = #{custSource}
            </if>
            <if test="custIndustry != null and custIndustry != ''">
                AND a.cust_industry = #{custIndustry}
            </if>
            <if test="custLevel != null and custLevel != ''">
                AND a.cust_level = #{custLevel}
            </if>
        </where>
    </sql>

    <!-- 根据queryVo分页查询数据 -->
    <select id="queryCustomerByQueryVo" parameterType="cn.itcast.crm.pojo.QueryVo"
        resultType="cn.itcast.crm.pojo.Customer">
      SELECT
        a.cust_id,
        a.cust_name,
        a.cust_user_id,
        a.cust_create_id,
        b.dict_item_name cust_source,
        c.dict_item_name cust_industry,
        d.dict_item_name cust_level,
        a.cust_linkman,
        a.cust_phone,
        a.cust_mobile,
        a.cust_zipcode,
        a.cust_address,
        a.cust_createtime
      FROM
        customer a
        LEFT JOIN base_dict b ON a.cust_source = b.dict_id
        LEFT JOIN base_dict c ON a.cust_industry = c.dict_id
        LEFT JOIN base_dict d ON a.cust_level = d.dict_id
        <include refid="customerQueryVo" />
        <if test="start != null">
            LIMIT #{start}, #{rows}
        </if>
    </select>

    <!-- 根据queryVo查询数据条数 -->
    <select id="queryCountByQueryVo" parameterType="cn.itcast.crm.pojo.QueryVo"
        resultType="int">
        SELECT count(1) FROM customer a
        <include refid="customerQueryVo" />
    </select>
</mapper>

 

3.2. 构成思路

Dao层:

1、SqlMapConfig.xml,空文件就能够,但是须要文件头。

2、applicationContext-dao.xml

a)       数据库连接Druid

b)      SqlSessionFactory对象,要求spring和mybatis整合包下的。

c)       配置mapper文件扫描器。Mapper动态代理开垦 加强版

 

Service层:

1、applicationContext-service.xml包扫描器,扫描@service表明的类。

2、applicationContext-trans.xml配置事务。

 

Controller层:

1、Springmvc.xml

a)       包扫描器,扫描@Controller申明的类。

b)      配置注脚驱动

c)       配置视图剖析器

 

Web.xml文件:

1、配置spring监听器

2、配置前端调控器。

 

方法 (Integer[] ids)  QueryVo (里面Integer[] ids)

5.4.3.3. 修改Controller方法

 1 @Controller
 2 @RequestMapping("customer")
 3 public class CustomerController {
 4 
 5     // 客户来源
 6     @Value("${CUSTOMER_FROM_TYPE}")
 7     private String CUSTOMER_FROM_TYPE;
 8     // 客户行业
 9     @Value("${CUSTOMER_INDUSTRY_TYPE}")
10     private String CUSTOMER_INDUSTRY_TYPE;
11     // 客户级别
12     @Value("${CUSTOMER_LEVEL_TYPE}")
13     private String CUSTOMER_LEVEL_TYPE;
14 
15     @Autowired
16     private BaseDictService baseDictService;
17 
18     /**
19      * 显示客户列表
20      * 
21      * @return
22      */
23     @RequestMapping("list")
24     public String queryCustomerList(Model model) {
25         // 客户来源
26         List<BaseDict> fromType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_FROM_TYPE);
27         // 所属行业
28         List<BaseDict> industryType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_INDUSTRY_TYPE);
29         // 客户级别
30         List<BaseDict> levelType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_LEVEL_TYPE);
31 
32         // 把前端页面需要显示的数据放到模型中
33         model.addAttribute("fromType", fromType);
34         model.addAttribute("industryType", industryType);
35         model.addAttribute("levelType", levelType);
36 
37         return "customer";
38     }
39 
40 }

 

3.4. 加入jar包

参与资料中的jar包

 

6.4.1. 接口

编写接口CustomerService

public interface CustomerService {
    /**
     * 根据条件分页查询客户
     * 
     * @param queryVo
     * @return
     */
    Page<Customer> queryCustomerByQueryVo(QueryVo queryVo);
}

 

 

4、 上传图片

 

 

 

8.2.4. Service实现类

在CustomerServiceImpl达成接口方法

@Override
public void deleteCustomerById(Long id) {
    this.customerMapper.deleteCustomerById(id);
}

 

 

2)input type=file  name=picturePic

采纳场景:前端是各样  html Freemarker  JSP一个Servlet 是Java代码 jstl C

 

Void    异步乞请使用

7.2. 实现编辑数据回显

在顾客列表彰显中,能够点击改正开关,弹出改良分界面,展开浏览器的开荒者工具,开采当点击改正按钮,会倡导一个乞请

正如图格局举行查看

 图片 8

 

 

拆解深入分析这里应该是提倡倡议到后台,获取该顾客的详细新闻,在页面上得以回显

 

复制央求路线中的edit.action,在customer.jsp页面中寻觅,找到央浼逻辑

找到的代码如下图:

 图片 9

 

发掘这里是一个Ajax供给,根据这些央浼大家得以付出后台逻辑,提必要前端页面进行调用

 

三个

5.1. 必要深入分析

 

页面效果如上海体育场地,在查询客商的时候,能够筛选客商来源,所属行当,客商等第新闻,页面加载时须要先导化查询条件下拉列表。

 图片 10

 

前端jsp逻辑

 1 <form class="form-inline" action="${pageContext.request.contextPath }/customer/list.action" method="get">
 2     <div class="form-group">
 3         <label for="customerName">客户名称</label> 
 4         <input type="text" class="form-control" id="customerName" value="${custName }" name="custName">
 5     </div>
 6     <div class="form-group">
 7         <label for="customerFrom">客户来源</label> 
 8         <select    class="form-control" id="customerFrom" placeholder="客户来源" name="custSource">
 9             <option value="">--请选择--</option>
10             <c:forEach items="${fromType}" var="item">
11                 <option value="${item.dict_id}"<c:if test="${item.dict_id == custSource}"> selected</c:if>>${item.dict_item_name }</option>
12             </c:forEach>
13         </select>
14     </div>
15     <div class="form-group">
16         <label for="custIndustry">所属行业</label> 
17         <select    class="form-control" id="custIndustry"  name="custIndustry">
18             <option value="">--请选择--</option>
19             <c:forEach items="${industryType}" var="item">
20                 <option value="${item.dict_id}"<c:if test="${item.dict_id == custIndustry}"> selected</c:if>>${item.dict_item_name }</option>
21             </c:forEach>
22         </select>
23     </div>
24     <div class="form-group">
25         <label for="custLevel">客户级别</label>
26         <select    class="form-control" id="custLevel" name="custLevel">
27             <option value="">--请选择--</option>
28             <c:forEach items="${levelType}" var="item">
29                 <option value="${item.dict_id}"<c:if test="${item.dict_id == custLevel}"> selected</c:if>>${item.dict_item_name }</option>
30             </c:forEach>
31         </select>
32     </div>
33     <button type="submit" class="btn btn-primary">查询</button>
34 </form>

 

 

遵从jsp的渴求,把相应的数码查询出来,放到模型中。

多少寄存在base_dict表,能够应用dict_type_code种类代码实行询问

运用需求取得的多少如下图:

 图片 11

 

 

使用的sql:

SELECT * FROM base_dict WHERE dict_type_code = '001'

 

5.2. 实现DAO开发

1   CRM项目外观

图片 12

 

8.1. 须求深入分析

点击顾客列表中的删除开关,提醒“警报消息”,如下图

 图片 13

 

 

平常来讲图,点击鲜明后去除客商新闻,并刷新页面。

 

 图片 14

 

 

倡导的央求如下图:

 图片 15

 

 

索求前端jsp页面逻辑找到如下代码:

function deleteCustomer(id) {
    if(confirm('确实要删除该客户吗?')) {
        $.post("<%=basePath%>customer/delete.action",{"id":id},function(data){
            alert("客户删除更新成功!");
            window.location.reload();
        });
    }
}

 

 

 

  1. 2.  REquestMapping 管理器映射器(找此标签  路线 )

5.2.1. pojo

因为页面展现的名字是下划线办法,和数据库表列名相像,遵照页面包车型地铁体制,编写pojo

 1 public class BaseDict {
 2     private String dict_id;
 3     private String dict_type_code;
 4     private String dict_type_name;
 5     private String dict_item_name;
 6     private String dict_item_code;
 7     private Integer dict_sort;
 8     private String dict_enable;
 9     private String dict_memo;
10 get/set方法自己实现
11 }

 

 

 

6.4. 实现service

方法(QueryVo 里面List<Items> itemList

3.3. 创制工程

创办动态web工程,步骤如下图:

 

 图片 16

 

创建boot-crm,如下图

 图片 17

 

 

 

Springmvc  高档参数绑定  数组  List

5.4.2. 效果

实现效果与利益如下图:

 图片 18

 

 

1.   开采条件

IDE:     Eclipse Mars2

Jdk:       1.7

数据库: MySQL

 

8.   删除客商

7.5. 编写制定作用完毕

7.3.2. Mapper.xml

在CustomerMapper.xml编写sql

<!-- 根据id查询用户 -->
<select id="queryCustomerById" resultType="cn.itcast.crm.pojo.Customer">
    SELECT * FROM customer WHERE cust_id = #{id}
</select>

 

 

7.5.4. Service接口兑现类

在CustomerServiceImpl达成接口方法

@Override
public void updateCustomerById(Customer customer) {
    this.customerMapper.updateCustomerById(customer);
}

 

 

 

3、 Controller方法重临值

6.2. 创建pojo开发

public class Customer {

    private Long cust_id;
    private String cust_name;
    private Long cust_user_id;
    private Long cust_create_id;
    private String cust_source;
    private String cust_industry;
    private String cust_level;
    private String cust_linkman;
    private String cust_phone;
    private String cust_mobile;
    private String cust_zipcode;
    private String cust_address;
    private Date cust_createtime;
get/set。。。。。。
}

 

 

 

 

5.4.1. 修正以前编写的controller

 1 @Controller
 2 @RequestMapping("customer")
 3 public class CustomerController {
 4 
 5     @Autowired
 6     private BaseDictService baseDictService;
 7 
 8     /**
 9      * 显示客户列表
10      * 
11      * @return
12      */
13     @RequestMapping("list")
14     public String queryCustomerList(Model model) {
15         // 客户来源
16         List<BaseDict> fromType = this.baseDictService.queryBaseDictByDictTypeCode("002");
17         // 所属行业
18         List<BaseDict> industryType = this.baseDictService.queryBaseDictByDictTypeCode("001");
19         // 客户级别
20         List<BaseDict> levelType = this.baseDictService.queryBaseDictByDictTypeCode("006");
21 
22         // 把前端页面需要显示的数据放到模型中
23         model.addAttribute("fromType", fromType);
24         model.addAttribute("industryType", industryType);
25         model.addAttribute("levelType", levelType);
26 
27         return "customer";
28     }
29 }

 

 

6.   客商列表展现

3.5.3. jdbc.properties

配备数据库新闻

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/crm?characterEncoding=utf-8
jdbc.username=root
jdbc.password=root

 

 

 

5、JSON数据交互

8.2.5. Controller

在CustomerController编写方法

/**
 * 删除用户
 * 
 * @param id
 * @return
 */
@RequestMapping("delete")
@ResponseBody
public String deleteCustomerById(Long id) {
    this.customerService.deleteCustomerById(id);
    return "ok";
}

 

不解至极

 

3.5. 加盟配置文件

创造config能源文件夹,在个中创设mybatis和spring文件夹

7.   修正顾客音信

3.5.5. applicationContext-service.xml

配置service扫描

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
 4     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
 5     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 7     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
 8     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
 9     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
10 
11     <!-- 配置Service扫描 -->
12     <context:component-scan base-package="cn.itcast.crm.service" />
13 </beans>

 

 

7.3. 回显功效完毕

String   重临视图的路子   (形参 绑定Model )    重定向redirect:另三个情势的炫酷路线  forward:内部转载

 

 

 

浏览器 Ajax  发送JSON字符串 报文 

3.5.6. applicationContext-trans.xml

布局事务管理:事务管理器、通告、切面

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
 4     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
 5     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 7     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
 8     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
 9     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
10 
11     <!-- 事务管理器 -->
12     <bean id="transactionManager"    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
13         <!-- 数据源 -->
14         <property name="dataSource" ref="dataSource" />
15     </bean>
16 
17     <!-- 通知 -->
18     <tx:advice id="txAdvice" transaction-manager="transactionManager">
19         <tx:attributes>
20             <!-- 传播行为 -->
21             <tx:method name="save*" propagation="REQUIRED" />
22             <tx:method name="insert*" propagation="REQUIRED" />
23             <tx:method name="add*" propagation="REQUIRED" />
24             <tx:method name="create*" propagation="REQUIRED" />
25             <tx:method name="delete*" propagation="REQUIRED" />
26             <tx:method name="update*" propagation="REQUIRED" />
27             <tx:method name="find*" propagation="SUPPORTS" read-only="true" />
28             <tx:method name="select*" propagation="SUPPORTS" read-only="true" />
29             <tx:method name="get*" propagation="SUPPORTS" read-only="true" />
30             <tx:method name="query*" propagation="SUPPORTS" read-only="true" />
31         </tx:attributes>
32     </tx:advice>
33 
34     <!-- 切面 -->
35     <aop:config>
36         <aop:advisor advice-ref="txAdvice"
37             pointcut="execution(* cn.itcast.crm.service.*.*(..))" />
38     </aop:config>
39 
40 </beans>

 

 

 

6.4.2. 实现类

编纂接口达成类CustomerServiceImpl

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public Page<Customer> queryCustomerByQueryVo(QueryVo queryVo) {
        // 设置查询条件,从哪一条数据开始查
        queryVo.setStart((queryVo.getPage() - 1) * queryVo.getRows());

        // 查询数据结果集
        List<Customer> list = this.customerMapper.queryCustomerByQueryVo(queryVo);
        // 查询到的数据总条数
        int total = this.customerMapper.queryCountByQueryVo(queryVo);

        // 封装返回的page对象
        Page<Customer> page = new Page<>(total, queryVo.getPage(), queryVo.getRows(), list);

        return page;
    }
}

 

 

8.2.2. Mapper.xml

在CustomerMapper.xml编写sql

<!-- 根据id删除客户 -->
<delete id="deleteCustomerById" parameterType="long">
    DELETE FROM
    customer WHERE cust_id = #{id}
</delete>

 

Method=RequestMethod.POST或GET

5.4.3.2. 校订springmvc.xml配置文件

在springmvc.xml中加载env.properties

   

1 <!-- 加载controller需要的配置信息 -->
2     <context:property-placeholder location="classpath:env.properties" />

 

 

小心:Controller供给的配置文件音讯必得增添到springmvc的配备文件中

 

 

4.1. 代码达成

编纂CustomerController 展现客商列表

 1 @Controller
 2 @RequestMapping("customer")
 3 public class CustomerController {
 4 
 5     /**
 6      * 显示用户列表
 7      * 
 8      * @return
 9      */
10     @RequestMapping("list")
11     public String queryCustomerList() {
12         return "customer";
13     }
14 
15 }

 

前端页面包车型客车少年老成体化代码,customer.jsp如下:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itheima" uri="http://itcast.cn/common/"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>客户列表-BootCRM</title>

<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="<%=basePath%>css/metisMenu.min.css" rel="stylesheet">

<!-- DataTables CSS -->
<link href="<%=basePath%>css/dataTables.bootstrap.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="<%=basePath%>css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet"
    type="text/css">
<link href="<%=basePath%>css/boot-crm.css" rel="stylesheet"
    type="text/css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="http://www.lqyuezibing.com/uploads/allimg/191026/053Q9D18-18.jpg"></script>
        <script src="http://www.lqyuezibing.com/uploads/allimg/191026/053Q91L9-19.jpg"></script>
    <![endif]-->

</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation"
            style="margin-bottom: 0">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target=".navbar-collapse">
                Toggle navigation   
            </button>
            <a class="navbar-brand" href="index.html">BOOT客户管理系统 v2.0</a>
        </div>
        <!-- /.navbar-header -->

        <ul class="nav navbar-top-links navbar-right">
            <li class="dropdown"><a class="dropdown-toggle"
                data-toggle="dropdown" href="#"> <i class="fa fa-envelope fa-fw"></i>
                    <i class="fa fa-caret-down"></i>
            </a>
                <ul class="dropdown-menu dropdown-messages">
                    <li><a href="#">
                            <div>
                                <strong>令狐冲</strong> 
                                    <em>昨天</em>

                            </div>
                            <div>今天晚上向大哥找我吃饭,讨论一下去梅庄的事...</div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a class="text-center" href="#"> <strong>查看全部消息</strong>
                            <i class="fa fa-angle-right"></i>
                    </a></li>
                </ul> <!-- /.dropdown-messages --></li>
            <!-- /.dropdown -->
            <li class="dropdown"><a class="dropdown-toggle"
                data-toggle="dropdown" href="#"> <i class="fa fa-tasks fa-fw"></i>
                    <i class="fa fa-caret-down"></i>
            </a>
                <ul class="dropdown-menu dropdown-tasks">
                    <li><a href="#">
                            <div>
                                <p>
                                    <strong>任务 1</strong> 完成40%
                                </p>
                                <div class="progress progress-striped active">
                                    <div class="progress-bar progress-bar-success"
                                        role="progressbar" aria-valuenow="40" aria-valuemin="0"
                                        aria-valuemax="100" style="width: 40%">
                                        完成40%
                                    </div>
                                </div>
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a href="#">
                            <div>
                                <p>
                                    <strong>任务 2</strong> 完成20%
                                </p>
                                <div class="progress progress-striped active">
                                    <div class="progress-bar progress-bar-info" role="progressbar"
                                        aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"
                                        style="width: 20%">
                                        完成20%
                                    </div>
                                </div>
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a class="text-center" href="#"> <strong>查看所有任务</strong>
                            <i class="fa fa-angle-right"></i>
                    </a></li>
                </ul> <!-- /.dropdown-tasks --></li>
            <!-- /.dropdown -->
            <li class="dropdown"><a class="dropdown-toggle"
                data-toggle="dropdown" href="#"> <i class="fa fa-bell fa-fw"></i>
                    <i class="fa fa-caret-down"></i>
            </a>
                <ul class="dropdown-menu dropdown-alerts">
                    <li><a href="#">
                            <div>
                                <i class="fa fa-comment fa-fw"></i> 新回复 4分钟之前
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a href="#">
                            <div>
                                <i class="fa fa-envelope fa-fw"></i> 新消息 4分钟之前
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a href="#">
                            <div>
                                <i class="fa fa-tasks fa-fw"></i> 新任务 4分钟之前
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a href="#">
                            <div>
                                <i class="fa fa-upload fa-fw"></i> 服务器重启 4分钟之前
                            </div>
                    </a></li>
                    <li class="divider"></li>
                    <li><a class="text-center" href="#"> <strong>查看所有提醒</strong>
                            <i class="fa fa-angle-right"></i>
                    </a></li>
                </ul> <!-- /.dropdown-alerts --></li>
            <!-- /.dropdown -->
            <li class="dropdown"><a class="dropdown-toggle"
                data-toggle="dropdown" href="#"> <i class="fa fa-user fa-fw"></i>
                    <i class="fa fa-caret-down"></i>
            </a>
                <ul class="dropdown-menu dropdown-user">
                    <li><a href="#"><i class="fa fa-user fa-fw"></i> 用户设置</a></li>
                    <li><a href="#"><i class="fa fa-gear fa-fw"></i> 系统设置</a></li>
                    <li class="divider"></li>
                    <li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i>
                            退出登录</a></li>
                </ul> <!-- /.dropdown-user --></li>
            <!-- /.dropdown -->
        </ul>
        <!-- /.navbar-top-links -->

        <div class="navbar-default sidebar" role="navigation">
            <div class="sidebar-nav navbar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="sidebar-search">
                        <div class="input-group custom-search-form">
                            <input type="text" class="form-control" placeholder="查询内容...">

                                <button class="btn btn-default" type="button">
                                    <i class="fa fa-search" style="padding: 3px 0 3px 0;"></i>
                                </button>

                        </div> <!-- /input-group -->
                    </li>
                    <li><a href="customer.action" class="active"><i
                            class="fa fa-edit fa-fw"></i> 客户管理</a></li>
                    <li><a href="salevisit.action"><i
                            class="fa fa-dashboard fa-fw"></i> 客户拜访</a></li>
                </ul>
            </div>
            <!-- /.sidebar-collapse -->
        </div>
        <!-- /.navbar-static-side --> </nav>

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">客户管理</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="panel panel-default">
                <div class="panel-body">
                    <form class="form-inline" action="${pageContext.request.contextPath }/customer/list.action" method="post">
                        <div class="form-group">
                            <label for="customerName">客户名称</label> 
                            <input type="text" class="form-control" id="customerName" value="${custName }" name="custName">
                        </div>
                        <div class="form-group">
                            <label for="customerFrom">客户来源</label> 
                            <select    class="form-control" id="customerFrom" placeholder="客户来源" name="custSource">
                                <option value="">--请选择--</option>
                                <c:forEach items="${fromType}" var="item">
                                    <option value="${item.dict_id}"<c:if test="${item.dict_id == custSource}"> selected</c:if>>${item.dict_item_name }</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="custIndustry">所属行业</label> 
                            <select    class="form-control" id="custIndustry"  name="custIndustry">
                                <option value="">--请选择--</option>
                                <c:forEach items="${industryType}" var="item">
                                    <option value="${item.dict_id}"<c:if test="${item.dict_id == custIndustry}"> selected</c:if>>${item.dict_item_name }</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="custLevel">客户级别</label>
                            <select    class="form-control" id="custLevel" name="custLevel">
                                <option value="">--请选择--</option>
                                <c:forEach items="${levelType}" var="item">
                                    <option value="${item.dict_id}"<c:if test="${item.dict_id == custLevel}"> selected</c:if>>${item.dict_item_name }</option>
                                </c:forEach>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-primary">查询</button>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">客户信息列表</div>
                        <!-- /.panel-heading -->
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>客户名称</th>
                                    <th>客户来源</th>
                                    <th>客户所属行业</th>
                                    <th>客户级别</th>
                                    <th>固定电话</th>
                                    <th>手机</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach items="${page.rows}" var="row">
                                    <tr>
                                        <td>${row.cust_id}</td>
                                        <td>${row.cust_name}</td>
                                        <td>${row.cust_source}</td>
                                        <td>${row.cust_industry}</td>
                                        <td>${row.cust_level}</td>
                                        <td>${row.cust_phone}</td>
                                        <td>${row.cust_mobile}</td>
                                        <td>
                                            <a href="#" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#customerEditDialog" onclick="editCustomer(${row.cust_id})">修改</a>
                                            <a href="#" class="btn btn-danger btn-xs" onclick="deleteCustomer(${row.cust_id})">删除</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>
                        <div class="col-md-12 text-right">
                            <itheima:page url="${pageContext.request.contextPath }/customer/list.action" />
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- 客户编辑对话框 -->
    <div class="modal fade" id="customerEditDialog" tabindex="-1" role="dialog"
        aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">修改客户信息</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="edit_customer_form">
                        <input type="hidden" id="edit_cust_id" name="cust_id"/>
                        <div class="form-group">
                            <label for="edit_customerName" class="col-sm-2 control-label">客户名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_customerName" placeholder="客户名称" name="cust_name">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_customerFrom" style="float:left;padding:7px 15px 0 27px;">客户来源</label> 
                            <div class="col-sm-10">
                                <select    class="form-control" id="edit_customerFrom" placeholder="客户来源" name="cust_source">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${fromType}" var="item">
                                        <option value="${item.dict_id}"<c:if test="${item.dict_id == custSource}"> selected</c:if>>${item.dict_item_name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_custIndustry" style="float:left;padding:7px 15px 0 27px;">所属行业</label>
                            <div class="col-sm-10"> 
                                <select    class="form-control" id="edit_custIndustry"  name="cust_industry">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${industryType}" var="item">
                                        <option value="${item.dict_id}"<c:if test="${item.dict_id == custIndustry}"> selected</c:if>>${item.dict_item_name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_custLevel" style="float:left;padding:7px 15px 0 27px;">客户级别</label>
                            <div class="col-sm-10">
                                <select    class="form-control" id="edit_custLevel" name="cust_level">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${levelType}" var="item">
                                        <option value="${item.dict_id}"<c:if test="${item.dict_id == custLevel}"> selected</c:if>>${item.dict_item_name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_linkMan" class="col-sm-2 control-label">联系人</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_linkMan" placeholder="联系人" name="cust_linkman">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_phone" class="col-sm-2 control-label">固定电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_phone" placeholder="固定电话" name="cust_phone">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_mobile" class="col-sm-2 control-label">移动电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_mobile" placeholder="移动电话" name="cust_mobile">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_zipcode" class="col-sm-2 control-label">邮政编码</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_zipcode" placeholder="邮政编码" name="cust_zipcode">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="edit_address" class="col-sm-2 control-label">联系地址</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="edit_address" placeholder="联系地址" name="cust_address">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="updateCustomer()">保存修改</button>
                </div>
            </div>
        </div>
    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="<%=basePath%>js/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="<%=basePath%>js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="<%=basePath%>js/metisMenu.min.js"></script>

    <!-- DataTables JavaScript -->
    <script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
    <script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="<%=basePath%>js/sb-admin-2.js"></script>

    <script type="text/javascript">
        function editCustomer(id) {
            $.ajax({
                type:"get",
                url:"<%=basePath%>customer/edit.action",
                data:{"id":id},
                success:function(data) {  
                    $("#edit_cust_id").val(data.cust_id);
                    $("#edit_customerName").val(data.cust_name);
                    $("#edit_customerFrom").val(data.cust_source)
                    $("#edit_custIndustry").val(data.cust_industry)
                    $("#edit_custLevel").val(data.cust_level)
                    $("#edit_linkMan").val(data.cust_linkman);
                    $("#edit_phone").val(data.cust_phone);
                    $("#edit_mobile").val(data.cust_mobile);
                    $("#edit_zipcode").val(data.cust_zipcode);
                    $("#edit_address").val(data.cust_address);

                }
            });
        }
        function updateCustomer() {
            $.post("<%=basePath%>customer/update.action",$("#edit_customer_form").serialize(),function(data){
                alert("客户信息更新成功!");
                window.location.reload();
            });
        }

        function deleteCustomer(id) {
            if(confirm('确实要删除该客户吗?')) {
                $.post("<%=basePath%>customer/delete.action",{"id":id},function(data){
                    alert("客户删除更新成功!");
                    window.location.reload();
                });
            }
        }
    </script>

</body>

</html>

 

 

5.2.2. Mapper

编写BaseDictMapper

 1 public interface BaseDictMapper {
 2     /**
 3      * 根据类别代码查询数据
 4      * 
 5      * @param dictTypeCode
 6      * @return
 7      */
 8     List<BaseDict> queryBaseDictByDictTypeCode(String dictTypeCode);
 9     
10 }

 

 

 

3.5.7. Springmvc.xml

布局SpringMVC表现层:Controller扫描、申明驱动、视图拆解解析器

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
 4     xmlns:context="http://www.springframework.org/schema/context"
 5     xmlns:mvc="http://www.springframework.org/schema/mvc"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 7         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
 8         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
 9     <!-- 配置Controller扫描 -->
10     <context:component-scan base-package="cn.itcast.crm.controller" />
11 
12     <!-- 配置注解驱动 -->
13     <mvc:annotation-driven />
14 
15     <!-- 配置视图解析器 -->
16     <bean    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
17         <!-- 前缀 -->
18         <property name="prefix" value="/WEB-INF/jsp/" />
19         <!-- 后缀 -->
20         <property name="suffix" value=".jsp" />
21     </bean>
22 </beans>

 

 

5.3. 实现Service开发

CustomEexception 继承Eexception 

Value = {/item/sfdsf.action}  类头上

8.2.1. Mapper接口

在CustomerMapper增多方法

/**
 * 根据id删除用户
 * 
 * @param id
 */
void deleteCustomerById(Long id);

 

 

7.5.1. Mapper接口

在CustomerMapper加多方法

/**
 * 根据id编辑客户
 * 
 * @param customer
 */
void updateCustomerById(Customer customer);

 

 

 

6.5. 实现Controller

改造Controller的方法

@RequestMapping("list")
public String queryCustomerList(QueryVo queryVo, Model model) {

    try {
        // 解决get请求乱码问题
        if (StringUtils.isNotBlank(queryVo.getCustName())) {
            queryVo.setCustName(new String(queryVo.getCustName().getBytes("ISO-8859-1"), "UTF-8"));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    // 客户来源
    List<BaseDict> fromType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_FROM_TYPE);
    // 所属行业
    List<BaseDict> industryType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_INDUSTRY_TYPE);
    // 客户级别
    List<BaseDict> levelType = this.baseDictService.queryBaseDictByDictTypeCode(this.CUSTOMER_LEVEL_TYPE);

    // 把前端页面需要显示的数据放到模型中
    model.addAttribute("fromType", fromType);
    model.addAttribute("industryType", industryType);
    model.addAttribute("levelType", levelType);

    // 分页查询数据
    Page<Customer> page = this.customerService.queryCustomerByQueryVo(queryVo);
    // 把分页查询的结果放到模型中
    model.addAttribute("page", page);

    // 数据回显
    model.addAttribute("custName", queryVo.getCustName());
    model.addAttribute("custSource", queryVo.getCustSource());
    model.addAttribute("custIndustry", queryVo.getCustIndustry());
    model.addAttribute("custLevel", queryVo.getCustLevel());

    return "customer";
}

 

 

预期、运行时

Value = {七个路子,}

 

 

6、拦截器

7.3.1. Mapper接口

在CustomerMapper增添方法

/**
 * 根据id查询客户
 * 
 * @param id
 * @return
 */
Customer queryCustomerById(Long id);

 

 

7.5.2. Mapper.xml

在CustomerMapper.xml编写sql

<select id="updateCustomerById" parameterType="cn.itcast.crm.pojo.Customer">
    UPDATE `customer`
    SET
    <if test="cust_name !=null and cust_name != ''">
        `cust_name` = #{cust_name},
    </if>
    <if test="cust_user_id !=null">
        `cust_user_id` = #{cust_user_id},
    </if>
    <if test="cust_create_id !=null">
        `cust_create_id` = #{cust_create_id},
    </if>
    <if test="cust_source !=null and cust_source != ''">
        `cust_source` = #{cust_source},
    </if>
    <if test="cust_industry !=null and cust_industry != ''">
        `cust_industry` = #{cust_industry},
    </if>
    <if test="cust_level !=null and cust_level != ''">
        `cust_level` = #{cust_level},
    </if>
    <if test="cust_linkman !=null and cust_linkman != ''">
        `cust_linkman` = #{cust_linkman},
    </if>
    <if test="cust_phone !=null and cust_phone != ''">
        `cust_phone` = #{cust_phone},
    </if>
    <if test="cust_mobile !=null and cust_mobile != ''">
        `cust_mobile` = #{cust_mobile},
    </if>
    <if test="cust_zipcode !=null and cust_zipcode != ''">
        `cust_zipcode` = #{cust_zipcode},
    </if>
    <if test="cust_address !=null and cust_address != ''">
        `cust_address` = #{cust_address},
    </if>
    `cust_createtime` = NOW()
    WHERE
    (`cust_id` = #{cust_id});
</select>

 

 

6.1. 需求

来得客商列表,並且能够依赖查询条件过滤查询结果,何况完结分页。

功效如下图:

 图片 19

 

 

页面代码:

 1 <div class="panel-heading">客户信息列表</div>
 2 <!-- /.panel-heading -->
 3 <table class="table table-bordered table-striped">
 4     <thead>
 5         <tr>
 6             <th>ID</th>
 7             <th>客户名称</th>
 8             <th>客户来源</th>
 9             <th>客户所属行业</th>
10             <th>客户级别</th>
11             <th>固定电话</th>
12             <th>手机</th>
13             <th>操作</th>
14         </tr>
15     </thead>
16     <tbody>
17         <c:forEach items="${page.rows}" var="row">
18             <tr>
19                 <td>${row.cust_id}</td>
20                 <td>${row.cust_name}</td>
21                 <td>${row.cust_source}</td>
22                 <td>${row.cust_industry}</td>
23                 <td>${row.cust_level}</td>
24                 <td>${row.cust_phone}</td>
25                 <td>${row.cust_mobile}</td>
26                 <td>
27                     <a href="#" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#customerEditDialog" onclick="editCustomer(${row.cust_id})">修改</a>
28                     <a href="#" class="btn btn-danger btn-xs" onclick="deleteCustomer(${row.cust_id})">删除</a>
29                 </td>
30             </tr>
31         </c:forEach>
32     </tbody>
33 </table>

 

 

解析我们需求根据八个标准进行查询,再次回到数据是分页对象Page

 

Sql语句:

 1 SELECT
 2     a.cust_id,
 3     a.cust_name,
 4     a.cust_user_id,
 5     a.cust_create_id,
 6     b.dict_item_name cust_source,
 7     c.dict_item_name cust_industry,
 8     d.dict_item_name cust_level,
 9     a.cust_linkman,
10     a.cust_phone,
11     a.cust_mobile,
12     a.cust_zipcode,
13     a.cust_address,
14     a.cust_createtime
15 FROM
16     customer a
17 LEFT JOIN base_dict b ON a.cust_source = b.dict_id
18 LEFT JOIN base_dict c ON a.cust_industry = c.dict_id
19 LEFT JOIN base_dict d ON a.cust_level = d.dict_id
20 WHERE
21     a.cust_name LIKE '%马%'
22 AND a.cust_source = '6'
23 AND a.cust_industry = '2'
24 AND a.cust_level = '22'
25 LIMIT 0, 10

 

 

 

8.2. 效果与利益开辟

由Spring达成化 自定义的管理类

3.1. 需要的jar包

  1. spring(包括springmvc)
  2. mybatis
  3. mybatis-spring整合包
  4. 数据库驱动
  5. 其三方连接池。
  6. Json依赖包Jackson

 

jar包地方如下图:

 图片 20

 

5.4.3.1. 添加env.properties

增添env.properties配置文件

#客户来源
CUSTOMER_FROM_TYPE=002
#客户行业
CUSTOMER_INDUSTRY_TYPE=001
#客户级别
CUSTOMER_LEVEL_TYPE=006

 

 

4.   完成页面突显

 

3.5.4. log4j.properties

安顿日志音讯

1 # Global logging configuration
2 log4j.rootLogger=DEBUG, stdout
3 # Console output...
4 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
5 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
6 log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

 

 

6.3.1. 创建QueryVo

供给编写制定QueryVo,里面富含查询条件属性和分页数据。

开创采取诉求参数的QueryVo:

public class QueryVo {

    private String custName;
    private String custSource;
    private String custIndustry;
    private String custLevel;

    // 当前页码数
    private Integer page = 1;
    // 数据库从哪一条数据开始查
    private Integer start;
    // 每页显示数据条数
    private Integer rows = 10;
get/set。。。。。。
}

 

 

 

ModelAndView  建议不行使 不解偶

 

3.6. 加盟静态财富

最终效果如下图:

 图片 21

 

NavigationTag.java代码如下:

package com.itheima.common.utils;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * 显示格式 上一页 1 2 3 4 5 下一页
 */
public class NavigationTag extends TagSupport {


    static final long serialVersionUID = 2372405317744358833L;

    /**
     * request 中用于保存Page<E> 对象的变量名,默认为“page”
     */
    private String bean = "page";

    /**
     * 分页跳转的url地址,此属性必须
     */
    private String url = null;

    /**
     * 显示页码数量
     */
    private int number = 5;

    @Override
    public int doStartTag() throws JspException {
        JspWriter writer = pageContext.getOut();
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        Page page = (Page)request.getAttribute(bean); 
        if (page == null) 
            return SKIP_BODY;
        url = resolveUrl(url, pageContext);
        try {
            //计算总页数
            int pageCount = page.getTotal() / page.getSize();
            if (page.getTotal() % page.getSize() > 0) {
                pageCount++;
            }
            writer.print("<nav><ul class="pagination">");
            //显示“上一页”按钮
            if (page.getPage() > 1) {
                String preUrl = append(url, "page", page.getPage() - 1);
                preUrl = append(preUrl, "rows", page.getSize());
                writer.print("<li><a href="" + preUrl + "">上一页</a></li>");
            } else {
                writer.print("<li class="disabled"><a href="#">上一页</a></li>");
            }
            //显示当前页码的前2页码和后两页码 
            //若1 则 1 2 3 4 5, 若2 则 1 2 3 4 5, 若3 则1 2 3 4 5,
            //若4 则 2 3 4 5 6 ,若10  则 8 9 10 11 12
            int indexPage = (page.getPage() - 2 > 0)? page.getPage() - 2 : 1;  
            for(int i=1; i <= number && indexPage <= pageCount; indexPage++, i++) {
                if(indexPage == page.getPage()) {
                    writer.print( "<li class="active"><a href="#">"+indexPage+"(current)</a></li>");
                    continue;
                }
                String pageUrl  = append(url, "page", indexPage);
                pageUrl = append(pageUrl, "rows", page.getSize());
                writer.print("<li><a href="" + pageUrl + "">"+ indexPage +"</a></li>");
            }
            //显示“下一页”按钮
            if (page.getPage() < pageCount) {
                String nextUrl  = append(url, "page", page.getPage() + 1);
                nextUrl = append(nextUrl, "rows", page.getSize());
                writer.print("<li><a href="" + nextUrl + "">下一页</a></li>");
            } else {
                writer.print("<li class="disabled"><a href="#">下一页</a></li>");
            }
            writer.print("</nav>");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return SKIP_BODY;
    }

    private String append(String url, String key, int value) {

        return append(url, key, String.valueOf(value));
    }

    /**
     * 为url 参加参数对儿
     * 
     * @param url
     * @param key
     * @param value
     * @return
     */
    private String append(String url, String key, String value) {
        if (url == null || url.trim().length() == 0) {
            return "";
        }

        if (url.indexOf("?") == -1) {
            url = url + "?" + key + "=" + value;
        } else {
            if(url.endsWith("?")) {
                url = url + key + "=" + value;
            } else {
                url = url + "&amp;" + key + "=" + value;
            }
        }

        return url;
    }

    /**
     * 为url 添加翻页请求参数
     * 
     * @param url
     * @param pageContext
     * @return
     * @throws javax.servlet.jsp.JspException
     */
    private String resolveUrl(String url, javax.servlet.jsp.PageContext pageContext) throws JspException{
        //UrlSupport.resolveUrl(url, context, pageContext)
        Map params = pageContext.getRequest().getParameterMap();
        for (Object key:params.keySet()) {
            if ("page".equals(key) || "rows".equals(key)) continue;
            Object value = params.get(key);
            if (value == null) continue;
            if (value.getClass().isArray()) {
                url = append(url, key.toString(), ((String[])value)[0]);
            } else if (value instanceof String) {
                url = append(url, key.toString(), value.toString());
            }
        }
        return url;
    }



    /**
     * @return the bean
     */
    public String getBean() {
        return bean;
    }

    /**
     * @param bean the bean to set
     */
    public void setBean(String bean) {
        this.bean = bean;
    }

    /**
     * @return the url
     */
    public String getUrl() {
        return url;
    }

    /**
     * @param url the url to set
     */
    public void setUrl(String url) {
        this.url = url;
    }

    public void setNumber(int number) {
        this.number = number;
    }

}

 

page.java代码如下:

package com.itheima.common.utils;

import java.util.List;

public class Page<T> {

    //总条数
    private int total;

    //页码数
    private int page;

    //每页多少条记录,要用它和total计算页码数,不能为空
    private int size;

    private List<T> rows;
    public int getTotal() {
        return total;
    }
    public void setTotal(int total) {
        this.total = total;
    }
    public int getPage() {
        return page;
    }
    public void setPage(int page) {
        this.page = page;
    }
    public int getSize() {
        return size;
    }
    public void setSize(int size) {
        this.size = size;
    }
    public List<T> getRows() {
        return rows;
    }
    public void setRows(List<T> rows) {
        this.rows = rows;
    }



}

 

commons.tld 代码如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
    <tlib-version>2.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>common</short-name>
    <uri>http://itcast.cn/common/</uri>
    <display-name>Common Tag</display-name>
    <description>Common Tag library</description>

    <tag>
        <name>page</name>
        <tag-class>com.itheima.common.utils.NavigationTag</tag-class>
        <body-content>JSP</body-content>
        <description>create navigation for paging</description>
        <attribute>
            <name>bean</name>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>number</name>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>url</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>
</taglib>

别的JS fonts css资料这里实际不是上传,倘诺你要的请联系本人,小编的邮箱为:450853723@qq.com

 

本文由新金沙国际手机版发布于www.6165.com,转载请注明出处:SSM框架整合,以CRM为例子

关键词:

node.js学习之路

(非原创)   目录 Nodejs的介绍 15个Nodejs应用场景 Nodejs学习路线图 1. Nodejs的介绍 Node.js的是建立在Chrome的JavaScript的运...

详细>>

利用Sharding-Jdbc实现分表

1 常规优化 你组织团队,进行了一系列的优化。 慢慢地,你的心情开始变差,因为客户和产品的抱怨越来越频繁,抱...

详细>>

python+Eclipse+pydev环境搭建

本文重点介绍使用Eclipse+pydev插件来写Python代码, 以及在Mac上配置Eclipse+Pydev 和Windows配置Eclipse+Pydev   转载: python...

详细>>

搭建基于MinGW平台的《OpenGL蓝皮书(OpenGL SuperBibe

副标题:搭建基于MinGW平台的《OpenGL超级宝典》(OpenGL蓝皮书第5版)GLTools编译环境。示例代码:Triangle.cpp @ SB5.zip 以...

详细>>