TDengine数据库与Mybatis-plus 多租户屏蔽

使用TDengine时序数据库特有的查询:

select sum(gen_power_total) gen_power_totals,last(ts) xdate            

        from  power.device_0123456                

        where ts >='2023-05-16 08:53:05' and ts <= '2023-05-17 08:53:05'                 

        interval(1h)  ;

错误提示:

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "interval" "INTERV"

解决方法:

在dao或者mapper的方式上增加注解:@InterceptorIgnore(tenantLine = "true")

/**
 *  根据设备编号查询
 * @param stationId 电站编号
 * @return
 */
 @InterceptorIgnore(tenantLine = "true")
 List<PowerDeviceDataApiVo> deviceRealTimesData(@Param("stationId") String stationId, @Param("yesterDate") Date yesterDate, @Param("nowDate") Date nowDate);

--------------------------------------------------------------------------------------------------------------------------------

mybatis-plus 多租户屏蔽某个特定mapper的方法@InterceptorIgnore

背景

       项目中使用了mybatis plus多租户插件,再与数据交换过程中,每个sql都会加上租户的条件。

        但是某些特定sql不需要加租户条件过滤

@InterceptorIgnore使用

多租户屏蔽某个特定mapper的方法,则在特定mapper方法上加注解:@InterceptorIgnore(tenantLine = "true")

@InterceptorIgnore的其他用法


各属性返回 true 表示不走插件(在配置了插件的情况下,不填则默认表示 false)

猜你喜欢

转载自blog.csdn.net/zw899004/article/details/130719380