提交 64ea8109 编写于 作者: N nrd

利用用户名获取客户信息

上级 b425b7dc
......@@ -37,4 +37,23 @@ public class CustomerController {
session.setAttribute("customerList",customerList);
return customer;
}
@RequestMapping("/getonecus")
@ResponseBody
public Map<String,Object> getonecus(String name){
List<Customer> customerList = customerService.queryByCusName(name);
Map<String,Object> customer = new HashMap<>();
if (customerList==null){
customer.put("code",0);
customer.put("massage","没有查询到姓名为"+name+"的客户信息");
}else {
customer.put("code",1);
customer.put("message","查询成功");
customer.put("data",customerList);
}
Session session= SecurityUtils.getSubject().getSession();
session.setAttribute("customerList",customerList);
return customer;
}
}
......@@ -11,4 +11,7 @@ public interface CustomerDao {
Customer queryByCustomer(int CustomerId);
//获取全部客户信息
List<Customer> queryAll();
//根据用户名查询用户的信息
List<Customer> queryByCusName(String name);
}
......@@ -12,4 +12,7 @@ public interface CustomerService {
//查询所有客户信息
List<Customer> queryAll();
//根据用户名查询用户的信息
List<Customer> queryByCusName(String name);
}
......@@ -26,4 +26,10 @@ public class CustomerServiceImpl implements CustomerService {
public List<Customer> queryAll() {
return customerDao.queryAll();
}
@Override
public List<Customer> queryByCusName(String name) {
List<Customer> customerList = customerDao.queryByCusName(name);
return customerList;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册