博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SSM综合练习crm
阅读量:4677 次
发布时间:2019-06-09

本文共 15229 字,大约阅读时间需要 50 分钟。

一、环境配置

web.xml

crm32
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
contextConfigLocation
classpath:applicationContext-*.xml
org.springframework.web.context.ContextLoaderListener
encoding
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
encoding
/*
boot-crm
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc.xml
1
boot-crm
/

sqlMapConfig.xml

applicationConfig-dao.xml

applicationContext-service.xml

springmvc.xml

 

二、pojo

BaseDict

package com.itheima.crm.pojo;import java.io.Serializable;public class BaseDict implements Serializable{		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;	}	@Override	public String toString() {		return "BaseDict [dict_id=" + dict_id + ", dict_type_code=" + dict_type_code + ", dict_type_name="				+ dict_type_name + ", dict_item_name=" + dict_item_name + ", dict_item_code=" + dict_item_code				+ ", dict_sort=" + dict_sort + ", dict_enable=" + dict_enable + ", dict_memo=" + dict_memo + "]";	}}

Customer

package com.itheima.crm.pojo;import java.util.Date;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;	public Long getCust_id() {		return cust_id;	}	public void setCust_id(Long 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 Long getCust_user_id() {		return cust_user_id;	}	public void setCust_user_id(Long cust_user_id) {		this.cust_user_id = cust_user_id;	}	public Long getCust_create_id() {		return cust_create_id;	}	public void setCust_create_id(Long 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;	}		}

QueryVo

package com.itheima.crm.pojo;public class QueryVo {	//客户名称	private String custName;	//客户来源	private String custSource;	//所属行业	private String custIndustry;	//客户级别	private String custLevel;	//当前页	private Integer page;	//每页数	private Integer size;	//开始行	private Integer startRow = 0;		public Integer getStartRow() {		return startRow;	}	public void setStartRow(Integer startRow) {		this.startRow = startRow;	}	public String getCustName() {		return custName;	}	public void setCustName(String custName) {		this.custName = custName;	}	public String getCustSource() {		return custSource;	}	public void setCustSource(String custSource) {		this.custSource = custSource;	}	public String getCustIndustry() {		return custIndustry;	}	public void setCustIndustry(String custIndustry) {		this.custIndustry = custIndustry;	}	public String getCustLevel() {		return custLevel;	}	public void setCustLevel(String custLevel) {		this.custLevel = custLevel;	}	public Integer getPage() {		return page;	}	public void setPage(Integer page) {		this.page = page;	}	public Integer getSize() {		return size;	}	public void setSize(Integer size) {		this.size = size;	}	}

 

三、Controller

CustomerController

package com.itheima.crm.controller;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Value;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.itheima.common.utils.Page;import com.itheima.crm.pojo.BaseDict;import com.itheima.crm.pojo.Customer;import com.itheima.crm.pojo.QueryVo;import com.itheima.crm.service.BaseDictService;import com.itheima.crm.service.CustomerService;/** * 客户管理 * @author mjl * */@Controllerpublic class CustomerController {		@Autowired	private BaseDictService baseDictService;	@Autowired	private CustomerService customerService;		//入口   字典查询	@RequestMapping(value="/customer/list")	public String list(QueryVo vo,Model model){		System.out.println("enter");				//客户来源		List
fromType = baseDictService.selectBaseDictListByCode("002"); //所属行业 List
industryType = baseDictService.selectBaseDictListByCode("001"); //客户级别 List
levelType = baseDictService.selectBaseDictListByCode("006"); model.addAttribute("fromType", fromType); model.addAttribute("industryType", industryType); model.addAttribute("levelType", levelType); //通过四个条件,查询分页对象 Page
page = customerService.selectPageByQueryVo(vo); model.addAttribute("page",page); model.addAttribute("custName", vo.getCustName()); model.addAttribute("custSource", vo.getCustSource()); model.addAttribute("custIndustry", vo.getCustIndustry()); model.addAttribute("custLevel", vo.getCustLevel()); return "customer"; } //去修改页面 @RequestMapping(value="customer/edit.action") public @ResponseBody Customer edit(Integer id){ return customerService.selectCustomerById(id); } //修改保存 @RequestMapping(value="customer/update.action") public @ResponseBody String update(Customer customer){ //修改 customerService.updateCustomerById(customer); return "OK"; } //删除 @RequestMapping(value="customer/delete.action") public @ResponseBody String delete(Integer id){ //删除 customerService.delete(id); return "OK"; }}

  

