客户管理系统整体代码

实训—客户管理系统(代码)

  • 数据库

/*
SQLyog 企业版 - MySQL GUI v8.14 
MySQL - 5.5.56 : Database - boot_crm
*********************************************************************
*/


/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`boot_crm` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `boot_crm`;

/*Table structure for table `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(50) NOT NULL COMMENT '数据字典类别名称',
  `dict_item_name` varchar(50) 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(100) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`dict_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `base_dict` */

insert  into `base_dict`(`dict_id`,`dict_type_code`,`dict_type_name`,`dict_item_name`,`dict_item_code`,`dict_sort`,`dict_enable`,`dict_memo`) values ('1','001','客户行业','教育培训 ',NULL,1,'1',NULL),('10','003','公司性质','民企',NULL,3,'1',NULL),('12','004','年营业额','1-10万',NULL,1,'1',NULL),('13','004','年营业额','10-20万',NULL,2,'1',NULL),('14','004','年营业额','20-50万',NULL,3,'1',NULL);

/*Table structure for table `customer` */

DROP TABLE IF EXISTS `customer`;

CREATE TABLE `customer` (
  `cust_id` int(32) NOT NULL AUTO_INCREMENT COMMENT '客户编号(主键)',
  `cust_name` varchar(50) NOT NULL COMMENT '客户名称',
  `cust_user_id` int(32) DEFAULT NULL COMMENT '负责人id',
  `cust_create_id` int(32) DEFAULT NULL COMMENT '创建人id',
  `cust_source` varchar(50) DEFAULT NULL COMMENT '客户信息来源',
  `cust_industry` varchar(50) DEFAULT NULL COMMENT '客户所属行业',
  `cust_level` varchar(32) DEFAULT NULL COMMENT '客户级别',
  `cust_linkman` varchar(50) DEFAULT NULL COMMENT '联系人',
  `cust_phone` varchar(64) DEFAULT NULL COMMENT '固定电话',
  `cust_mobile` varchar(16) DEFAULT NULL COMMENT '移动电话',
  `cust_zipcode` varchar(10) DEFAULT NULL COMMENT '邮政编码',
  `cust_address` varchar(100) DEFAULT NULL COMMENT '联系地址',
  `cust_createtime` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`cust_id`),
  KEY `FK_customer` (`cust_source`),
  KEY `FK_customer_base_industry` (`cust_industry`)
) ENGINE=InnoDB AUTO_INCREMENT=199 DEFAULT CHARSET=utf8;

/*Data for the table `customer` */

insert  into `customer`(`cust_id`,`cust_name`,`cust_user_id`,`cust_create_id`,`cust_source`,`cust_industry`,`cust_level`,`cust_linkman`,`cust_phone`,`cust_mobile`,`cust_zipcode`,`cust_address`,`cust_createtime`) values (15,'小韩',NULL,2,'7','3','23','小雪','010-88888887','13888888888','100096','北京昌平区西三旗','2016-04-08 16:32:01'),(16,'小李',NULL,3,'6','2','22','小雪','010-88888887','13888888888','100096','北京昌平区西三旗','2016-04-08 16:32:01'),(17,'小赵',NULL,4,'6','4','23','小雪','010-88888887','13888888888','100096','北京昌平区西三旗','2016-04-08 16:32:02');

/*Table structure for table `sys_user` */

DROP TABLE IF EXISTS `sys_user`;

CREATE TABLE `sys_user` (
  `user_id` int(32) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `user_code` varchar(32) NOT NULL COMMENT '用户账号',
  `user_name` varchar(50) NOT NULL COMMENT '用户名称',
  `user_password` varchar(32) NOT NULL COMMENT '用户密码',
  `user_state` int(1) NOT NULL COMMENT '1:正常,0:暂停',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

/*Data for the table `sys_user` */

insert  into `sys_user`(`user_id`,`user_code`,`user_name`,`user_password`,`user_state`) values (1,'m0001','小韩','123',1),(2,'m0002','小雪','123',1),(3,'m0003','小石','123',1),(4,'m0004','小陈','123',1);

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

  • JDBCUtils.java类,用于连接数据库

/*
	1. 声明静态数据源成员变量
	2. 创建连接池对象
	3. 定义公有的得到数据源的方法
	4. 定义得到连接对象的方法
	5. 定义关闭资源的方法
 */
public class JDBCUtils {
    // 1.	声明静态数据源成员变量
    private static DataSource ds;

    // 2. 创建连接池对象
    static {  //静态代码段,项目第一次运行时,自动运行静态代码段的代码
        // 加载配置文件中的数据
        InputStream is = JDBCUtils.class.getClassLoader().getResourceAsStream("druid.properties");
        Properties pp = new Properties();
        try {
            pp.load(is);
            // 创建连接池,使用配置文件中的参数
            ds = DruidDataSourceFactory.createDataSource(pp);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // 3. 定义公有的得到数据源的方法
    public static DataSource getDataSource() {
        return ds;
    }

    // 4. 定义得到连接对象的方法
    public static Connection getConnection() throws SQLException {
        return ds.getConnection();
    }

    // 5.定义关闭资源的方法
    public static void close(Connection conn, Statement stmt, ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException e) {
            }
        }

        if (stmt != null) {
            try {
                stmt.close();
            } catch (SQLException e) {
            }
        }

        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
            }
        }
    }

    // 6.重载关闭方法
    public static void close(Connection conn, Statement stmt) {
        close(conn, stmt, null);
    }
}
  • druid.properties,配置德鲁伊连接池

driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/boot_crm?useUnicode=true&characterEncoding=utf-8
username=root
password=root
#初始化连接数
initialSize=5
#最大连接数
maxActive=10
#最大等待时间(毫秒)
maxWait=3000

实体类

  • User

    public class User {
        private int user_id;
        private String user_code;
        private String user_name;
        private String user_password;
        private int user_state;
    
        public int getUser_id() {
            return user_id;
        }
    
        public void setUser_id(int user_id) {
            this.user_id = user_id;
        }
    
        public String getUser_code() {
            return user_code;
        }
    
        public void setUser_code(String user_code) {
            this.user_code = user_code;
        }
    
        public String getUser_name() {
            return user_name;
        }
    
        public void setUser_name(String user_name) {
            this.user_name = user_name;
        }
    
        public String getUser_password() {
            return user_password;
        }
    
        public void setUser_password(String user_password) {
            this.user_password = user_password;
        }
    
        public int getUser_state() {
            return user_state;
        }
    
        public void setUser_state(int user_state) {
            this.user_state = user_state;
        }
    }
    
  • Customer

    public class Customer {
        private Integer cust_id;
        private String cust_name;
        private Integer cust_user_id;
        private Integer 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;
    
        public Integer getCust_id() {
            return cust_id;
        }
    
        public void setCust_id(Integer cust_id) {
            this.cust_id = cust_id;
        }
    
        public String getCust_name() {
            return cust_name;
        }
    
        public void setCust_name(String cust_name) {
            this.cust_name = cust_name;
        }
    
        public Integer getCust_user_id() {
            return cust_user_id;
        }
    
        public void setCust_user_id(Integer cust_user_id) {
            this.cust_user_id = cust_user_id;
        }
    
        public Integer getCust_create_id() {
            return cust_create_id;
        }
    
        public void setCust_create_id(Integer cust_create_id) {
            this.cust_create_id = cust_create_id;
        }
    
        public String getCust_source() {
            return cust_source;
        }
    
        public void setCust_source(String cust_source) {
            this.cust_source = cust_source;
        }
    
        public String getCust_industry() {
            return cust_industry;
        }
    
        public void setCust_industry(String cust_industry) {
            this.cust_industry = cust_industry;
        }
    
        public String getCust_level() {
            return cust_level;
        }
    
        public void setCust_level(String cust_level) {
            this.cust_level = cust_level;
        }
    
        public String getCust_linkman() {
            return cust_linkman;
        }
    
        public void setCust_linkman(String cust_linkman) {
            this.cust_linkman = cust_linkman;
        }
    
        public String getCust_phone() {
            return cust_phone;
        }
    
        public void setCust_phone(String cust_phone) {
            this.cust_phone = cust_phone;
        }
    
        public String getCust_mobile() {
            return cust_mobile;
        }
    
        public void setCust_mobile(String cust_mobile) {
            this.cust_mobile = cust_mobile;
        }
    
        public String getCust_zipcode() {
            return cust_zipcode;
        }
    
        public void setCust_zipcode(String cust_zipcode) {
            this.cust_zipcode = cust_zipcode;
        }
    
        public String getCust_address() {
            return cust_address;
        }
    
        public void setCust_address(String cust_address) {
            this.cust_address = cust_address;
        }
    
        public Date getCust_createtime() {
            return cust_createtime;
        }
    
        public void setCust_createtime(Date cust_createtime) {
            this.cust_createtime = cust_createtime;
        }
    }
    
  • Basedict

    public class Basedict {
        private String dict_id;
        private String dict_type_code;
        private String dict_type_name;
        private String dict_item_name;
        private String dict_item_code;
        private Integer dict_sort;
        private String dict_enable;
        private String dict_memo;
    
        public String getDict_id() {
            return dict_id;
        }
    
        public void setDict_id(String dict_id) {
            this.dict_id = dict_id;
        }
    
        public String getDict_type_code() {
            return dict_type_code;
        }
    
        public void setDict_type_code(String dict_type_code) {
            this.dict_type_code = dict_type_code;
        }
    
        public String getDict_type_name() {
            return dict_type_name;
        }
    
        public void setDict_type_name(String dict_type_name) {
            this.dict_type_name = dict_type_name;
        }
    
        public String getDict_item_name() {
            return dict_item_name;
        }
    
        public void setDict_item_name(String dict_item_name) {
            this.dict_item_name = dict_item_name;
        }
    
        public String getDict_item_code() {
            return dict_item_code;
        }
    
        public void setDict_item_code(String dict_item_code) {
            this.dict_item_code = dict_item_code;
        }
    
        public Integer getDict_sort() {
            return dict_sort;
        }
    
        public void setDict_sort(Integer dict_sort) {
            this.dict_sort = dict_sort;
        }
    
        public String getDict_enable() {
            return dict_enable;
        }
    
        public void setDict_enable(String dict_enable) {
            this.dict_enable = dict_enable;
        }
    
        public String getDict_memo() {
            return dict_memo;
        }
    
        public void setDict_memo(String dict_memo) {
            this.dict_memo = dict_memo;
        }
    }
    

