Blame view

parking-module-order/src/main/resources/mybatis/mapper/smapper/CashRefundSMapper.xml 4.13 KB
55f68655   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  <?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.zteits.order.mapper.smapper.CashRefundSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.order.domain.CashRefund">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="record_id" jdbcType="VARCHAR" property="recordId" />
      <result column="query_date" jdbcType="DATE" property="queryDate" />
      <result column="payer_id" jdbcType="VARCHAR" property="payerId" />
      <result column="pay_type" jdbcType="INTEGER" property="payType" />
      <result column="order_total_fee" jdbcType="BIGINT" property="orderTotalFee" />
      <result column="order_act_fee" jdbcType="BIGINT" property="orderActFee" />
      <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
      <result column="park_in_time" jdbcType="TIMESTAMP" property="parkInTime" />
      <result column="pay_finish_time" jdbcType="TIMESTAMP" property="payFinishTime" />
      <result column="pay_order_state" jdbcType="INTEGER" property="payOrderState" />
      <result column="remark" jdbcType="VARCHAR" property="remark" />
      <result column="data_state" jdbcType="INTEGER" property="dataState" />
      <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
      <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
      <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
      <result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
      <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
      <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
      <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
      <result column="org_id" jdbcType="BIGINT" property="orgId" />
      <result column="org_name" jdbcType="VARCHAR" property="orgName" />
      <result column="pay_order_out_id" jdbcType="VARCHAR" property="payOrderOutId" />
    </resultMap>
    
    <sql id="Base_Column_List">
      id, record_id, query_date, payer_id, pay_type, order_total_fee, order_act_fee, car_number, 
      park_in_time, pay_finish_time, pay_order_state, remark, data_state, create_emp_id, 
      create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date, pl_no, 
      org_id, org_name, pay_order_out_id
    </sql>
    <select id="queryCashRefundForTotal" parameterType="com.zteits.clouds.api.dto.order.param.CashRefundRequest" 
    	resultType="com.zteits.clouds.api.dto.order.dto.CashRefundTotalDTO">
      select
      	IFNULL(SUM(order_act_fee),0) orderActFee,
  		IFNULL(sum(case  when (pay_type=2 AND pay_order_state = 40) then order_act_fee - order_total_fee else 0 end ),0) as wxPaidFee,
  		IFNULL(sum(case  when (pay_type=1 AND pay_order_state = 40) then order_act_fee - order_total_fee else 0 end ),0) as aliPaidFee,
  		IFNULL(sum(case  when (pay_order_state != 40) then order_act_fee - order_total_fee else 0 end ),0) as nonePaidFee
      from cash_refund
      where data_state = 1
      <if test="beginTime !=null">
          AND park_out_time &gt;= #{beginTime}
      </if>
      <if test="endTime !=null">
          AND park_out_time &lt;= #{endTime}
      </if>
      <if test="payBeginTime !=null">
          AND pay_finish_time &gt;= #{payBeginTime}
      </if>
      <if test="payEndTime !=null">
          AND pay_finish_time &lt;= #{payEndTime}
      </if>
      <if test="orgId != null ">
      	and org_id = #{orgId}
      </if>
      <if test="payTypes != null and payTypes.size > 0">
          and pay_type in
             <foreach collection="payTypes" open="(" close=")" item="payType" separator=",">
                 #{payType}
             </foreach>
      </if>
      <if test="plNos != null and plNos.size > 0">
          and pl_no in
             <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                 #{plNo}
             </foreach>
      </if>
      <if test="payOrderStates != null and payOrderStates.size > 0">
          and pay_order_states in
             <foreach collection="payOrderStates" open="(" close=")" item="payOrderState" separator=",">
                 #{payOrderState}
             </foreach>
      </if>
    </select>
    
  </mapper>