Subversion Repositories SmartDukaan

Rev

Rev 1946 | Rev 2289 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1946 Rev 2288
Line 52... Line 52...
52
  <select id="getPaymentForTxn" parameterType="int" resultMap="paymentResult">
52
  <select id="getPaymentForTxn" parameterType="int" resultMap="paymentResult">
53
    SELECT * FROM payment
53
    SELECT * FROM payment
54
    WHERE merchantTxnId=#{merchantTxnId}
54
    WHERE merchantTxnId=#{merchantTxnId}
55
  </select>
55
  </select>
56
  
56
  
-
 
57
  <sql id="getPaymentsWhereClause">
-
 
58
    <if test="fromTime != ''">
-
 
59
      initTimestamp &gt;= #{fromTime}
-
 
60
    </if>
-
 
61
    <if test="toTime != '' && status == 0">
-
 
62
      AND initTimestamp &lt;= #{toTime}
-
 
63
    </if>
-
 
64
    <if test="toTime != '' && status != 0">
-
 
65
      AND (errorTimestamp &lt;= #{toTime} OR successTimestamp &lt;= #{toTime})
-
 
66
    </if>
-
 
67
    <if test="status != -1">
-
 
68
      AND status=#{status}
-
 
69
    </if>
-
 
70
    <if test="gatewayId != 0">
-
 
71
      AND gatewayId = #{gatewayId}
-
 
72
    </if>
-
 
73
  </sql>
-
 
74
  
57
  <select id="getPayments" parameterType="map" resultMap="paymentResult">
75
  <select id="getPayments" parameterType="map" resultMap="paymentResult">
58
    SELECT * FROM payment
76
    SELECT * FROM payment
59
    <where>
77
    <where>
60
      <if test="fromTime != ''">
-
 
61
        initTimestamp &gt;= #{fromTime}
-
 
62
      </if>
-
 
63
      <if test="toTime != ''">
-
 
64
        AND initTimestamp &lt;= #{toTime}
-
 
65
      </if>
-
 
66
      <if test="status != -1">
-
 
67
        AND status=#{status}
-
 
68
      </if>
-
 
69
      <if test="gatewayId != -1">
78
      <include refid="getPaymentsWhereClause"/>
70
        AND gatewayId = #{gatewayId}
-
 
71
      </if>
-
 
72
    </where>
79
    </where>
73
    ORDER BY id
80
    ORDER BY id
74
  </select>
81
  </select>
75
 
82
 
76
  <select id="getPaymentsForUser" parameterType="map" resultMap="paymentResult">
83
  <select id="getPaymentsForUser" parameterType="map" resultMap="paymentResult">
77
    SELECT * FROM payment
84
    SELECT * FROM payment
78
    <where>
85
    <where>
79
      userId=#{userId}
-
 
80
      <if test="fromTime != ''">
-
 
81
        AND initTimestamp &gt;= #{fromTime}
-
 
82
      </if>
-
 
83
      <if test="toTime != ''">
-
 
84
        AND initTimestamp &lt;= #{toTime}
-
 
85
      </if>
-
 
86
      <if test="status != -1">
-
 
87
        AND status=#{status}
-
 
88
      </if>
-
 
89
      <if test="gatewayId != -1">
86
      <include refid="getPaymentsWhereClause"/>
90
        AND gatewayId = #{gatewayId}
87
      AND userId=#{userId}
91
      </if>
-
 
92
    </where>
88
    </where>
93
    ORDER BY id
89
    ORDER BY id
94
  </select>
90
  </select>
95
 
91
 
96
  <select id="getMinMaxPaymentAmount" resultType="hashmap">
92
  <select id="getMinMaxPaymentAmount" resultType="hashmap">