接口

  • UserDao

    public interface UserDao {
        
        User findUser(String userCode, String password);
    
    }
    
  • CustomerDao

    public interface CustomerDao {
        List<Customer> findAll();
        List<Customer> findByCondition(String cust_name, String cust_source, String cust_industry, String cust_level);
        int delete(int id);
        int add(Customer customer);
        Customer findById(int id);
        int update(Customer customer);
    }
    
  • BasedictDao

    public interface BasedictDao {
        
        List<Basedict> find(String dict_type_code);
        
    }
    

接口实现类

  • UserDaoImpl

    public class UserDaoImpl implements UserDao {
        JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    
        @Override
        public User findUser(String userCode, String password) {
            String sql = "select * from sys_user where user_code=? and user_password=? and user_state=1";
            User user = null;
            try {
                user = template.queryForObject(sql, new BeanPropertyRowMapper<User>(User.class), userCode, password);
            } catch (DataAccessException e) {
                return null;
            }
            return user;
        }
    }
    
  • CustomerDaoImpl

    public class CustomerDaoImpl implements CustomerDao {
        JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    
        @Override
        public List<Customer> findAll() {
            String sql = "SELECT cust_id,cust_name,cust_user_id,cust_create_id,\n" +
                    "(SELECT dict_item_name FROM base_dict WHERE dict_id=cust_source) cust_source,\n" +
                    " (SELECT dict_item_name FROM base_dict WHERE dict_id=cust_industry) cust_industry,\n" +
                    " (SELECT dict_item_name FROM base_dict WHERE dict_id=cust_level) cust_level,\n" +
                    "  cust_linkman,cust_phone,cust_mobile,cust_zipcode,cust_address,cust_createtime \n" +
                    "  FROM customer";
            return template.query(sql, new BeanPropertyRowMapper<Customer>(Customer.class));
        }
    
        @Override
        public List<Customer> findByCondition(String cust_name, String cust_source, String cust_industry, String cust_level) {
            List<Object> paras = new ArrayList<>();
            String sql = "SELECT cust_id,cust_name,cust_user_id,cust_create_id,\n" +
                    "(SELECT dict_item_name FROM base_dict WHERE dict_id=cust_source) cust_source,\n" +
                    " (SELECT dict_item_name FROM base_dict WHERE dict_id=cust_industry) cust_industry,\n" +
                    " (SELECT dict_item_name FROM base_dict WHERE dict_id=cust_level) cust_level,\n" +
                    "  cust_linkman,cust_phone,cust_mobile,cust_zipcode,cust_address,cust_createtime \n" +
                    "  FROM customer where 1=1";
    
            if (cust_name != null && cust_name.length() != 0) {
                sql = sql + " and cust_name like '%' ? '%'";
                paras.add(cust_name);
            }
            if (cust_source != null && !cust_source.equals("0")) {
                sql = sql + " and cust_source = ?";
                paras.add(cust_source);
            }
            if (cust_industry != null & !cust_industry.equals("0")) {
                sql = sql + " and cust_industry = ?";
                paras.add(cust_industry);
            }
            if (cust_level != null && !cust_level.equals("0")) {
                sql = sql + " and cust_level = ?";
                paras.add(cust_level);
            }
            return template.query(sql, new BeanPropertyRowMapper<Customer>(Customer.class), paras.toArray());
        }
    
        @Override
        public int delete(int id) {
            String sql = "delete from customer where cust_id= ?";
            return template.update(sql, id);
    
        }
    
        @Override
        public int add(Customer customer) {
            String sql = "insert into customer(cust_name,cust_user_id,cust_create_id,cust_source,cust_industry,cust_level,cust_linkman,cust_phone,cust_mobile,cust_zipcode,cust_address,cust_createtime) values(?,?,?,?,?,?,?,?,?,?,?,?)";
            Object[] paras = {
                    customer.getCust_name(),
                    customer.getCust_user_id(),
                    customer.getCust_create_id(),
                    customer.getCust_source(),
                    customer.getCust_industry(),
                    customer.getCust_level(),
                    customer.getCust_linkman(),
                    customer.getCust_phone(),
                    customer.getCust_mobile(),
                    customer.getCust_zipcode(),
                    customer.getCust_address(),
                    customer.getCust_createtime()
            };
            return template.update(sql, paras);
        }
    
        @Override
        public Customer findById(int id) {
            String sql = "select * from customer where cust_id=?";
            return template.queryForObject(sql, new BeanPropertyRowMapper<Customer>(Customer.class), id);
        }
    
        @Override
        public int update(Customer customer) {
            String sql = "update customer set cust_name=?,cust_user_id=?,cust_create_id=?,cust_source=?,cust_industry=?,cust_level=?,cust_linkman=?,cust_phone=?,cust_mobile=?,cust_zipcode=?,cust_address=?,cust_createtime=? where cust_id=?";
            Object[] paras = {
                    customer.getCust_name(),
                    customer.getCust_user_id(),
                    customer.getCust_create_id(),
                    customer.getCust_source(),
                    customer.getCust_industry(),
                    customer.getCust_level(),
                    customer.getCust_linkman(),
                    customer.getCust_phone(),
                    customer.getCust_mobile(),
                    customer.getCust_zipcode(),
                    customer.getCust_address(),
                    customer.getCust_createtime(),
                    customer.getCust_id()
            };
            return template.update(sql, paras);
        }
    }
    
    
  • BasedictDaoImpl

    public class BasedictDaoImpl implements BasedictDao {
    
        JdbcTemplate template=new JdbcTemplate(JDBCUtils.getDataSource());
        @Override
        public List<Basedict> find(String dict_type_code) {
            String sql="select * from base_dict where dict_type_code=?";
            return template.query(sql,new BeanPropertyRowMapper<Basedict>(Basedict.class),dict_type_code);
        }
    }
    

