`id`,`tenant_id`,`parent_tenant_id`,`type`,`limit_id`,`limit_num`,`limit_date`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `type` = #{type}
and `limit_id` = #{limitId}
and `limitNum` = #{limitNum}
and `limit_date` = #{limitDate}
and `limit_date` > #{expireDate}
and id in
#{idItem}
order by ${sortColumns}
update wx_msg_limit set limit_num = limit_num - 1 where `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and limit_num > 0
delete from wx_msg_limit
where `tenant_id` = #{tenantId} and `type`= #{type} and `limit_id` = #{limitId}