栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

CRM —— 1、搭建开发环境

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CRM —— 1、搭建开发环境

目录

1、创建数据表

1.1、创建数据库

1.2、创建数据表

tbl_user.sql

dictionary.sql

crm-3_市场活动.sql

crm-4_线索_客户_联系人_交易.sql

2、搭建开发环境

2.1、创建一个空项目,设置 JDK 为 1.8

2.2、创建 Maven 模块

 2.3、添加依赖

2.3.1、mysql驱动

2.3.2、JDBC数据库连接池:Druid

2.3.3、MyBatis框架依赖

2.3.4、Spring相关依赖

2.3.5、SpringAOP依赖

2.3.6、MyBatis 与 Spring 整合依赖

2.3.7、添加项目对 JSP 的支持

2.3.8、JackSon 插件依赖

2.3.9、poi 依赖

2.3.10、fileupload 依赖

2.3.11、log4j 依赖

3、添加各种配置

3.1、MyBatis 配置

3.2、配置数据连接和事务

3.3、springmvc 配置

3.4、spring 总配置文件

3.5、web.xml配置

3.6、设置maven对配置文件的编译选项

4、添加页面及静态资源

 5、在 IDEA 添加 运行/调试配置


1、创建数据表

1.1、创建数据库

1.2、创建数据表

这里使用执行 SQL 脚本来导入数据表,各个脚本的 sql 语句如下