servlet 类

  • UserServlet

    @WebServlet("/userServlet")
    public class UserServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doGet(request, response);
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            UserDaoImpl impl = new UserDaoImpl();
            String usercode = request.getParameter("usercode");
            String password = request.getParameter("password");
            try {
                User user = impl.findUser(usercode, password);
                if (user != null) {
                    request.getSession().setAttribute("USER", user);
                    request.setAttribute("err", "");
                    response.sendRedirect("/customerServlet?opt=findAll");
                } else {
                    request.setAttribute("err", "用户名或密码错误,请重新登录!");
                    request.getRequestDispatcher("/login.jsp").forward(request, response);
                }
            } catch (Exception e) {
                request.setAttribute("err", "发生异常,请重新登录!");
                request.getRequestDispatcher("/login.jsp").forward(request, response);
            }
        }
    }
    
  • CustomerServlet

    @WebServlet("/customerServlet")
    public class CustomerServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doGet(request, response);
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            request.setCharacterEncoding("utf-8");
    
            CustomerDaoImpl impl = new CustomerDaoImpl();
            BasedictDaoImpl baseimpl = new BasedictDaoImpl();
            String opt = request.getParameter("opt");
    
            //获取客户信息来源分类
            request.setAttribute("cust_source", baseimpl.find("002"));
            //获取客户所属行业分类
            request.setAttribute("cust_industry", baseimpl.find("001"));
            //获取客户级别分类
            request.setAttribute("cust_level", baseimpl.find("006"));
    
            if (opt.equals("findAll")) {
                List<Customer> all = impl.findAll();
                request.setAttribute("customers", all);
                request.getRequestDispatcher("/customer.jsp").forward(request, response);
            } else if (opt.equals("condition")) {
                String custName = request.getParameter("custName");
                String custSource = request.getParameter("custSource");
                String custIndustry = request.getParameter("custIndustry");
                String custLevel = request.getParameter("custLevel");
    
                List<Customer> listFindByCondition = impl.findByCondition(custName, custSource, custIndustry, custLevel);
                request.setAttribute("customers", listFindByCondition);
                request.getRequestDispatcher("/customer.jsp").forward(request, response);
            }
    
    
            if (opt.equals("delete")) {
                int i = impl.delete(Integer.valueOf(request.getParameter("id")));
                //设置response返回的格式和编码
                response.setHeader("Content-type", "text/html;charset=UTF-8");
                PrintWriter writer = response.getWriter();
                if (i > 0) {
                    writer.write("<script>alert('删除成功!!!');location='/customerServlet?opt=findAll';</script>");
                } else {
                    writer.write("<script>alert('删除失败!!!');location='/customerServlet?opt=findAll';</script>");
                }
                writer.close();
            }
    
    
            if (opt.equals("add")) {
                Customer c = new Customer();
                c.setCust_name(request.getParameter("cust_name"));
                c.setCust_source(request.getParameter("cust_source"));
                c.setCust_industry(request.getParameter("cust_industry"));
                c.setCust_level(request.getParameter("cust_level"));
                c.setCust_linkman(request.getParameter("cust_linkman"));
                c.setCust_phone(request.getParameter("cust_phone"));
                c.setCust_mobile(request.getParameter("cust_mobile"));
                c.setCust_zipcode(request.getParameter("cust_zipcode"));
                c.setCust_address(request.getParameter("cust_address"));
                User user = (User) request.getSession().getAttribute("USER");
                c.setCust_create_id(user.getUser_id());
                c.setCust_createtime(new Date());
                //设置response返回的格式和编码
                response.setHeader("Content-type", "text/html;charset=UTF-8");
                PrintWriter writer = response.getWriter();
                if (impl.add(c) > 0) {
                    writer.write("<script>alert('添加成功!!!');location='/customerServlet?opt=findAll';</script>");
                } else {
                    writer.write("<script>alert('添加失败!!!');location='/customerServlet?opt=findAll';</script>");
                }
                writer.close();
            } else if (opt.equals("findById")) {
                String id = request.getParameter("id");
                Customer customer = impl.findById(Integer.valueOf(id));
    
                //将Customer对象转换成 Json 格式字符串
                ObjectMapper mapper = new ObjectMapper();
                String custjson = mapper.writeValueAsString(customer);
    
                //ajax方式写回到jsp
                response.setContentType("application/json;charset=utf-8");
                PrintWriter writer = response.getWriter();
                writer.write(custjson);
                writer.flush();
                writer.close();
            } else if (opt.equals("update")) {
                Customer c = new Customer();
                c.setCust_id(Integer.valueOf(request.getParameter("cust_id")));
                c.setCust_name(request.getParameter("cust_name"));
                c.setCust_source(request.getParameter("cust_source"));
                c.setCust_industry(request.getParameter("cust_industry"));
                c.setCust_level(request.getParameter("cust_level"));
                c.setCust_linkman(request.getParameter("cust_linkman"));
                c.setCust_phone(request.getParameter("cust_phone"));
                c.setCust_mobile(request.getParameter("cust_mobile"));
                c.setCust_zipcode(request.getParameter("cust_zipcode"));
                c.setCust_address(request.getParameter("cust_address"));
                User user = (User) request.getSession().getAttribute("USER");
                c.setCust_create_id(user.getUser_id());
                c.setCust_createtime(new Date());
                response.setHeader("Content-type", "text/html;charset=UTF-8");
                PrintWriter writer = response.getWriter();
                if (impl.update(c) > 0) {
                    writer.write("<script>alert('修改成功!!!');location='/customerServlet?opt=findAll';</script>");
                } else {
                    writer.write("<script>alert('修改失败!!!');location='/customerServlet?opt=findAll';</script>");
                }
            }
        }
    }
    
  • exitServlet

    @WebServlet("/exitServlet")
    public class exitServlet extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doGet(request, response);
        }
    
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            HttpSession session = request.getSession();
            session.invalidate();
            response.sendRedirect("/login.jsp");
        }
    }
    

