|
|
@@ -63,7 +63,9 @@ public interface OrderDonTicketRecordMapper extends BaseMapper<OrderDonTicketRec
|
|
|
OrderDonTicketRecord lockClaim(@Param("id") Long id,
|
|
|
@Param("workerToken") String workerToken);
|
|
|
|
|
|
- @Update("update order_don_ticket_record set status = 'success', relation_id = #{relationId}, worker_token = null, processing_time = null, error_msg = null, update_time = now() where id = #{id} and status = 'processing' and worker_token = #{workerToken}")
|
|
|
+ @Update("update order_don_ticket_record set status = 'success', relation_id = #{relationId}, " +
|
|
|
+ "worker_token = null, processing_time = null, error_msg = null, update_time = now() " +
|
|
|
+ "where id = #{id} and status = 'processing' and worker_token = #{workerToken}")
|
|
|
int markSuccess(@Param("id") Long id, @Param("relationId") Long relationId, @Param("workerToken") String workerToken);
|
|
|
|
|
|
@Update("update order_don_ticket_record set status = 'failed', worker_token = null, processing_time = null, error_msg = #{errorMsg}, update_time = now() where id = #{id} and status = 'processing' and worker_token = #{workerToken}")
|
|
|
@@ -117,23 +119,29 @@ public interface OrderDonTicketRecordMapper extends BaseMapper<OrderDonTicketRec
|
|
|
int replaceActiveRelation(@Param("oldRelationId") Long oldRelationId,
|
|
|
@Param("newRelationId") Long newRelationId);
|
|
|
|
|
|
- @Select("select r.* from order_don_ticket_record r inner join groups_relation gr on gr.id = r.relation_id where gr.groups_id = #{groupsId} and r.status = 'success' order by r.item_index")
|
|
|
+ @Select("select r.* from order_don_ticket_record r inner join groups_relation gr " +
|
|
|
+ "on gr.id = r.active_relation_id where gr.groups_id = #{groupsId} " +
|
|
|
+ "and r.status = 'success' order by r.item_index")
|
|
|
List<OrderDonTicketRecord> selectSuccessfulByGroupsId(@Param("groupsId") Long groupsId);
|
|
|
|
|
|
@Select("select distinct r.order_id from order_don_ticket_record r " +
|
|
|
"inner join order_don o on o.id = r.order_id " +
|
|
|
- "inner join groups_relation gr on gr.id = r.relation_id " +
|
|
|
+ "inner join groups_relation gr on gr.id = r.active_relation_id " +
|
|
|
"where gr.groups_id = #{groupsId} and r.status = 'success' " +
|
|
|
"and o.status in ('hasPayment', 'complete') order by r.order_id")
|
|
|
List<Long> selectSuccessfulOrderIdsByGroupsId(@Param("groupsId") Long groupsId);
|
|
|
|
|
|
- @Update("update order_don_ticket_record set status = 'cleared', worker_token = null, processing_time = null, error_msg = null, update_time = now() where active_relation_id = #{relationId} and status = 'success'")
|
|
|
+ @Update("update order_don_ticket_record set status = 'cleared', worker_token = null, " +
|
|
|
+ "processing_time = null, error_msg = null, update_time = now() " +
|
|
|
+ "where active_relation_id = #{relationId} and status = 'success'")
|
|
|
int clearActiveRelation(@Param("relationId") Long relationId);
|
|
|
|
|
|
- @Select("select * from order_don_ticket_record where active_relation_id = #{relationId} limit 1")
|
|
|
+ @Select("select * from order_don_ticket_record where active_relation_id = #{relationId} " +
|
|
|
+ "and status in ('success', 'refunding')")
|
|
|
OrderDonTicketRecord selectActiveByRelationId(@Param("relationId") Long relationId);
|
|
|
|
|
|
- @Select("select * from order_don_ticket_record where active_relation_id = #{relationId} limit 1 for update")
|
|
|
+ @Select("select * from order_don_ticket_record where active_relation_id = #{relationId} " +
|
|
|
+ "and status in ('success', 'refunding') for update")
|
|
|
OrderDonTicketRecord selectActiveByRelationIdForUpdate(@Param("relationId") Long relationId);
|
|
|
|
|
|
@Select("select count(*) from order_don_ticket_record where order_id = #{orderId} and status = #{status}")
|