PosStoreOmgMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.system.mapper.PosStoreOmgMapper">
  6. <!-- 按门店ID查 OMG 凭证(发起支付 getEnabledCredential 用) -->
  7. <select id="selectByStoreId" parameterType="Long"
  8. resultType="com.ruoyi.system.domain.PosStoreOmg">
  9. SELECT id, store_id AS storeId, omg_status AS omgStatus, is_enabled AS isEnabled,
  10. merchant_id AS merchantId, hash_key AS hashKey, hash_iv AS hashIv,
  11. enabled_payments AS enabledPayments, apply_time AS applyTime,
  12. approved_time AS approvedTime, last_verify_result AS lastVerifyResult,
  13. remark, create_time AS createTime, update_time AS updateTime,
  14. create_by AS createBy, update_by AS updateBy
  15. FROM pos_store_omg
  16. WHERE store_id = #{storeId}
  17. </select>
  18. <!-- 按 OMG 商店代号反查凭证(回调 MerchantID 定位门店) -->
  19. <select id="selectByMerchantId" parameterType="String"
  20. resultType="com.ruoyi.system.domain.PosStoreOmg">
  21. SELECT id, store_id AS storeId, omg_status AS omgStatus, is_enabled AS isEnabled,
  22. merchant_id AS merchantId, hash_key AS hashKey, hash_iv AS hashIv,
  23. enabled_payments AS enabledPayments, apply_time AS applyTime,
  24. approved_time AS approvedTime, last_verify_result AS lastVerifyResult,
  25. remark, create_time AS createTime, update_time AS updateTime,
  26. create_by AS createBy, update_by AS updateBy
  27. FROM pos_store_omg
  28. WHERE merchant_id = #{merchantId}
  29. ORDER BY id DESC
  30. LIMIT 1
  31. </select>
  32. <!-- 按 merchant_id + store_id 精确反查凭证(退款/查询补单:同 merchant_id 多门店时定位本店) -->
  33. <select id="selectByMerchantIdAndStoreId" parameterType="map"
  34. resultType="com.ruoyi.system.domain.PosStoreOmg">
  35. SELECT id, store_id AS storeId, omg_status AS omgStatus, is_enabled AS isEnabled,
  36. merchant_id AS merchantId, hash_key AS hashKey, hash_iv AS hashIv,
  37. enabled_payments AS enabledPayments, apply_time AS applyTime,
  38. approved_time AS approvedTime, last_verify_result AS lastVerifyResult,
  39. remark, create_time AS createTime, update_time AS updateTime,
  40. create_by AS createBy, update_by AS updateBy
  41. FROM pos_store_omg
  42. WHERE merchant_id = #{merchantId}
  43. AND store_id = #{storeId}
  44. ORDER BY id DESC
  45. LIMIT 1
  46. </select>
  47. <!-- 门店 OMG 凭证管理列表:列名别名对齐 VO 属性,resultType 自动映射 -->
  48. <select id="selectOmgStoreList" parameterType="com.ruoyi.system.domain.vo.PosStoreOmgVo"
  49. resultType="com.ruoyi.system.domain.vo.PosStoreOmgVo">
  50. SELECT
  51. s.id AS storeId,
  52. s.pos_name AS posName,
  53. s.user_id AS userId,
  54. u.user_name AS userName,
  55. s.is_stall AS isStall,
  56. s.is_night_market AS isNightMarket,
  57. s.night_market_id AS nightMarketId,
  58. IFNULL(e.omg_status, 0) AS omgStatus,
  59. IFNULL(e.is_enabled, 1) AS isEnabled,
  60. CASE WHEN e.merchant_id IS NULL OR e.merchant_id = '' THEN 0 ELSE 1 END AS hasMerchantId,
  61. e.enabled_payments AS enabledPayments,
  62. e.apply_time AS applyTime,
  63. e.approved_time AS approvedTime,
  64. e.last_verify_result AS lastVerifyResult
  65. FROM pos_store s
  66. LEFT JOIN pos_store_omg e ON e.store_id = s.id
  67. LEFT JOIN info_user u ON u.user_id = s.user_id
  68. <where>
  69. s.del_flag = '0'
  70. <if test="posNameLike != null and posNameLike != ''"> AND s.pos_name LIKE concat('%', #{posNameLike}, '%') </if>
  71. <if test="omgStatus != null"> AND IFNULL(e.omg_status, 0) = #{omgStatus} </if>
  72. <if test="quickFilter != null and quickFilter == 'notApplied'">
  73. AND IFNULL(e.omg_status, 0) IN (0, 1)
  74. </if>
  75. </where>
  76. ORDER BY s.id DESC
  77. </select>
  78. <!-- 门店 OMG 凭证详情 -->
  79. <select id="selectOmgStoreDetail" parameterType="Long"
  80. resultType="com.ruoyi.system.domain.vo.PosStoreOmgVo">
  81. SELECT
  82. s.id AS storeId,
  83. s.pos_name AS posName,
  84. s.user_id AS userId,
  85. u.user_name AS userName,
  86. s.is_stall AS isStall,
  87. s.is_night_market AS isNightMarket,
  88. s.night_market_id AS nightMarketId,
  89. IFNULL(e.omg_status, 0) AS omgStatus,
  90. IFNULL(e.is_enabled, 1) AS isEnabled,
  91. CASE WHEN e.merchant_id IS NULL OR e.merchant_id = '' THEN 0 ELSE 1 END AS hasMerchantId,
  92. e.merchant_id AS merchantId,
  93. e.enabled_payments AS enabledPayments,
  94. e.remark AS remark,
  95. e.apply_time AS applyTime,
  96. e.approved_time AS approvedTime,
  97. e.last_verify_result AS lastVerifyResult
  98. FROM pos_store s
  99. LEFT JOIN pos_store_omg e ON e.store_id = s.id
  100. LEFT JOIN info_user u ON u.user_id = s.user_id
  101. WHERE s.id = #{storeId}
  102. </select>
  103. </mapper>