OrderChargeInfoSMapper.xml 4.87 KB
<?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.OrderChargeInfoSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderChargeInfo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_id" jdbcType="VARCHAR" property="orderId" />
    <result column="charge_type" jdbcType="INTEGER" property="chargeType" />
    <result column="connector_code" jdbcType="VARCHAR" property="connectorCode" />
    <result column="operator_id" jdbcType="VARCHAR" property="operatorId" />
    <result column="order_state" jdbcType="INTEGER" property="orderState" />
    <result column="charge_order_state" jdbcType="INTEGER" property="chargeOrderState" />
    <result column="connector_id" jdbcType="VARCHAR" property="connectorId" />
    <result column="charge_card_no" jdbcType="VARCHAR" property="chargeCardNo" />
    <result column="charge_acct_id" jdbcType="VARCHAR" property="chargeAcctId" />
    <result column="car_owner_cust_id" jdbcType="VARCHAR" property="carOwnerCustId" />
    <result column="car_owner_phone" jdbcType="VARCHAR" property="carOwnerPhone" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="total_power" jdbcType="DECIMAL" property="totalPower" />
    <result column="pre_act_fee" jdbcType="BIGINT" property="preActFee" />
    <result column="order_elec_fee" jdbcType="BIGINT" property="orderElecFee" />
    <result column="order_sevice_fee" jdbcType="BIGINT" property="orderSeviceFee" />
    <result column="order_total_fee" jdbcType="BIGINT" property="orderTotalFee" />
    <result column="order_act_fee" jdbcType="BIGINT" property="orderActFee" />
    <result column="order_discount_fee" jdbcType="BIGINT" property="orderDiscountFee" />
    <result column="order_discount_type" jdbcType="INTEGER" property="orderDiscountType" />
    <result column="refund_act_fee" jdbcType="BIGINT" property="refundActFee" />
    <result column="stop_reason" jdbcType="INTEGER" property="stopReason" />
    <result column="sum_period" jdbcType="INTEGER" property="sumPeriod" />
    <result column="charge_details" jdbcType="VARCHAR" property="chargeDetails" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="app_state" jdbcType="INTEGER" property="appState" />
    <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="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
  </resultMap>
  <sql id="Base_Column_List">
    id, order_id, charge_type, connector_code, operator_id, order_state, charge_order_state, connector_id,
    charge_card_no, charge_acct_id, car_owner_cust_id, car_owner_phone, start_time, end_time, 
    total_power, pre_act_fee, order_elec_fee, order_sevice_fee, order_total_fee, order_act_fee, 
    order_discount_fee, order_discount_type, refund_act_fee, stop_reason, sum_period, 
    charge_details, remark, app_state, data_state, create_emp_id, create_emp_name, create_date, 
    modfiy_emp_id, modfiy_emp_name, modfiy_date, org_id, org_name
  </sql>

  <select id="queryOrderChargeInfo" parameterType="com.zteits.clouds.api.dto.order.chargeorder.param.OrderChargeInfoPageQueryRequest" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from order_charge_info
    where data_state = 1 and order_state > 30
    <if test="cardNo != null and cardNo != ''">
      and charge_card_no = #{cardNo}
    </if>
    <if test="carOwnerCustId != null and carOwnerCustId != ''">
      and car_owner_cust_id = #{carOwnerCustId}
    </if>
    <if test="userPhone != null and userPhone != ''">
      and car_owner_phone = #{userPhone}
    </if>
    <if test="startTime != null and startTime != '' and endTime != null  and endTime != ''">
      and create_date >= #{startTime} and  #{endTime} >= create_date
    </if>
    <if test="orgId !=null">
      AND org_id = #{orgId}
    </if>
    <if test="querySource == null">
    order by create_date desc
    </if>
    <if test="querySource != null and querySource == 1">
      order by
      CASE
      WHEN charge_order_state IN (0, 1, 2) THEN 0
      WHEN charge_order_state IN (3, 4, 5) THEN 1
      END,
      create_date desc
    </if>
  </select>

</mapper>