Mysql多表分页查询
来源:互联网 发布:nba1516数据库· 编辑:程序博客网 时间:2024/06/05 00:58
多张表,字段完全相同,表名称不同,每三个月的数据插入到一张表中。当查询历史的时候,把所有表中的数据展示出来并做分页处理。
sql语句的写法:
<select id = "queryAllDataByLimit" parameterType = "hashmap" resultMap = "BaseResultMap">
select * from ${fristName}
where 1 = 1
<if test="state != null and state != ' ' ">
and state = #{state,jdbcType = INTEGER}
</if>
<if test="number != null and number !=' ' ">
and (sjrdh like concat ('%',#{number,jdbcType=VARCHAR},'%')
or hgh = #{number,jdbcType=VARCHAR})
</if>
<if test="tableNameList != null and tableNameList != ' ' ">
<foreach collection="tableNameList" item="item" index ="index" >
union
select * from ${item}
where 1 = 1
<if test="state != null and state != ' ' ">
and state = #{state,jdbcType = INTEGER}
</if>
<if test="number != null and number !=' ' ">
and (sjrdh like concat ('%',#{number,jdbcType=VARCHAR},'%') or
hgh = #{number,jdbcType=VARCHAR})
</if>
</if>
<if test="beginIndex != null and beginIndex != -1 ">
limit
#{beginIndex,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}
</if>
</select>
- Mysql多表分页查询
- 【MySql-多表联合查询分页存储过程】
- 基于SpringDataJpa的mysql动态分页多表查询
- 多表查询分页
- mysql 1对多--分页查询
- mysql高效分页查询
- mysql分页查询
- Mysql查询分页
- mysql分页查询
- Mysql 分页查询
- MySQL分页查询
- mysql & oracle 分页查询
- mysql的分页查询
- Mysql分页查询
- MYSQL分页查询
- mysql 分页查询
- mysql的分页查询
- MySQL 分页查询
- 五、 统计学习理论:无界实损失函数上的大数定理
- ViewPager点击跳转
- 自定义控件----继承framLayout --textview与checkBox
- PTA基础编程题目集7-19 支票面额(15 分)
- Multiple Object Tracking Benchmark
- Mysql多表分页查询
- L1-048. 矩阵A乘以B
- Find All Numbers Disappeared in an Array(leetcode)
- [Lucas定理+中国剩余定理]1951—— [Sdoi2010]古代猪文
- 程序员必备的11个辅助开发的软件神器
- 阿里云ECS如何部署并运行一个JavaWeb项目
- poj 2385
- mybatis映射器文件配置
- 神经网络 opencv实现