OrderTransferSMapper.xml 6.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.OrderTransferSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderTransfer">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_id" jdbcType="VARCHAR" property="orderId" />
    <result column="order_type" jdbcType="INTEGER" property="orderType" />
    <result column="order_state" jdbcType="INTEGER" property="orderState" />
    <result column="total_fee" jdbcType="BIGINT" property="totalFee" />
    <result column="act_fee" jdbcType="BIGINT" property="actFee" />
    <result column="terminal_source" jdbcType="INTEGER" property="terminalSource" />
    <result column="pay_type" jdbcType="INTEGER" property="payType" />
    <result column="transfer_finish_time" jdbcType="TIMESTAMP" property="transferFinishTime" />
    <result column="cust_id" jdbcType="VARCHAR" property="custId" />
    <result column="payer_id" jdbcType="VARCHAR" property="payerId" />
    <result column="payer_name" jdbcType="VARCHAR" property="payerName" />
    <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
    <result column="audit_state" jdbcType="INTEGER" property="auditState" />
    <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
    <result column="try_num" jdbcType="INTEGER" property="tryNum" />
    <result column="merchant_no" jdbcType="VARCHAR" property="merchantNo" />
    <result column="error_code" jdbcType="VARCHAR" property="errorCode" />
    <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
    <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="app_id" jdbcType="VARCHAR" property="appId" />
    <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, order_type, order_state, total_fee, act_fee, terminal_source, pay_type, 
    transfer_finish_time, cust_id, payer_id, payer_name, user_phone, audit_state, transaction_id, 
    try_num, merchant_no, error_code, error_msg, remark, data_state, create_emp_id, create_emp_name, 
    create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date, app_id,org_id,org_name
  </sql>
  <select id="queryOrderTransfebyOrderId" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from order_transfer
    where order_id = #{orderId,jdbcType=VARCHAR}
    and data_state = 1
  </select>

  <select id="queryOrderTransfe" parameterType="com.zteits.order.domain.OrderTransfer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from order_transfer
    where data_state = 1
    <if test="custId != null">
     and cust_id = #{custId,jdbcType=VARCHAR}
    </if>
    <if test="createDate != null">
      <![CDATA[ and  DATE_FORMAT(create_date,'%Y%m') = DATE_FORMAT(#{createDate},'%Y%m') ]]>
    </if>
  </select>

  <select id="queryTransFerDate" parameterType="com.zteits.order.domain.OrderTransfer" resultType="java.lang.String">
    select
    DISTINCT DATE_FORMAT(create_date,'%Y%m') createDate
    from order_transfer
    where data_state = 1
    <if test="custId != null">
      and cust_id = #{custId,jdbcType=VARCHAR}
    </if>
    <if test="createDate != null">
      <![CDATA[ and  DATE_FORMAT(create_date,'%Y%m') >= DATE_FORMAT(#{createDate},'%Y%m')  ]]>
    </if>
  </select>

  <update id="updateOrderTransferByOrderId" parameterType="com.zteits.order.domain.OrderTransfer">
    update order_transfer
    <set>

      <if test="orderType != null">
        order_type = #{orderType,jdbcType=INTEGER},
      </if>
      <if test="orderState != null">
        order_state = #{orderState,jdbcType=INTEGER},
      </if>
      <if test="totalFee != null">
        total_fee = #{totalFee,jdbcType=BIGINT},
      </if>
      <if test="actFee != null">
        act_fee = #{actFee,jdbcType=BIGINT},
      </if>
      <if test="terminalSource != null">
        terminal_source = #{terminalSource,jdbcType=INTEGER},
      </if>
      <if test="payType != null">
        pay_type = #{payType,jdbcType=INTEGER},
      </if>
      <if test="transferFinishTime != null">
        transfer_finish_time = #{transferFinishTime,jdbcType=TIMESTAMP},
      </if>
      <if test="custId != null">
        cust_id = #{custId,jdbcType=VARCHAR},
      </if>
      <if test="payerId != null">
        payer_id = #{payerId,jdbcType=VARCHAR},
      </if>
      <if test="payerName != null">
        payer_name = #{payerName,jdbcType=VARCHAR},
      </if>
      <if test="userPhone != null">
        user_phone = #{userPhone,jdbcType=VARCHAR},
      </if>
      <if test="auditState != null">
        audit_state = #{auditState,jdbcType=INTEGER},
      </if>
      <if test="transactionId != null">
        transaction_id = #{transactionId,jdbcType=VARCHAR},
      </if>
      <if test="tryNum != null">
        try_num = #{tryNum,jdbcType=INTEGER},
      </if>
      <if test="merchantNo != null">
        merchant_no = #{merchantNo,jdbcType=VARCHAR},
      </if>
      <if test="errorCode != null">
        error_code = #{errorCode,jdbcType=VARCHAR},
      </if>
      <if test="errorMsg != null">
        error_msg = #{errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="dataState != null">
        data_state = #{dataState,jdbcType=INTEGER},
      </if>
      <if test="createEmpId != null">
        create_emp_id = #{createEmpId,jdbcType=VARCHAR},
      </if>
      <if test="createEmpName != null">
        create_emp_name = #{createEmpName,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null">
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="modfiyEmpId != null">
        modfiy_emp_id = #{modfiyEmpId,jdbcType=VARCHAR},
      </if>
      <if test="modfiyEmpName != null">
        modfiy_emp_name = #{modfiyEmpName,jdbcType=VARCHAR},
      </if>
      <if test="modfiyDate != null">
        modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP},
      </if>
      <if test="appId != null">
        app_id = #{appId,jdbcType=VARCHAR},
      </if>
    </set>
    where order_id = #{orderId,jdbcType=VARCHAR}
  </update>

</mapper>