xml 连表查询(1) --->自关联!模糊查询

1.页面获取参数:

字典名称:<input id="sdName" name="dName" type="text" placeholder="字典名称" class="form-control input-medium input-inline" autocomplete="off">

     <button id="sipStorate_form" class="btn btn-sm yellow filter-submit margin-bottom"> <i class="fa fa-search"> 搜索</i></button>

 

2.后台获取参数:

//获取客户端参数

    ModelAndView model = getModel("inspectionUnit/dictionaryList");
    Map<String, Object> para = new HashMap<String, Object>();
    Integer pageNo = this.getPageNo(request);
    Integer pageSize = this.getPageSize(request);
    para.put("dName", request.getParameter("dName"));

    Map<String, Object> map = dictionaryService.list(pageNo, pageSize, para);

    model.addObject("resultMap", map); 

 

3.xml 获取参数 if标签判断是否为空 like模糊查询,根据子表name模糊查询

  <if test="dName != null and dName != ''">
    and t.D_NAME like'%'||#{dName}||'%'
  </if>

 

posted @ 2017-07-07 09:53  夕阳残血  阅读(488)  评论(0编辑  收藏  举报