<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ylx.massage.mapper.TRechargeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ylx.massage.domain.TRecharge">
        <id column="c_id" property="cId" />
        <result column="recharge_no" property="rechargeNo" />
        <result column="c_open_id" property="cOpenId" />
        <result column="d_money" property="dMoney" />
        <result column="dt_create_time" property="dtCreateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        c_id, c_open_id, d_money, dt_create_time
    </sql>
    <select id="getRecharge" resultType="java.math.BigDecimal">
        SELECT IFNULL(sum(d_money), 0) recharge
        FROM t_recharge
        WHERE is_delete = 0
          AND js_id = #{jsid}
          AND dt_create_time BETWEEN #{startDate}
          AND #{endDate}
          AND pay_status in (1)
    </select>

</mapper>
