<!--根据实体参数查询 -->
<select id="selectBaseList" resultType="java.util.HashMap">
select
*
from ${map.tableName}
where 1=1
<foreach collection="map" index="key" item="value">
<if
test="key != 'tableName' and key != 'pageSize' and key != 'pageNo' ">
and `${key}` = #{value}
</if>
</foreach>
limit #{baseModel.fromRec},#{baseModel.pageSize}
</select> <!--根据实体参数查询个数 -->
<select id="selectBaseCount" resultType="java.lang.Integer">
select
count(1)
from ${map.tableName}
where 1=1
<foreach collection="map" index="key" item="value">
<if
test="key != 'tableName' and key != 'pageSize' and key != 'pageNo' ">
and `${key}` = #{value}
</if>
</foreach>
</select> <insert id="insertBase" parameterType="java.util.HashMap">
insert into ${map.tableName}
(
<foreach collection="map" index="key" item="value"
separator=",">
<if test="key != 'tableName' ">
`${key}`
</if>
</foreach>
)
values (
<foreach collection="map" index="key" item="value"
separator=",">
<if test="key != 'tableName' ">
#{value}
</if>
</foreach>
)
</insert>
<update id="updateBaseByPrimaryKey">
update ${map.tableName}
<set>
<foreach collection="map" index="key" item="value"
separator=",">
<if test="key != 'tableName' ">
`${key}`= #{value}
</if>
</foreach>
</set>
where id = #{map.id}
</update>

java代码部分,baseModel中放入分页参数:


import java.util.List;
import java.util.Map; import org.apache.ibatis.annotations.Param; public interface BaseDao {
int insertBase(@Param("map") Map map); Map selectBaseByPrimaryKey(Long id); int updateBaseByPrimaryKey(@Param("map") Map map ); List<Map> selectBaseList(@Param("map") Map map, @Param("baseModel") BaseModel baseModel); int selectBaseCount(@Param("map") Map map); }

最新文章

  1. JS核心系列:浅谈 call apply 与 bind
  2. Spark standalone HA
  3. linux -- read(), write()
  4. 集成支付宝钱包支付ios SDK的方法和经验
  5. apache commons-email1.3使用
  6. MAMP:在 OSX 中搭建 Apache, MySQL, PHP 环境并本地安装、调试 WordPress
  7. DOM操作-遍历一个元素的所有属性
  8. golang中container/list包源码分析
  9. C语言学生管理系统(增进版)
  10. 微信企业号JS-SDK选择图片、上传图片
  11. Docker最全教程之Go实战,墙裂推荐(十八)
  12. Function program language
  13. python之操作系统介绍,进程的创建
  14. 微信小程序无法获取UnionId的情况及处理
  15. win10常用命令和设置总结
  16. 从flask视角理解angular(四)Route
  17. BZOJ2721或洛谷1445 [Violet]樱花
  18. delphi执行查询语句时的进度条怎么做
  19. bzoj千题计划198:bzoj1084: [SCOI2005]最大子矩阵
  20. the command line tools

热门文章

  1. 51 arm x86 的大小端记录
  2. Linux 查看实时网卡流量的几种方式
  3. MVC4 Application Install
  4. learning scala regular expression patterns
  5. 新手如何入门pytorch?
  6. Python的is和==
  7. vue-cli3.0的记录
  8. 三行代码CSS竖向居中
  9. Bsgs模板
  10. Arts打卡第6周