zhubaomin
2025-04-07 ecef3df4890be54c1da2a8a4fc1c8c1f50f1c263
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml
@@ -147,4 +147,54 @@
      vct = #{vct,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据农户ID获取消费汇总记录-->
  <select id="getWalletConsumeSum" resultType="java.util.Map">
    SELECT
      cli.name AS clientName,
      cli.clientNum,
      wal.money,
      (SELECT SUM(consumption) FROM se_consume WHERE client_id = cli.id) AS totalConsume
    FROM se_client cli
           INNER JOIN se_wallet wal ON wal.client_id = cli.id
    <where>
      <if test = "clientId != null and clientId > 0">
        AND cli.id = ${clientId}
      </if>
    </where>
  </select>
  <!--根据农户ID获取电子钱包消费记录数-->
  <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM se_consume
    <where>
      <if test = "clientId != null and clientId > 0">
        AND client_id = ${clientId}
      </if>
    </where>
  </select>
  <!--根据农户ID获取电子钱包消费记录-->
  <select id="getWalletConsumes" resultType="com.dy.pipIrrGlobal.voSe.VoWalletConsume">
    SELECT
        consumption,
        duration,
        vot,
        vct
    FROM se_consume
    <where>
      <if test = "clientId != null and clientId > 0">
        AND client_id = ${clientId}
      </if>
    </where>
    ORDER BY vct DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
</mapper>