查询时动态检索springmvc + mabatis

实现动态检索如


页面jsp


<form   action="<%=request.getContextPath() %>/admin/account/myuserbynameortele" method="post">
           <table >
         <tr>
                      
           <th>用户姓名</th>
           <td>
            <input type="text" name="username" id="username" />
           </td>
           
           
           <th>联系电话</th>
           <td>
            <input type="text" name="usertele" id="usertele" />
           </td>
           
           <td>
            <button id="qryEmp"  type="submit"
           iconCls="icon-search" class="easyui-linkbutton">查询</button>


           </td>
           
         </tr>
        </table>
      </form>



control

//检索根据用户姓名和联系电话

 @RequestMapping(value = "/myuserbynameortele",method = RequestMethod.POST)
 public String myuserbynameortele(Model model,String username,String usertele,HttpSession session) {
  
     Login  lo =(Login)session.getAttribute("loginUser");
  
  String userID=lo.getUserID();
  
  System.out.println(usertele);
  System.out.println(username);
 Pager<Accountinfo> acc = accountinfoService.listBynameortele(userID,username,usertele);
 
 
 model.addAttribute("datas",acc);
  System.out.println("aaaaaaaaaaaaaaaa");
    return "account/myuser";
  
 }
 

Iservice


/**
  *根据指定联系电话或者真实姓名检索
  * @param id
  */
 
 public Pager<Accountinfo> listBynameortele(String userID,String username,String usertele);


service


 /**
  * 获取子用户分页列表集合信息
  */
 @Override
 public Pager<Accountinfo> findaccount(String userID) {
  //获取子用户总数
  int count=accountDao.countzi(userID);
  /*
  //获取用户分页列表集合信息
  List<accountinfo> list = accountDao.findzi(userID);*/
  //封装PageBounds对象
  PageBounds pageBounds = PageBoundsUtil.PageBoundsOrderExtend("ID.asc");
  
  List<Accountinfo> list = accountDao.findzi(pageBounds,userID);
  
  //封装用户分页的Pager对象
  Pager<Accountinfo> pages = new Pager<Accountinfo>(count,list);
  return pages;
 }


dao

//根据电话和姓名查找
  public List<Accountinfo> findbynameortele(PageBounds pagebounds,Accountinfo acc);

 //根据电话和姓名查找 个数
 public int countbynameortele(Accountinfo acc);


 xml


 <!--根据电话或者姓名 查 讯当前帐户的所有子账户-->
 <select id="findbynameortele" parameterType="com.internet.cms.model.accountinfo.Accountinfo"    resultMap="accountinfo">
  select c.*
   from Wx_User_Info c  where 1=1
  <if test="_parameter.userID!=null and _parameter.userID!=''">
  and c.User_main_id =#{userID}
  </if>
   
  <if test="_parameter.username!=null and _parameter.username!=''">
   and c.User_name =#{username}
  </if>
  <if test="_parameter.usertele!=null and _parameter.usertele!=''">
   and c.User_tele = #{usertele}
  </if> 
 </select>
 
   <!--根据电话或者姓名 查询所有子用户的个数  -->
  <select id="countbynameortele" parameterType="com.internet.cms.model.accountinfo.Accountinfo" resultType="int">
 select count(*)
  from Wx_User_Info c where 1=1
  <if test="_parameter.userID!=null and _parameter.userID!=''">
  and User_main_id =#{userID}
  </if>
  <if test="_parameter.username!=null and _parameter.username!=''">
   and User_name =#{username}
  </if>
  <if test="_parameter.usertele!=null and _parameter.usertele!=''">
   and User_tele = #{usertele}
  </if>  
 </select>


xml和 jsp页面的书写




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
**smart-web2** 是一套相对简单的OA系统;包含了流程设计器,表单设计器,权限管理,简单报表管理等功能; 系统后端基于SpringMVC+Spring+Hibernate框架,前端页面采用JQuery+Bootstrap等主流技术; 流程引擎基于Snaker工作流;表单设计器基于雷劈网WEB表单设计器。 系统主要功能有: >1.系统管理 >>系统管理包含有:基础信息管理、系统权限管理、版本管理、子系统管理。 > >2.流程管理 >>流程管理包含有:流程设计器、流程实例管理、流程页面模版管理等功能。 > >3.表单管理 >>表单管理包含有:表单设计器、表管理、表单帮助信息管理等。 > >4.我的办公 >>我的待办、我的已办; > >5.简单报表管理 >>简单报表管理包含:简单报表的设计、报表管理等。 使用说明 ======= ------- ---数据库MySQL5.6以上 ---下载后把data目录下的smart-web2.zip解压;然后解压出来的脚本文件(“smart-web2.sql”)导入到mysql数据库中;注:建库,字符集编码为:utf8(utf8_general_ci) ---修改配置文件“jdbc.properties”,改成对应数据库的用户名和密码 ---“sysconfig.properties”系统配置文件;需要修改“root.dir”属性,设置为系统上传文件用来存放的根目录 ----系统管理员用户名为:admin;密码为:123456 ----linux类系统需要修改mysql的配置文件,改为数据库表名不区分大小写(lower_case_table_names=1) 环境要求 ------------ 1.jdk要求1.7及以上; 2.tomcat6或tomcat7; 3.eclipse版本4.4以上; 4.浏览器要求:IE8及以上(最理想的是IE10及以上),火狐,chrome等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值