//组合模糊查询就是这么简单

<select id="findAllJiemu" parameterType="java.util.Map" resultMap="ImNoticeJiemu">
SELECT A.*,(select f.names from pt_userinfo f where f.ids = ( select r.userinfoids from pt_user r where r.ids = A.createuser )) as createname ,(select f.names from pt_userinfo f where f.ids = ( select r.userinfoids from pt_user r where r.ids = A.updateuser )) as updatename FROM IM_NOTICE_JIEMU A WHERE A.COMPANYCODE=#{companycode,jdbcType=VARCHAR}
<if test="status!='' and status!=null"><![CDATA[AND A.status = #{status}]]></if>
<if test="content!=null and content!=''"><![CDATA[AND A.content like #{content}]]></if>    
order by a.createtime desc
</select>

组合模糊dao
public Page<ImNoticeJiemu> findAllJiemu(Param param,Map<String,Object> map){
try {
return super.getPage(param, "com.kinglo.pojo.ImNoticeJiemu.findAllJiemu", map);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

action类

@RequestMapping("/findallJiemu.do")
public void findallJiemu(){
String userId=this.getParamNotNnll("userId2");
Map<String, Object> cemap = new HashMap<String, Object>();
cemap.put("id",userId);
User u = los.findeuser(cemap);
String qz=u.getCompanyCode();
Map<String, Object> map = new HashMap<String, Object>();
map.put("companycode",qz);
map.put("status",getParam("fstatus2"));
map.put("content","%"+(getParam( "fcontent2")==null?"":getParam("fcontent2"))+"%");
Param param=new Param(getPageNumber(),getMaxResult());
// Page<ImNoticeJiemu> page=imNoticeService.findAllNotice(param, map);
Page<ImNoticeJiemu> page=jiemuService.findAllJiemu(param, map);
JSONObject json=JSONObject.fromObject(page, JsonConfigDate.getCountSql());
this.outJSONDataString(json.toString());
}

//分页
var initPage2 = function(pageIndex2, maxResult2, queryStr2) {
var page2 = new Page("../../NoticeJiemu/findallJiemu.do", 'tab_2', showHTML2);
page2.init(pageIndex2, maxResult2, queryStr2);
};

var showHTML2 = function(data) {
if (data.totalPages == 0) {
$(".jmgg").html("");
$(".jmgg").html("<tr style='color:red;text-align:center'><td colspan='9'>没有找到您要查询的数据!</td></tr>");
} else {
var type = {"0" : "启用","1" : "禁用"};
var html = "";
$(data.list).each(function(id, item) {
html += "<tr>";
html += "<td>" + (id+1) + "</td>";
html += "<td>" + type[item.status] + "</td>";
html += "<td>" + item.content + "</td>";
html += "<td>" + item.createname + "</td>";
html += "<td>" + item.createtime+ "</td>";
html += "<td>" + item.updatename + "</td>";
html += "<td>" + item.updatetime+ "</td>";
html += "<td><a style='cursor:pointer' fid2="+item.id+" class='updatekeyword2'>修改</a><a style='cursor:pointer' did2="+item.id+" class='deletekeyword2'>删除</a></td>";
html += "</tr>";
});
$(".jmgg").html(html);
}
};

<div class="box" id="box_jiemu" style="display: none;">
<div class="hr"
style="height: 3px; margin-top: 3px; background: #0393D6"></div>
<div class="con">
<div class="scroll">
<div class="search">
<form id="blackListForm2">
<input type="hidden" name="userId2" id="userId2"/>
<table border="0" cellpadding="0" cellspacing="0"
style="width: 100%;">
<colgroup>
<col width="34%" />
<col width="30%" />
<col width="18%" />
<col width="18%" />
</colgroup>
<tbody style="padding: 0px 10px">
<tr style="background: #F0EEEE; height: 60px">

<td>
状态
<select name="fstatus2">
<option value="">请选择</option>
<option value="0">启用</option>
<option value="1">禁用</option>
</select>
</td>
<td>
内容
<input type="text" name="fcontent2" width="90px" />
</td>
<td>
<a href="javascript:;" class="btn" id="query2">查询</a>
<a href="javascript:;" class="btn" id="reset">重置</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="edit-list">
<a href="javascript:;" onclick="showBlackList2()" class="btn">添加</a>
</div>
<div class="tables"
style="min-height: 285px; height: auto !important; height: 285px;">
<table width="100%">
<col width="16%">
<col width="16%">
<col width="16%">
<col width="16%">
<col width="16%">
<col width="16%">
<col width="16%">
<col width="16%">
<thead>
<tr>
<th>
序号
</th>
<th>
状态
</th>
<th>
内容
</th>
<th>
创建人
</th>
<th>
创建时间
</th>
<th>
修改人
</th>
<th>
修改时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody class="tbody jmgg"></tbody>
</table>
</div>
</div>
<div style="clear: both;"></div>
<div class="page tab_2" style="height: 40px">

</div>
</div>
</div>

mybatis组合模糊+分页查询的更多相关文章

  1. 如何用Mybatis逆向工程实现分页查询(更改生成的Example)

    如何用Mybatis逆向工程实现分页查询  一个很简单的方法,如果要mysql实现分页查询的话,执行下述语句即可 select * from table limit (offset)5,(limit) ...

  2. Mybatis+SpringMVC实现分页查询(附源码)

    Maven+Mybatis+Spring+SpringMVC实现分页查询(附源码) 一.项目搭建 关于项目搭建,小宝鸽以前写过一篇Spirng+SpringMVC+Maven+Mybatis+MySQ ...

  3. java使用插件pagehelper在mybatis中实现分页查询

    摘要: com.github.pagehelper.PageHelper是一款好用的开源免费的Mybatis第三方物理分页插件 PageHelper是国内牛人的一个开源项目,有兴趣的可以去看源码,都有 ...

  4. Mybatis+MySQL动态分页查询

    https://blog.csdn.net/qq_34137397/article/details/63289621 mybatis有两种分页方法 1.内存分页,也就是假分页.本质是查出所有的数据然后 ...

  5. SpringMVC+MyBatis+EasyUI 实现分页查询

    user_list.jsp <%@ page import="com.ssm.entity.User" %> <%@ page pageEncoding=&quo ...

  6. EasyUi组合条件分页查询

    1.引入css与js文件 <link rel="stylesheet" type="text/css" href="themes/default ...

  7. spring-boot 集合mybatis 的分页查询

    spring-boot 集合mybatis 的github分页查询 一.依赖包 <!-- mysql 数据库驱动. --> <dependency> <groupId&g ...

  8. JAVAEE——BOS物流项目06:分页查询、分区导出Excel文件、定区添加、分页问题总结

    1 学习计划 1.分区组合条件分页查询 n 分区分页查询(没有过滤条件) n 分区分页查询(带有过滤条件) 2.分区导出 n 页面调整 n 使用POI将数据写到Excel文件 n 通过输出流进行文件下 ...

  9. mybatis多对多关联查询——(十)

    1.需求 查询用户及用户购买商品信息. 2     sql语句 查询主表是:用户表 关联表:由于用户和商品没有直接关联,通过订单和订单明细进行关联,所以关联表: orders.orderdetail. ...

随机推荐

  1. Druid安装-单机

    单机版安装 下载安装包http://static.druid.io/artifacts/releases/druid-0.9.1.1-bin.tar.gz 安装  解压缩 安装zookeeper cu ...

  2. FLAG_ACTIVITY_CLEAR_TOP

    看了一篇相关的文章,感觉还不错,链接http://www.cnblogs.com/lwbqqyumidi/p/3775479.html

  3. nginx日志分割脚本

    [root@localhost nginx]# cat logs/nginx.pid 5118[root@localhost nginx]# kill -QUIT 5118-QUIT : 关闭进程-H ...

  4. opencv 震撼你的视觉-------基础篇

    opencv 最近在做一个钓鱼网站的项目中用到了一个叫opencv的玩意儿,以前没接触过.感觉挺新鲜的,而且项目中要用,所以就问了一下度娘(是想Google一下的,显得高大上and专业一点,但是英语水 ...

  5. ios中,在SearchBar里面搜索内容,可根据内容来查找所需的信息资源,可获得SearchBar中的内容

    贴一段我很久以前写的小demo,你们就明白了,是把textField套在alertView里的@interface ViewController : UIViewController <UIAl ...

  6. 解析JSON字符串

    import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONOb ...

  7. C#小写数字金额转换成大写人民币金额的算法

    C#小写数字金额转换成大写人民币金额的算法 第一种方法: using System.Text.RegularExpressions;//首先引入命名空间 private string DaXie(st ...

  8. C# 标准差计算

    if (numberList.Any()) { exEntity.MinValue = numberList.First().NumberValue.ToString(); exEntity.MaxV ...

  9. JS实现关闭当前子窗口,刷新父窗口

    一.JS实现关闭当前子窗口,刷新父窗口 JS代码如下: <script> function refreshParent() {  window.opener.location.href = ...

  10. HDOJ(1115)多边形重心

    Lifting the Stone http://acm.hdu.edu.cn/showproblem.php?pid=1115 题目描述:输入n个顶点(整数),求它们围成的多边形的重心. 算法:以一 ...