|  |  | 
 |  |  |     SELECT | 
 |  |  |       DISTINCT Date(ope.operate_dt) AS operateDate | 
 |  |  |     FROM se_card_operate ope | 
 |  |  |     WHERE Date(ope.operate_dt) NOT IN(SELECT operate_date FROM se_general) AND Date(ope.operate_dt) != CURDATE() | 
 |  |  |     WHERE Date(ope.operate_dt) NOT IN(SELECT operate_date FROM se_general) | 
 |  |  | <!--      取消当天限制--> | 
 |  |  | <!--      AND Date(ope.operate_dt) != CURDATE()--> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--根据交易日期获取总账记录列表(待生成的)  --> | 
 |  |  | 
 |  |  |         1 AS auditStatus | 
 |  |  |     FROM se_card_operate ope | 
 |  |  |         INNER JOIN ba_user us ON ope.operator = us.id | 
 |  |  |     WHERE Date(ope.operate_dt) = #{operateDate} | 
 |  |  |     WHERE Date(ope.operate_dt) = #{operateDate} AND ope.operate_valid = 2 | 
 |  |  |     GROUP BY ope.operator, Date(ope.operate_dt) | 
 |  |  |  | 
 |  |  |     UNION ALL | 
 |  |  | 
 |  |  |   <!--获取指定日期、指定收银员、指定支付方式实收金额合计--> | 
 |  |  |   <select id="getPaymentSums" resultType="java.lang.Float"> | 
 |  |  |     SELECT | 
 |  |  |     SUM(ope.trade_amount) AS tradeAmount | 
 |  |  |         (SUM(ope.trade_amount) + SUM(ope.card_cost)) AS tradeAmount | 
 |  |  |     FROM se_card_operate ope | 
 |  |  |     <where> | 
 |  |  |       AND ope.operate_valid = 2 | 
 |  |  |       <if test = "tradeDate != null and tradeDate !=''"> | 
 |  |  |         AND Date(ope.operate_dt) = #{tradeDate} | 
 |  |  |       </if> | 
 |  |  | 
 |  |  |         AND ope.operator = #{cashierId} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     GROUP BY ope.payment_id,  Date(ope.operate_dt) | 
 |  |  | <!--    GROUP BY ope.payment_id,  Date(ope.operate_dt)--> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--  财务对账审核页,收银员+日期分组,排除交易类型分组,记录数--> | 
 |  |  | 
 |  |  |  | 
 |  |  |   <!--开卡系统交易统计,收银员+日期+类型分组--> | 
 |  |  |   <select id="getSummaries" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> | 
 |  |  |     SELECT * FROM v_trade_summary | 
 |  |  |     SELECT | 
 |  |  |         CASE | 
 |  |  |             WHEN ope.operate_type = 1 THEN '开卡' | 
 |  |  |             WHEN ope.operate_type = 2 THEN '充值' | 
 |  |  |             WHEN ope.operate_type = 3 THEN '销卡' | 
 |  |  |             WHEN ope.operate_type = 4 THEN '补卡' | 
 |  |  |             WHEN ope.operate_type = 5 THEN '返还' | 
 |  |  |             WHEN ope.operate_type = 10 THEN '反写' | 
 |  |  |         END AS operateType, | 
 |  |  |         Date(ope.operate_dt) AS tradeDate, | 
 |  |  |         COUNT(*) AS count, | 
 |  |  |         (IFNULL(SUM(ope.trade_amount), 0) + IFNULL(SUM(ope.card_cost), 0)) AS received, | 
 |  |  |         IFNULL(SUM(ope.gift), 0) AS gift, | 
 |  |  |         IFNULL(sum(ope.refund_amount),0) AS refundAmount, | 
 |  |  |         us.id AS cashierId | 
 |  |  |     FROM se_card_operate ope | 
 |  |  |         INNER JOIN ba_user us ON us.id = ope.operator | 
 |  |  |     <where> | 
 |  |  |       AND ope.operate_type IN(1,2,3,4,5,10) | 
 |  |  |       AND ope.operate_valid = 2 | 
 |  |  |       <if test = "cashierId != null and cashierId > 0"> | 
 |  |  |         AND cashierId = #{cashierId} | 
 |  |  |         AND us.id = #{cashierId} | 
 |  |  |       </if> | 
 |  |  |  | 
 |  |  |       <if test = "timeStart != null and timeStop != null"> | 
 |  |  |         AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop} | 
 |  |  |         AND Date(ope.operate_dt) BETWEEN #{timeStart} AND #{timeStop} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     GROUP BY ope.operate_type,  Date(ope.operate_dt), us.id | 
 |  |  |     ORDER BY tradeDate | 
 |  |  |  | 
 |  |  | <!--    SELECT * FROM v_trade_summary--> | 
 |  |  | <!--    <where>--> | 
 |  |  | <!--      <if test = "cashierId != null and cashierId > 0">--> | 
 |  |  | <!--        AND cashierId = #{cashierId}--> | 
 |  |  | <!--      </if>--> | 
 |  |  |  | 
 |  |  | <!--      <if test = "timeStart != null and timeStop != null">--> | 
 |  |  | <!--        AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop}--> | 
 |  |  | <!--      </if>--> | 
 |  |  | <!--    </where>--> | 
 |  |  | <!--    ORDER BY tradeDate--> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--  根据收银员ID及日期获取财务对账_交易明细记录数--> | 
 |  |  | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </select> | 
 |  |  |   <!-- 删除今天的总账--> | 
 |  |  |   <delete id="deleteTodayGeneral"> | 
 |  |  |     DELETE FROM se_general | 
 |  |  |     WHERE operate_date = DATE(NOW()) | 
 |  |  |   </delete> | 
 |  |  | </mapper> |