四、Service

BaseDictServiceImpl

package com.itheima.crm.service;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import com.itheima.crm.mapper.BaseDictDao;import com.itheima.crm.pojo.BaseDict;@Servicepublic class BaseDictServiceImpl implements BaseDictService{		@Autowired	private BaseDictDao baseDictDao;	@Override	public List
selectBaseDictListByCode(String code) { return baseDictDao.selectBaseDictListByCode(code); } }

CustomerServiceImpl

package com.itheima.crm.service;import com.itheima.common.utils.Page;import com.itheima.crm.pojo.Customer;import com.itheima.crm.pojo.QueryVo;public interface CustomerService {	public Page
selectPageByQueryVo(QueryVo vo); //通过一个Id查询客户 public Customer selectCustomerById(Integer id); //通过Id修改客户 public void updateCustomerById(Customer customer); //通过Id删除客户 public void delete(Integer id);}

 

五、Mapper

BaseDictDao

package com.itheima.crm.mapper;import java.util.List;import com.itheima.crm.pojo.BaseDict;public interface BaseDictDao {	//查询	public List
selectBaseDictListByCode(String code); }

BaseDictDao.xml

CustomerDao

package com.itheima.crm.mapper;import java.util.List;import com.itheima.crm.pojo.BaseDict;import com.itheima.crm.pojo.Customer;import com.itheima.crm.pojo.QueryVo;public interface CustomerDao {	//查询总条数	public Integer customerCount(QueryVo vo);		//查询结果集	public List
selectCustomerListByQueryVo(QueryVo vo); //通过一个Id查询客户 public Customer selectCustomerById(Integer id); //通过Id修改客户 public void updateCustomerById(Customer customer); //通过Id删除客户 public void delete(Integer id); }

CustomerDao.xml

update customer
cust_name = #{cust_name},
cust_linkman = #{cust_linkman},
cust_id = #{cust_id}
delete from customer
cust_id = #{id}

 

六、jsp

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="itcast" uri="http://itcast.cn/common/"%> <%	String path = request.getContextPath();	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()			+ path + "/";%>
客户列表-BootCRM

客户管理

客户信息列表
ID 客户名称 客户来源 客户所属行业 客户级别 固定电话 手机 操作
${row.cust_id} ${row.cust_name} ${row.cust_source} ${row.cust_industry} ${row.cust_level} ${row.cust_phone} ${row.cust_mobile} 修改 删除

  

  

  

  

 

 

  

  

  

  

转载于:https://www.cnblogs.com/syj1993/p/9935789.html

你可能感兴趣的文章
git + git flow 的简单介绍
查看>>
如果我们想要交换两个数字,就可以使用位运算
查看>>
求给出第 K个 N位二进制数,该二进制数不得有相邻的“1”
查看>>
P1059 明明的随机数【去重排序】
查看>>
HDU 1060 Leftmost Digit【log10/求N^N的最高位数字是多少】
查看>>
tomcat配置文件web.xml与server.xml解析--重要
查看>>
【C语言】《C Primer Plus》递归:以二进制形式输出整数
查看>>
使用框架的——好处
查看>>
如此大量的代码,但每个类里面的代码却不显得特别多,原因。。。。。。。。。。。。...
查看>>
C#特征备忘
查看>>
Java 面向对象 之 final 关键字
查看>>
Contact Form 7邮件发送失败的解决办法
查看>>
P1800 software_NOI导刊2010提高(06)
查看>>
Python学习日记(1)使用if __name__ == "main"
查看>>
二进制的最大公约数
查看>>
Mybatis学习笔记(一) 之框架原理
查看>>
ABSTRACT的方法是否可同时是STATIC,是否可同时是NATIVE,是否可同时是SYNCHRONIZED?
查看>>
【SPL标准库专题(10)】SPL Exceptions
查看>>
《Python从入门基础到实践》
查看>>
【读入优化】
查看>>