客户关系管理系统

 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="it" uri="http://it.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} 修改 删除

CustomerController.java

package cn.it.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.RequestMapping;

import cn.itcast.utils.Page;
import cn.it.pojo.BaseDict;
import cn.it.pojo.Customer;
import cn.it.pojo.QueryVo;
import cn.it.service.CustomerService;

@Controller
@RequestMapping("/customer")
public class CustomerController {

	@Autowired
	private CustomerService  customerService;
	
	@Value("${customer.dict.source}")
	private String source;
	
	@Value("${customer.dict.industry}")
	private String industry;
	
	@Value("${customer.dict.level}")
	private String level;
	
	
	@RequestMapping("/list")
	public String list(QueryVo vo,Model model) throws Exception{
		
        List sourceList = customerService.findDictByCode(source);
       
        List industryList = customerService.findDictByCode(industry);
       
        List levelList = customerService.findDictByCode(level);
        
        model.addAttribute("fromType", sourceList);
        model.addAttribute("industryType", industryList );
        model.addAttribute("levelType", levelList);
        
        if(vo.getCustName() !=null){
        	vo.setCustName(new String(vo.getCustName().getBytes("iso8859-1"),"utf-8"));
        	
        }
        if(vo.getPage() == null){
        	vo.setPage(1);
        	
        }
        vo.setStart((vo.getPage() - 1) * vo.getSize());
       
        
        List resutList = customerService.findCustomerByVo(vo);
        //Integer count = customerService.findCustomerByVoCount(vo);
        
        Page page = new Page();
//		page.setTotal(count);		//数据总数
		page.setSize(vo.getSize());	//每页显示条数
		page.setPage(vo.getPage()); //当前页数
		page.setRows(resutList);	//数据列表
		
		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";
		
		
	}
}

 CustomerService.java

package cn.it.service;

import java.util.List;

import cn.it.pojo.BaseDict;
import cn.it.pojo.Customer;
import cn.it.pojo.QueryVo;

public interface CustomerService {


		
		public List findDictByCode(String code);
		public List findCustomerByVo(QueryVo vo);

	}


 CustomerServiceImpl.java

package cn.it.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.it.dao.CustomerMapper;
import cn.it.dao.DictMapper;
import cn.it.pojo.BaseDict;
import cn.it.pojo.Customer;
import cn.it.pojo.QueryVo;

@Service
public class CustomerServiceImpl implements CustomerService {
 
	@Autowired
	private CustomerMapper customerMapper;
	@Autowired
	private DictMapper dictMapper;
	@Override
	public List findDictByCode(String code) {
              List list = dictMapper.findDictByCode(code);
		return list;
	}
	@Override
	public List findCustomerByVo(QueryVo vo) {
		 List list = customerMapper.findCustomerByVo(vo);
		
		return list;
	}


}

CustomerMapper.java

package cn.it.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.it.dao.CustomerMapper;
import cn.it.dao.DictMapper;
import cn.it.pojo.BaseDict;
import cn.it.pojo.Customer;
import cn.it.pojo.QueryVo;

@Service
public class CustomerServiceImpl implements CustomerService {
 
	@Autowired
	private CustomerMapper customerMapper;
	@Autowired
	private DictMapper dictMapper;
	@Override
	public List findDictByCode(String code) {
              List list = dictMapper.findDictByCode(code);
		return list;
	}
	@Override
	public List findCustomerByVo(QueryVo vo) {
		 List list = customerMapper.findCustomerByVo(vo);
		
		return list;
	}


}

 

你可能感兴趣的:(随笔)