You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<select id="findInGroupUserPage" resultType="UserBuy">
SELECT
<include refid="userBuyColumns"/>
FROM user_buy a
<include refid="userBuyJoins"/>
<where>
<if test="goodsIds != null and goodsIds != ''">
and a.root_obj_id IN (${goodsIds})
</if>
<!-- <if test="uids != null and uids != ''">
and a.uid IN (${uids})
</if> -->
<if test="uidList != null">
and a.uid IN
<foreach collection="uidList" item="uid" open="(" close=")" separator=",">
${uid}
</foreach>
</if>
</where>
GROUP BY uid, root_obj_id
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
</otherwise>
</choose>
</select>
报错:
public Collection<String> doInSharding(final Collection<String> availableTargetNames, final ShardingValue<Long> shardingValue) {
Collection<String> result = new LinkedHashSet<String>(availableTargetNames.size());
Collection<Long> values = shardingValue.getValues();
for (Long value : values) {
for (String tableNames : availableTargetNames) {
if (tableNames.endsWith(value % tableCount + "")) {
result.add(tableNames);
}
}
}
return result;
}
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at cn.huanju.edu100.shardingjdbc.SingleKeyModuloTableShardingAlgorithm.doInSharding(SingleKeyModuloTableShardingAlgorithm.java:45)
at com.dangdang.ddframe.rdb.sharding.router.strategy.ShardingStrategy.doSharding(ShardingStrategy.java:83)
at com.dangdang.ddframe.rdb.sharding.router.strategy.ShardingStrategy.doStaticSharding(ShardingStrategy.java:59)
at com.dangdang.ddframe.rdb.sharding.router.single.SingleTableRouter.routeTables(SingleTableRouter.java:128)
at com.dangdang.ddframe.rdb.sharding.router.single.SingleTableRouter.route(SingleTableRouter.java:96)
at com.dangdang.ddframe.rdb.sharding.router.SQLRouteEngine.routeSQL(SQLRouteEngine.java:116)
at com.dangdang.ddframe.rdb.sharding.router.SQLRouteEngine.routeSQL(SQLRouteEngine.java:94)
at com.dangdang.ddframe.rdb.sharding.router.PreparedSQLRouter.route(PreparedSQLRouter.java:65)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.routeSQL(ShardingPreparedStatement.java:157)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:93)
at cn.huanju.edu100.hq.common.persistence.interceptor.SQLHelper.getCount(SQLHelper.java:124)
at cn.huanju.edu100.hq.common.persistence.interceptor.PaginationInterceptor.intercept(PaginationInterceptor.java:60)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)
at com.sun.proxy.$Proxy37.query(Unknown Source)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
The text was updated successfully, but these errors were encountered:
参数类型是long, 但是doInSharding那里接收到的values是int, for (Long value : values) 这里转换出错
java代码:
List suidList = new ArrayList();
sql代码
报错:
The text was updated successfully, but these errors were encountered: