admin管理员组

文章数量:1026989

【MyBatis

mybatis plus  启动多租户情况下,中文首字母排序异常方法解决

utf8 情况下需要转换编码,mybatis-plus 多租户的情况下会报异常!

ORDER BY CONVERT( name USING gbk ) COLLATE gbk_chinese_ci asc


1. mapper 方法上添加注解,单独处理查询,不进租户拦截器

 @InterceptorIgnore(tenantLine = "true") 

 
2. 在xml, sql 中自己增加租户过滤条件 。 例:  

where 租户Id = xxxx


3. xml 新增分页 count sql 语句,  例:

<select id="getInfo_count" resultType="Long">select count(*) from table 
</select>


4.  自己定义count语句的id

Page<?> page = new Page<?>(pageNo, pageSize);
page.setCountId("getInfo_count"); 
IPage<?> pageList = this.service.queryPage(page);

【MyBatis

mybatis plus  启动多租户情况下,中文首字母排序异常方法解决

utf8 情况下需要转换编码,mybatis-plus 多租户的情况下会报异常!

ORDER BY CONVERT( name USING gbk ) COLLATE gbk_chinese_ci asc


1. mapper 方法上添加注解,单独处理查询,不进租户拦截器

 @InterceptorIgnore(tenantLine = "true") 

 
2. 在xml, sql 中自己增加租户过滤条件 。 例:  

where 租户Id = xxxx


3. xml 新增分页 count sql 语句,  例:

<select id="getInfo_count" resultType="Long">select count(*) from table 
</select>


4.  自己定义count语句的id

Page<?> page = new Page<?>(pageNo, pageSize);
page.setCountId("getInfo_count"); 
IPage<?> pageList = this.service.queryPage(page);

本文标签: Mybatis