![](https://csdnimg.cn/release/download_crawler_static/86312447/bg4.jpg)
6 编写Service
7 编写Dao
8 编写Mapper
public
class CustomerController extends BaseController{
@Resource
public CustomerService customerService;
@RequestMapping("index")
public String index(){
return "customer";
}
@ResponseBody
@RequestMapping("queryCustomersByParams")
public Map<String,Object> queryCustomersByParams(CustomerQuery customerQuery){
return customerService.queryCustomersByParams(customerQuery);
}
}
public Map<String,Object> queryCustomersByParams(CustomerQuery customerQuery) {
PageHelper.startPage(customerQuery.getPage(),customerQuery.getRows());
List<Customer> list = customerDao.queryCustomersByParams(customerQuery);
PageInfo<Customer> pageInfo = new PageInfo<>(list);
HashMap<String, Object> map = new HashMap<>();
map.put("rows",pageInfo.getList());
map.put("total",pageInfo.getTotal());
return map;
}
public List<Customer> queryCustomersByParams(CustomerQuery customerQuery);
<select id="queryCustomersByParams" parameterType="customerQuery"
resultType="customer">
select <include refid="Base_Column_List"/>
from t_customer
<where>
is_valid = 1
<if test="khno !=null and khno!=''">
and khno like concat('%',#{khno},'%')
</if>
<if test="customerName !=null and customerName!=''">
南昌市青山湖区紫阳大道3333绿地紫峰大厦1907室