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

<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. WinForms中的Label的AutoSize属性

    当大量使用UserControl组合UI时,如果更改了Label的Text属性,Label.AutoSize属性会影响UserControl的OnLoad事件的发生顺序; public overrid ...

  2. CacheManager COUNTER

    CacheClient.AddOrUpdate("COUNTER", 0, v => Convert.ToInt32(v) + 1);

  3. Swift版的SQLiteHelper

    SQLiteHelper 创建SQLiteHelper类 /// SQLite数据库处理帮助类 /// /// 此类中封装了关于SQLite数据库处理的业务函数 class SQLiteHelper ...

  4. (转)C语言_测试程序运行内存状态GlobalMemoryStatus使用案例

    在做毕业设计的时候,需要验证算法的空间复杂度,C语言网上都说是用GlobalMemoryStatus这个函数,但是网上却没有这个函数的使用实例,也有人说是用内存分析器的东西,但是这个显然是不靠谱的. ...

  5. Vagrant+virtualBox+pycham+python环境的安装及配置

    概要: 通过Vagrant,virtualBox安装配置,把virtualBox虚拟机的linux项目映射windows本地项目中,在windows的pycharm工具中开发用python语言开发项目 ...

  6. python Django教程 之 安装、基本命令、视图与网站

    python  Django教程  之 安装.基本命令.视图与网站 一.简介 Django 中提供了开发网站经常用到的模块,常见的代码都为你写好了,通过减少重复的代码,Django 使你能够专注于 w ...

  7. MS AX 技术相关网站收藏

    Microsoft Dynamics AX Developer Centerhttps://msdn.microsoft.com/en-us/dynamics/ax/default.aspx From ...

  8. FPS中受伤UI在VR游戏中的实现思路

    FPS中受伤UI在VR游戏中的实现思路 希望实现的效果 这几天一直在尝试各种解决方案,现在算是不完美的解决啦,记录一下心路历程,思路有了算法都比较简单. V_1 玩家胶囊体指向的方向作为正方向,计算出 ...

  9. springboot一个service内组件的加载顺序

    先加载自身构造器,所以在构造器中初始化时若使用需要注入的(即@Autowired注解的)组件相关的方法,则会报null: 然后加载注入的组件即@Autowired 最后加载@PostConstruct ...

  10. css之页面两列布局

    两列布局:左边固定,后边自适应 第一种方法:左边的div左浮动或者是绝对定位,右边的div加margin-left:左边div的宽度 html部分 <div class="left&q ...