博客
关于我
利用Mybaties注解动态Sql实现查询功能(表名不固定)
阅读量:254 次
发布时间:2019-03-01

本文共 173 字,大约阅读时间需要 1 分钟。

最近开发过程中,数据库的表名是日表,每次查询需要动态传入表名,所以需要动态拼接sql

一.mapper接口,调用provider类,该类返回sql(RecordProvider需要自己新建一个class)

 

二.Provider.class,利用StringBuider拼接sql,返回的String跟在mapper.xml写sql一样

 

class 

 

你可能感兴趣的文章
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>