GroupsRelationMapper.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. package com.cyksj.mapper;
  2. import cn.hutool.core.date.DateTime;
  3. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.cyksj.model.entity.GroupsRelation;
  6. import com.cyksj.model.entity.PhoneCode;
  7. import com.cyksj.model.manage.views.GroupsRelationBackView;
  8. import com.cyksj.model.manage.views.GroupsRelationView;
  9. import com.cyksj.model.response.GptRechargeStatisticsRecordResp;
  10. import com.cyksj.model.views.GroupsRelationUserView;
  11. import com.cyksj.model.views.RenewalView;
  12. import com.cyksj.model.views.UserRecommendGoodsFrontView;
  13. import com.cyksj.model.views.UserTicketView;
  14. import org.apache.ibatis.annotations.Param;
  15. import org.apache.ibatis.annotations.Select;
  16. import org.apache.ibatis.annotations.Update;
  17. import java.util.Date;
  18. import java.util.List;
  19. /**
  20. * @author chan
  21. * @date 2022/9/27 11:10 AM
  22. */
  23. public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
  24. @Select("select * from groups_relation where id = #{relationId} for update")
  25. GroupsRelation selectByIdForUpdate(@Param("relationId") Long relationId);
  26. /**
  27. * Database ownership fence for assigning an available seat. Redis only
  28. * reduces contention; this CAS is the cross-process source of truth.
  29. */
  30. @Update("update groups_relation set user_id = #{userId}, status = #{status}, " +
  31. "start_time = #{startTime}, expiry_time = #{expiryTime}, yhs_id = #{yhsId}, " +
  32. "cmt = #{cmt} where id = #{id} and user_id = 0 and status = 'none'")
  33. int claimAvailableRelation(@Param("id") Long id,
  34. @Param("userId") Long userId,
  35. @Param("status") GroupsRelation.Status status,
  36. @Param("startTime") Date startTime,
  37. @Param("expiryTime") Date expiryTime,
  38. @Param("yhsId") Long yhsId,
  39. @Param("cmt") Integer cmt);
  40. /**
  41. * Claims a dynamically allocated outside seat without changing its outside
  42. * status. The ownership predicates prevent the main service and recovery
  43. * job from assigning the same relation concurrently.
  44. */
  45. @Update("update groups_relation set user_id = #{userId}, " +
  46. "start_time = #{startTime}, expiry_time = #{expiryTime}, yhs_id = #{yhsId}, " +
  47. "cmt = #{cmt} where id = #{id} and user_id = 0 and status = 'outside'")
  48. int claimOutsideRelation(@Param("id") Long id,
  49. @Param("userId") Long userId,
  50. @Param("startTime") Date startTime,
  51. @Param("expiryTime") Date expiryTime,
  52. @Param("yhsId") Long yhsId,
  53. @Param("cmt") Integer cmt);
  54. List<Long> getAccountIdsByUserIdOrNickNameOrSubmitAccount(@Param("userId") Long userId, @Param("nickName") String nickName, @Param("submitAccount") String submitAccount);
  55. Integer updateExpiryTime(@Param("entity") GroupsRelation relation, @Param("expireTime") Date expireTime);
  56. Long getGroupTripsSkuIdByRelationId(Long relationId);
  57. @Update("update groups_relation set customer_service = null where id = #{id}")
  58. void updateCustomerService(Long id);
  59. Long selectSimilarExpiredRelation(@Param("skuId") Long skuId, @Param("minExpiryTime") DateTime minExpiryTime, @Param("maxNum") Integer maxNum, @Param("ip") String ip);
  60. List<GroupsRelationView> selectRelationByGoodsId(@Param("goodsId") Long goodsId, @Param("userIds") List<Long> userIds, @Param("yhsId") Long yhsId);
  61. GroupsRelationView getGroupRelationViewByUserIdAndRelationId(@Param("userId") Long userId, @Param("relationId") Long relationId);
  62. String getBindPhoneByUserId(Long userId);
  63. Integer selectViewPwdCount(Long groupsId);
  64. GroupsRelation selectRandomOneRelationByGroupsId(Long groupsId);
  65. List<GroupsRelation> selectExpiredRelationByCondition(@Param("now") DateTime now, @Param("list") List<Long> filterSkuIds);
  66. GroupsRelation selectOutsideRelationByGroupsId(@Param("groupsId") Long groupsId, @Param("relationNum") Integer relationNum);
  67. List<GroupsRelation> selectExpiredChatGPTRelation(@Param("nextBeginDay") DateTime nextBeginDay, @Param("list") List<Long> gptSkuIds);
  68. List<GroupsRelationUserView> getUserRelationUserViews(@Param("groupsId") Long groupsId, @Param("relationId") Long relationId, @Param("userId") Long userId, @Param("status") List<GroupsRelation.Status> status);
  69. List<Long> getTicketGoodsId(@Param("list") List<Long> userIds, @Param("status") List<String> status);
  70. Page<UserRecommendGoodsFrontView> getRecommendGoodsViews(@Param("page") Page<UserRecommendGoodsFrontView> page, @Param("list") List<Long> filter_goods_id, @Param("isPayNf") Boolean isPayNf, @Param("filterCourseGoods") Boolean filterCourseGoods, @Param("yhShopGoodsIds") List<Long> yhShopGoodsIds);
  71. Long getOutSideGroupsTripsRelationByGoodsId(@Param("skuId") Long skuId, @Param("beginOfDay") DateTime beginOfDay, @Param("extraNum") Integer extraNum, @Param("userId") Long userId, @Param("skuNum") Integer skuNum, @Param("maxNum") Integer maxNum);
  72. Integer selectAvailableRelation(@Param("skuId") Long skuId, @Param("skuNum") Integer skuNum);
  73. Integer selectSpecialGroupsRelationAvailable(@Param("skuId") Long skuId, @Param("maxNum") Integer maxNum, @Param("skuNum") Integer skuNum, @Param("extractNum") Integer extractNum, @Param("tenExpiry") DateTime tenExpiry);
  74. Integer selectNumWaitingGroups(Long skuId);
  75. Integer selectLimitAvailableNum(@Param("skuId") Long skuId, @Param("maxNum") Integer maxNum);
  76. GroupsRelationBackView getGroupRelationAccountView(Long relationId);
  77. PhoneCode getAreaPhoneByUserId(Long userId);
  78. List<RenewalView> getUserHasPayGoods(@Param("list") List<Long> userIds, @Param("now") DateTime now);
  79. Long getExperienceTicket(@Param("userId") Long userId, @Param("skuId") Long skuId);
  80. Long selectGoodsDonQaByGoodsId(Long goodsId);
  81. GroupsRelation selectRelationByAccountAndNum(@Param("account") String account, @Param("password") String password, @Param("goodsId") Long goodsId, @Param("num") Integer num);
  82. List<GroupsRelation> selectExtraRelation(@Param("userId") Long userId, @Param("skuId") Long skuId, @Param("relationId") Long relationId);
  83. void incrExpiryTime(@Param("relationId") Long relationId, @Param("userId") Long userId);
  84. List<UserTicketView> selectUserTickets(@Param("userIds") List<Long> userIds, @Param("goodsId") Long goodsId, @Param("skuId") Long skuId);
  85. Integer selectCountByGoodsId(@Param("userIds") List<Long> userIdList, @Param("goodsId") Long goodsId, @Param("now") DateTime now);
  86. Integer updateUserVipSkusExpiryTime(@Param("userIds") List<Long> userIds, @Param("vipSkuIds") List<Long> vipSkuIds, @Param("expiryTime") Date expiryTime);
  87. List<GptRechargeStatisticsRecordResp> selectRechargeRecordNum(@Param("goodsIds") List<Long> goodsIds, @Param("start") String start, @Param("end") String end, @Param("operator") String operator);
  88. }