阿里 drds 分布式数据库分节点查询

时间:2020-12-02 15:36:05

mybatis 模式下,xml 中写法

<select id="selectFailDetailOneNode" resultMap="BaseResultMap">
/*TDDL:node=${node}*/
select * from 表A where OFFER_BATCH_ID=#{id} and
OFFER_SUCCESS_STATUS=1 and delete_status=0
</select>

把node  当做参数传入

接口中写法

Map map = new HashMap();
map.put("node", i);
map.put("id", oldbatch.getId());
final List<TZpOfferDetail> oneDetails = tZpOfferDetailMapper.selectFailDetailOneNode(map);