1 //1.controlle层 2 @Controller 3 @RequestMapping("customer") 4 public class CustomerController { 5 @Autowired 6 private BaseDictService dictService; 7 @Autowired 8 private CustomerService customerService; 9 10 @Value("${CUSTOMER_FROM_TYPE}")11 private String CUSTOMER_FROM_TYPE;12 //客户行业编码13 @Value("${CUSTOMER_INDUSTRY_TYPE}")14 private String CUSTOMER_INDUSTRY_TYPE;15 //客户级别编码16 @Value("${CUSTOMER_LEVEL_TYPE}")17 private String CUSTOMER_LEVEL_TYPE;18 19 @RequestMapping("list")20 public String list(Model model,QueryVo vo) {21 22 // 来源查询23 ListfromType = dictService.getBaseDictByCode(CUSTOMER_FROM_TYPE);24 // 行业查询25 List industryType = dictService.getBaseDictByCode(CUSTOMER_INDUSTRY_TYPE);26 // 来源查询27 List levelType = dictService.getBaseDictByCode(CUSTOMER_LEVEL_TYPE);28 29 30 //分页查询用户列表31 Page page = customerService.getCustomerByQueryVo(vo);32 33 //设置数据模型返回34 model.addAttribute("fromType", fromType);35 model.addAttribute("industryType", industryType);36 model.addAttribute("levelType", levelType);37 38 //设置分页数据返回39 model.addAttribute("page", page);40 41 //查询条件回显42 model.addAttribute("vo", vo);43 44 return "customer";45 }46 }
//编辑
@RequestMapping("edit")
@ResponseBody public Customer edit(Integer id){ Customer customer = customerService.getCustomerById(id); return customer; }jsp页面展示