jsp 页面

  • login.jsp

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>登录页面</title>
        <link href="/css/style.css"
              type=text/css rel=stylesheet>
        <link href="/css/boot-crm.css"
              type=text/css rel=stylesheet>
        <script
                src="/js/jquery-1.11.3.min.js"></script>
        <script type="text/javascript">
            function check() {
                var usercode = $("#usercode").val();
                var password = $("#password").val();
                if (usercode == "" || password == "") {
                    $("#message").text("账号或密码不能为空");
                    return false;
                }
                return true;
            }
        </script>
    </head>
    <body leftMargin=0 topMargin=0 marginwidth="0" marginheight="0"
          background="/images/rightbg.jpg">
    <div ALIGN="center">
        <table border="0" width="1140px" cellspacing="0" cellpadding="0" id="table1">
            <tr>
                <td height="93"></td>
                <td></td>
            </tr>
            <tr>
                <td background="/images/rights1.jpg"
                    width="740" height="412">
                </td>
                <td class="login_msg" width="400" align="center">
                    <!-- margin:0px auto; 控制当前标签居中 -->
                    <fieldset style="width: auto; margin: 0px auto;">
                        <legend>
                            <font style="font-size:15px" face="宋体">
                                欢迎使用BOOT客户管理系统
                            </font>
                        </legend>
                        <span id="message" style="font-size:large;color:red">${err}</span>
    
                        <form action="/userServlet" method="post" οnsubmit="return check()">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>
                            账&nbsp;号:<input id="usercode" type="text" name="usercode"/>
                            <br/><br/>
                            密&nbsp;码:<input id="password" type="password" name="password"/>
                            <br/><br/>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <center><input type="submit" value="登录"/></center>
                        </form>
                    </fieldset>
                </td>
            </tr>
        </table>
    </div>
    </body>
    </html>
    
  • customer.jsp

    <%--
      Created by IntelliJ IDEA.
      User: Administrator
      Date: 2002/1/1 0001
      Time: 上午 2:14
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>客户管理-BootCRM</title>
        <!-- 引入css样式文件 -->
        <!-- Bootstrap Core CSS -->
        <link href="/css/bootstrap.min.css" rel="stylesheet"/>
        <!-- MetisMenu CSS -->
        <link href="/css/metisMenu.min.css" rel="stylesheet"/>
        <!-- DataTables CSS -->
        <link href="/css/dataTables.bootstrap.css" rel="stylesheet"/>
        <!-- Custom CSS -->
        <link href="/css/sb-admin-2.css" rel="stylesheet"/>
        <!-- Custom Fonts -->
        <link href="/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    
        <link href="/css/boot-crm.css" rel="stylesheet" type="text/css"/>
    
        <!-- 引入js文件 -->
        <!-- jQuery -->
        <script src="/js/jquery-1.11.3.min.js"></script>
        <!-- Bootstrap Core JavaScript -->
        <script src="/js/bootstrap.min.js"></script>
        <!-- Metis Menu Plugin JavaScript -->
        <script src="/js/metisMenu.min.js"></script>
        <!-- DataTables JavaScript -->
        <script src="/js/jquery.dataTables.min.js"></script>
        <script src="/js/dataTables.bootstrap.min.js"></script>
        <!-- Custom Theme JavaScript -->
        <script src="/js/sb-admin-2.js"></script>
        <!-- 编写js代码 -->
        <script type="text/javascript">
    
            var err = "${requestScope.error}"
            window.onload = function () {
                if (err != "") {
                    alert(err)
                }
            }
    
            function clearCustomer() {
                $("#new_customerName").val("");
                $("#new_customerFrom").val("");
                $("#new_custIndustry").val("");
                $("#new_custLevel").val("");
                $("#new_linkMan").val("");
                $("#new_phone").val("");
                $("#new_mobile").val("");
                $("#new_zipcode").val("");
                $("#new_address").val("");
            }
    
            function checkCustomerName() {
                var custName = $("#new_customerName").val();
                var cust_source = $("#new_customerFrom").val();
                var cust_industry = $("#new_custIndustry").val();
                var cust_level = $("#new_custLevel").val();
                var cust_linkman = $("#new_linkMan").val();
                var cust_phone = $("#new_phone").val();
                var cust_mobile = $("#new_mobile").val();
                var cust_zipcode = $("#new_zipcode").val();
                var cust_address = $("#new_address").val();
    
                var reg = /^\w{6,20}$/;
                var flag = reg.test(custName);
                if (!flag) {
                    alert("客户姓名必填,且6-20位");
                    return false;
                }
                if (cust_source == 0) {
                    alert("请选择客户来源");
                    return false;
                }
                if (cust_industry == 0) {
                    alert("请选择所属行业");
                    return false;
                }
                if (cust_level == 0) {
                    alert("请选择客户级别");
                    return false;
                }
                if (cust_linkman == "") {
                    alert("请输入联系人");
                    return false;
                }
                var phone = /^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,6})?$/;
                flag = phone.test(cust_phone);
                if (!flag) {
                    alert("请输入合法的固定电话号码");
                    return false;
                }
                var mobile = /^(((\+86)|(\+86-))|((86)|(86\-))|((0086)|(0086\-)))?1[3|5|7|8]\d{9}$/;
                flag = mobile.test(cust_mobile);
                if (!flag) {
                    alert("请输入合法的手机号码");
                    return false;
                }
                var zipcode = /^\d{6}$/;
                flag = zipcode.test(cust_zipcode);
                if (!flag) {
                    alert("请输入合法的邮政编码");
                    return false;
                }
                if (cust_address == "") {
                    alert("请输入联系地址");
                    return false;
                }
                return flag;
            }
    
            $(function () {
                $("#new_customer_create").click(function () {
    
                    var result = checkCustomerName();
                    if (!result) {
                        return false;
    
                    }
                    $("#new_customer_form").submit();
                });
            })
    
            function editCustomer(id) {
                $.post("/customerServlet", {opt: "findById", id: id},
                    function (data) {
                        $('#edit_cust_id').val(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);
                    }, 'json');
            }
        </script>
    </head>
    <body>
    <%
        Object user = session.getAttribute("USER");
        if (user == null) {
            response.sendRedirect("/login.jsp");
        }
    %>
    <div id="wrapper">
        <!-- 导航栏部分 -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation"
             style="margin-bottom: 0">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">BOOT客户管理系统 v2.0</a>
            </div>
            <!-- 导航栏右侧图标部分 -->
            <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> <span class="pull-right text-muted">
    								<em>昨天</em>
    							</span>
                                </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>
                <!-- 任务通知 start -->
                <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>
                                        <span class="pull-right text-muted">完成40%</span>
                                    </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%">
                                            <span class="sr-only">完成40%</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>任务 2</strong>
                                        <span class="pull-right text-muted">完成20%</span>
                                    </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%">
                                            <span class="sr-only">完成20%</span>
                                        </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>
                </li>
                <!-- 任务通知 end -->
                <!-- 消息通知 start -->
                <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> 新回复
                                    <span class="pull-right text-muted small">4分钟之前</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-envelope fa-fw"></i> 新消息
                                    <span class="pull-right text-muted small">4分钟之前</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-tasks fa-fw"></i> 新任务
                                    <span class="pull-right text-muted small">4分钟之前</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-upload fa-fw"></i> 服务器重启
                                    <span class="pull-right text-muted small">4分钟之前</span>
                                </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>
                <!-- 消息通知 end -->
                <!-- 用户信息和系统设置 start -->
                <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>
                            用户:${sessionScope.USER.user_name}
                        </a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> 系统设置</a></li>
                        <li class="divider"></li>
                        <li>
                            <a href="/exitServlet" οnclick="return confirm('确定要退出吗?')">
                                <i class="fa fa-sign-out fa-fw"></i>退出登录
                            </a>
                        </li>
                    </ul>
                </li>
                <!-- 用户信息和系统设置结束 -->
            </ul>
            <!-- 左侧显示列表部分 start-->
            <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="查询内容...">
                                <span class="input-group-btn">
    							<button class="btn btn-default" type="button">
    								<i class="fa fa-search" style="padding: 3px 0 3px 0;"></i>
    							</button>
    						</span>
                            </div> <!-- /input-group -->
                        </li>
                        <li>
                            <a href="#" class="active">
                                <i class="fa fa-edit fa-fw"></i> 客户管理
                            </a>
                        </li>
                        <li>
                            <a href="#">
                                <i class="fa fa-dashboard fa-fw"></i> 客户拜访
                            </a>
                        </li>
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- 左侧显示列表部分 end-->
        </nav>
        <!-- 客户列表查询部分  start-->
        <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" method="post"
                          action="/customerServlet?opt=condition">
                        <div class="form-group">
                            <label for="customerName">客户名称</label>
                            <input type="text" class="form-control" id="customerName"
                                   value="${param.custName}" name="custName"/>
                        </div>
                        <div class="form-group">
                            <label for="customerFrom">客户来源</label>
                            <select class="form-control" id="customerFrom"
                                    name="custSource">
                                <option value="0" itemid="please">--请选择--</option>
                                <c:forEach items="${requestScope.cust_source}" var="source">
                                    <option value="${source.dict_id}" ${param.custSource==source.dict_id?"selected":""}>${source.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="0">--请选择--</option>
                                <c:forEach items="${requestScope.cust_industry}" var="industry">
                                    <option value="${industry.dict_id}" ${param.custIndustry==industry.dict_id?"selected":""}>${industry.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="0">--请选择--</option>
                                <c:forEach items="${requestScope.cust_level}" var="level">
                                    <option value="${level.dict_id}" ${param.custLevel==level.dict_id?"selected":""}>${level.dict_item_name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-primary">查询</button>
                    </form>
                </div>
            </div>
            <a href="#" class="btn btn-primary" data-toggle="modal"
               data-target="#newCustomerDialog" οnclick="clearCustomer()">新建</a>
            <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>编号</th>
                                <th>客户名称</th>
                                <th>客户来源</th>
                                <th>客户所属行业</th>
                                <th>客户级别</th>
                                <th>固定电话</th>
                                <th>手机</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${requestScope.customers}" var="cus">
                                <tr>
                                    <td>${cus.cust_id}</td>
                                    <td>${cus.cust_name}</td>
                                    <td>${cus.cust_source}</td>
                                    <td>${cus.cust_industry}</td>
                                    <td>${cus.cust_level}</td>
                                    <td>${cus.cust_phone}</td>
                                    <td>${cus.cust_mobile}</td>
                                    <td>
                                        <a href="#" class="btn btn-primary btn-xs" data-toggle="modal"
                                           data-target="#customerEditDialog" οnclick="editCustomer(${cus.cust_id})">修改</a>
                                        <a href="#" class="btn btn-danger btn-xs"
                                           οnclick="confirm('确实要删除吗?')?location='/customerServlet?opt=delete&id=${cus.cust_id}':''">删除</a>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                        <%--<script type="text/javascript">--%>
                        <%--var err="${requestScope.error}"--%>
                        <%--window.οnlοad=function (){--%>
                        <%--if(err!=""){--%>
                        <%--alert(err)--%>
                        <%--}--%>
                        <%--}--%>
                        <%--function del(cust_id) {--%>
                        <%--if(confirm("确实要删除吗?")){--%>
                        <%--location='/customerServlet?opt=delete&cust_id='+cust_id;--%>
                        <%--}--%>
                        <%--}--%>
                        <%--</script>--%>
                        <!--分页显示 -->
                        <div class="col-md-12 text-right">
    
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
        </div>
        <!-- 客户列表查询部分  end-->
    </div>
    <!-- 创建客户模态框 -->
    <div class="modal fade" id="newCustomerDialog" 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">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">新建客户信息</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="new_customer_form" method="post" action="/customerServlet?opt=add">
                        <div class="form-group">
                            <label for="new_customerName" class="col-sm-2 control-label">
                                客户名称
                            </label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_customerName" placeholder="客户名称"
                                       name="cust_name" value="${param.cust_name}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_customerFrom" style="float:left;padding:7px 15px 0 27px;">客户来源</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="new_customerFrom" name="cust_source">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${requestScope.cust_source}" var="source">
                                        <option value="${source.dict_id}">${source.dict_item_name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_custIndustry" style="float:left;padding:7px 15px 0 27px;">所属行业</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="new_custIndustry" name="cust_industry">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${requestScope.cust_industry}" var="industry">
                                        <option value="${industry.dict_id}">${industry.dict_item_name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_custLevel" style="float:left;padding:7px 15px 0 27px;">客户级别</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="new_custLevel" name="cust_level">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${requestScope.cust_level}" var="level">
                                        <option value="${level.dict_id}">${level.dict_item_name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_linkMan" class="col-sm-2 control-label">联系人</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_linkMan" placeholder="联系人"
                                       name="cust_linkman" value="${param.cust_linkman}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_phone" class="col-sm-2 control-label">固定电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_phone" placeholder="固定电话" name="cust_phone"
                                       value="${param.cust_phone}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_mobile" class="col-sm-2 control-label">移动电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_mobile" placeholder="移动电话"
                                       name="cust_mobile" value="${param.cust_mobile}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_zipcode" class="col-sm-2 control-label">邮政编码</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_zipcode" placeholder="邮政编码"
                                       name="cust_zipcode" value="${param.cust_zipcode}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_address" class="col-sm-2 control-label">联系地址</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="new_address" placeholder="联系地址"
                                       name="cust_address" value="${param.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" id="new_customer_create" οnclick="">创建客户</button>
                </div>
            </div>
        </div>
    </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">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">修改客户信息</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="edit_customer_form" method="post"
                          action="/customerServlet?opt=update">
                        <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" name="cust_source">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${requestScope.cust_source}" var="source">
                                        <option value="${source.dict_id}" ${param.custSource==source.dict_id?"selected":""}>${source.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="${requestScope.cust_industry}" var="industry">
                                        <option value="${industry.dict_id}" ${param.custIndustry==industry.dict_id?"selected":""}>${industry.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="${requestScope.cust_level}" var="level">
                                        <option value="${level.dict_id}" ${param.custLevel==level.dict_id?"selected":""}>${level.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" οnclick="$('#edit_customer_form').submit()">保存修改</button>
                </div>
            </div>
        </div>
    </div>
    </body>
    </html>
    
    
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值