查询时动态检索springmvc + mabatis
来源:互联网 发布:阿里云域名解析cname 编辑:程序博客网 时间:2024/06/05 01:59
实现动态检索如
页面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页面的书写
- 查询时动态检索springmvc + mabatis
- mabatis 动态sql
- mabatis---动态SQL
- mabatis的动态sql
- Spring+Springmvc+Mabatis环境搭建
- Spring + Springmvc + Mabatis环境搭建
- (springmvc+spring+mabatis)配置
- 3、SpringMVC与MaBatis整合
- 转载(springmvc+spring+mabatis)配置
- mabatis 传的参数为list,xml文件查询时可以用foreach
- mabatis源码解析之查询流程
- mabatis 嵌套多参外部mapper查询
- MaBatis的模糊查询与存储过程
- springMVC+easyUI实现combobox动态级联查询
- 怎样进行ssm 的整合(spring+springmvc+mabatis)
- 检索/查询时特殊字符的处理
- SpringMVC Lucene 全文检索
- springmvc + jquery datatable + ajax实现动态分页查询
- Sofia-SIP辅助文档七 - Sofia SIP用户代理库 - "su" - 操作系统功能和工具
- win10如何设置软件开机启动
- Java实验(7) 2*2线性方程组
- 请求头和响应头的作用和内容
- 详解AJAX工作原理以及实例讲解(通俗易懂)
- 查询时动态检索springmvc + mabatis
- SICP 练习2.31 tree-map
- [FAQ04776]如何默认打开user版本 debug 选项, 默认打开adb 连接
- linux下文件比较工具,文件夹比较工具
- StringUtils常用方法+StringUtils详细介绍
- 【学习笔记】Fiddler实现本地调试服务器上的文件
- ios 基本技术点
- 如何使用一个textview控件使字体出现两种颜色
- $.ajax()方法详解