tbl_user.sql

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `tbl_user`
-- ----------------------------
DROP TABLE IF EXISTS `tbl_user`;
CREATE TABLE `tbl_user` (
  `id` char(32) NOT NULL COMMENT 'uuidrn            ',
  `login_act` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `login_pwd` varchar(255) DEFAULT NULL COMMENT '密码不能采用明文存储,采用密文,MD5加密之后的数据',
  `email` varchar(255) DEFAULT NULL,
  `expire_time` char(19) DEFAULT NULL COMMENT '失效时间为空的时候表示永不失效,失效时间为2018-10-10 10:10:10,则表示在该时间之前该账户可用。',
  `lock_state` char(1) DEFAULT NULL COMMENT '锁定状态为空时表示启用,为0时表示锁定,为1时表示启用。',
  `deptno` char(4) DEFAULT NULL,
  `allow_ips` varchar(255) DEFAULT NULL COMMENT '允许访问的IP为空时表示IP地址永不受限,允许访问的IP可以是一个,也可以是多个,当多个IP地址的时候,采用半角逗号分隔。允许IP是192.168.100.2,表示该用户只能在IP地址为192.168.100.2的机器上使用。',
  `createTime` char(19) DEFAULT NULL,
  `create_by` varchar(255) DEFAULT NULL,
  `edit_time` char(19) DEFAULT NULL,
  `edit_by` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of tbl_user
-- ----------------------------
INSERT INTO `tbl_user` VALUES ('06f5fc056eac41558a964f96daa7f27c', 'ls', '李四', 'yf123', 'ls@163.com', '2018-11-27 21:50:05', '1', 'A001', '192.168.1.1,0:0:0:0:0:0:0:1', '2018-11-22 12:11:40', '李四', null, null);
INSERT INTO `tbl_user` VALUES ('40f6cdea0bd34aceb77492a1656d9fb3', 'zs', '张三', 'yf123', 'zs@qq.com', '2018-11-30 23:50:55', '1', 'A001', '192.168.1.1,192.168.1.2,127.0.0.1,0:0:0:0:0:0:0:1', '2018-11-22 11:37:34', '张三', null, null);

dictionary.sql





drop table if exists tbl_dic_type;

drop table if exists tbl_dic_value;




create table tbl_dic_type
(
   code                 varchar(255) not null comment '编码是主键,不能为空,不能含有中文。',
   name                 varchar(255),
   description          varchar(255),
   primary key (code)
);




create table tbl_dic_value
(
   id                   char(32) not null comment '主键,采用UUID',
   value                varchar(255) comment '不能为空,并且要求同一个字典类型下字典值不能重复,具有唯一性。',
   text                 varchar(255) comment '可以为空',
   order_no             varchar(255) comment '可以为空,但不为空的时候,要求必须是正整数',
   type_code            varchar(255) comment '外键',
   primary key (id)
);

crm-3_市场活动.sql
drop table if exists tbl_activity;

drop table if exists tbl_activity_remark;




create table tbl_activity
(
   id                   char(32) not null,
   owner                char(32),
   name                 varchar(255),
   start_date            char(10),
   end_date              char(10),
   cost                 varchar(255),
   description          varchar(255),
   create_time           char(19),
   create_by             varchar(255),
   edit_time             char(19),
   edit_by               varchar(255),
   primary key (id)
);




create table tbl_activity_remark
(
   id                   char(32) not null,
   note_content          varchar(255),
   create_time           char(19),
   create_by             varchar(255),
   edit_time             char(19),
   edit_by               varchar(255),
   edit_flag             char(1) comment '0表示未修改,1表示已修改',
   activity_id           char(32),
   primary key (id)
);

crm-4_线索_客户_联系人_交易.sql
drop table if exists tbl_clue;

drop table if exists tbl_clue_activity_relation;

drop table if exists tbl_clue_remark;

drop table if exists tbl_contacts;

drop table if exists tbl_contacts_activity_relation;

drop table if exists tbl_contacts_remark;

drop table if exists tbl_customer;

drop table if exists tbl_customer_remark;

drop table if exists tbl_tran;

drop table if exists tbl_tran_history;

drop table if exists tbl_tran_remark;




create table tbl_clue
(
   id                   char(32) not null,
   fullname             varchar(255),
   appellation          varchar(255),
   owner                char(32),
   company              varchar(255),
   job                  varchar(255),
   email                varchar(255),
   phone                varchar(255),
   website              varchar(255),
   mphone               varchar(255),
   state                varchar(255),
   source               varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   description          varchar(255),
   contact_summary       varchar(255),
   next_contact_time      char(10),
   address              varchar(255),
   primary key (id)
);




create table tbl_clue_activity_relation
(
   id                   char(32) not null,
   clue_id               char(32),
   activity_id           char(32),
   primary key (id)
);




create table tbl_clue_remark
(
   id                   char(32) not null,
   note_content          varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   edit_flag             char(1),
   clue_id               char(32),
   primary key (id)
);




create table tbl_contacts
(
   id                   char(32) not null,
   owner                char(32),
   source               varchar(255),
   customer_id           char(32),
   fullname             varchar(255),
   appellation          varchar(255),
   email                varchar(255),
   mphone               varchar(255),
   job                  varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   description          varchar(255),
   contact_summary       varchar(255),
   next_contact_time      char(10),
   address              varchar(255),
   primary key (id)
);




create table tbl_contacts_activity_relation
(
   id                   char(32) not null,
   contacts_id           char(32),
   activity_id           char(32),
   primary key (id)
);




create table tbl_contacts_remark
(
   id                   char(32) not null,
   note_content          varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   edit_flag             char(1),
   contacts_id           char(32),
   primary key (id)
);




create table tbl_customer
(
   id                   char(32) not null,
   owner                char(32),
   name                 varchar(255),
   website              varchar(255),
   phone                varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   contact_summary       varchar(255),
   next_contact_time      char(10),
   description          varchar(255),
   address              varchar(255),
   primary key (id)
);




create table tbl_customer_remark
(
   id                   char(32) not null,
   note_content          varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   edit_flag             char(1),
   customer_id           char(32),
   primary key (id)
);




create table tbl_tran
(
   id                   char(32) not null,
   owner                char(32),
   money                varchar(255),
   name                 varchar(255),
   expected_date         char(10),
   customer_id           char(32),
   stage                varchar(255),
   type                 varchar(255),
   source               varchar(255),
   activity_id           char(32),
   contacts_id           char(32),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   description          varchar(255),
   contact_summary       varchar(255),
   next_contact_time      char(10),
   primary key (id)
);




create table tbl_tran_history
(
   id                   char(32) not null,
   stage                varchar(255),
   money                varchar(255),
   expected_date         char(10),
   create_time           char(19),
   create_by             varchar(255),
   tran_id               char(32),
   primary key (id)
);




create table tbl_tran_remark
(
   id                   char(32) not null,
   note_content          varchar(255),
   create_by             varchar(255),
   create_time           char(19),
   edit_by               varchar(255),
   edit_time             char(19),
   edit_flag             char(1),
   tran_id               char(32),
   primary key (id)
);

2、搭建开发环境

2.1、创建一个空项目,设置 JDK 为 1.8

创建 Empty Project,作为项目的工作空间,设置 JDK 为 1.8

2.2、创建 Maven 模块

创建 Maven 模块,从原型创建即可

 创建完后补全目录结构

 2.3、添加依赖

2.3.1、mysql驱动
        
        
            mysql
            mysql-connector-java
            5.1.43
        

2.3.2、JDBC数据库连接池:Druid
        
        
            com.alibaba
            druid
            1.1.1
        

2.3.3、MyBatis框架依赖
        
        
            org.mybatis
            mybatis
            3.4.1
        

2.3.4、Spring相关依赖
        
        
            org.springframework
            spring-context
            4.3.9.RELEASE
        
        
            org.springframework
            spring-aop
            4.3.9.RELEASE
        
        
            org.springframework
            spring-core
            4.3.9.RELEASE
        
        
            org.springframework
            spring-beans
            4.3.9.RELEASE
        
        
            org.springframework
            spring-jdbc
            4.3.9.RELEASE
        
        
            org.springframework
            spring-tx
            4.3.9.RELEASE
        
        
            org.springframework
            spring-web
            4.3.9.RELEASE
        
        
            org.springframework
            spring-webmvc
            4.3.9.RELEASE
        
        
            org.springframework
            spring-oxm
            4.3.9.RELEASE
        

2.3.5、SpringAOP依赖
        
        
            org.aspectj
            aspectjweaver
            1.8.9
        

2.3.6、MyBatis 与 Spring 整合依赖
        
        
            org.mybatis
            mybatis-spring
            1.3.0
        

2.3.7、添加项目对 JSP 的支持
        
        
            javax.servlet
            javax.servlet-api
            3.1.0
        
        
            javax.servlet.jsp.jstl
            jstl-api
            1.2
        
        
            org.apache.taglibs
            taglibs-standard-spec
            1.2.1
        
        
            org.apache.taglibs
            taglibs-standard-impl
            1.2.1
        

2.3.8、JackSon 插件依赖
        
        
            com.fasterxml.jackson.core
            jackson-core
            2.7.3
        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.7.3
        
        
            com.fasterxml.jackson.core
            jackson-annotations
            2.7.3
        

2.3.9、poi 依赖
        
        
            org.apache.poi
            poi
            3.15
        

2.3.10、fileupload 依赖
        
        
            commons-fileupload
            commons-fileupload
            1.3.1
        

2.3.11、log4j 依赖
        
        
            org.apache.logging.log4j
            log4j-api
            2.3
        
        
            org.apache.logging.log4j
            log4j-core
            2.3
        
        
            org.apache.logging.log4j
            log4j-jcl
            2.3
        

3、添加各种配置

3.1、MyBatis 配置

mybatis-config.xml





    

    
        
    
    
        
    

3.2、配置数据连接和事务

applicationContext-datasource.xml 



    
    
        
        
        
        
    
    
    
        
        
        
        
    
    
    
        
        
    

    
    
        
    
    
    
        
        
    
    
        
            
            
            
            
            
            
            
        
    


3.3、springmvc 配置

applicationContext-mvc.xml



    
    
    
    
    
    
    
    
        
        
        
        
    
    
    

3.4、spring 总配置文件

applicationContext.xml



    
    
    
    
    

3.5、web.xml配置


    dataservice application
    
    
        contextConfigLocation
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
    
        encodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        encodingFilter
        *.xml
                
            
            
                src/main/resources
                
                    **/*.*
                
            
        

4、添加页面及静态资源

如下图添加页面及静态资源

 5、在 IDEA 添加 运行/调试配置

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/782370.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号