OrderRechargeSMapper.xml 7.41 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.OrderRechargeSMapper" >
  <resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderRecharge">
    <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="order_dicount_fee" jdbcType="BIGINT" property="orderDicountFee" />
    <result column="order_act_fee" jdbcType="BIGINT" property="orderActFee" />
    <result column="order_total_fee" jdbcType="BIGINT" property="orderTotalFee" />
    <result column="cust_type" jdbcType="INTEGER" property="custType" />
    <result column="cust_id" jdbcType="VARCHAR" property="custId" />
    <result column="terminal_source" jdbcType="INTEGER" property="terminalSource" />
    <result column="acct_type" jdbcType="INTEGER" property="acctType" />
    <result column="acct_id" jdbcType="VARCHAR" property="acctId" />
    <result column="invoice_state" jdbcType="INTEGER" property="invoiceState" />
    <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="remark" jdbcType="VARCHAR" property="remark" />
    <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, order_dicount_fee, order_act_fee, order_total_fee,
    cust_type, cust_id, terminal_source, acct_type, acct_id, invoice_state, data_state,
    create_emp_id, create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date,
    remark, org_id, org_name
  </sql>
  
  <!-- 根据订单id或者id查询充值单 -->
  <select id="queryOrderRechargeByOrderIdOrId" resultMap="BaseResultMap" parameterType="com.zteits.order.domain.OrderRecharge" >
    select 
    <include refid="Base_Column_List" />
    from order_recharge
    where 1=1
    and data_state = 1
    <if test="id != null" >
    	and id = #{id,jdbcType=BIGINT}
    </if>
    <if test="orderId != null" >
    	and order_id = #{orderId,jdbcType=VARCHAR}
    </if>
  </select>
  
  <!-- 条件查询充值单 -->
  <select id="queryOrderRechargeByCondition" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.order.rechargeorder.param.OrderRechargeQueryReq" >
    select 
    <include refid="Base_Column_List" />
    from order_recharge
    where 1=1
    and data_state = 1
    <if test="id != null" >
    	and id = #{id,jdbcType=BIGINT}
    </if>
    <if test="orderId != null" >
    	and order_id = #{orderId,jdbcType=VARCHAR}
    </if>
    <if test="orderIds != null and orderIds.size >0 ">
      AND order_id IN
      <foreach collection="orderIds" item="orderId" index="index" open="(" close=")" separator=",">
        #{orderId}
      </foreach>
    </if>
    <if test="orderTypeList != null and orderTypeList.size >0 ">
        AND order_type IN
        <foreach collection="orderTypeList" item="orderType" index="index" open="(" close=")" separator=",">
            #{orderType}
        </foreach>
    </if>
    <if test="orderStateList != null and orderStateList.size >0 ">
        AND order_state IN
        <foreach collection="orderStateList" item="orderState" index="index" open="(" close=")" separator=",">
            #{orderState}
        </foreach>
    </if>
    <if test="terminalSourceList != null and terminalSourceList.size >0 ">
        AND terminal_source IN
        <foreach collection="terminalSourceList" item="terminalSource" index="index" open="(" close=")" separator=",">
            #{terminalSource}
        </foreach>
    </if>
    <if test="acctTypeList != null and acctTypeList.size >0 ">
        AND acct_type IN
        <foreach collection="acctTypeList" item="acctType" index="index" open="(" close=")" separator=",">
            #{acctType}
        </foreach>
    </if>
   
    <if test="custType != null and custType !=''">
        and cust_type=#{custType}
    </if>
    <if test="custId != null and custId !=''">
        and cust_id=#{custId}
    </if>
    <if test="acctId != null and acctId !=''">
        and acct_id=#{acctId}
    </if>
    <if test="dataState == null">
        and data_state = 1
    </if>
    <if test="dataState != null">
        and data_state=#{dataState}
    </if>
    
  </select>
  
  <!-- 根据订单id或者id修改充值单信息 -->
  <update id="updateOrderRechargeByOrderIdOrId" parameterType="com.zteits.order.domain.OrderRecharge" >
    update order_recharge
    <set >
      <if test="orderId != null" >
        order_id = #{orderId,jdbcType=VARCHAR},
      </if>
      <if test="orderType != null" >
        order_type = #{orderType,jdbcType=INTEGER},
      </if>
      <if test="orderState != null" >
        order_state = #{orderState,jdbcType=INTEGER},
      </if>
      <if test="orderDicountFee != null" >
        order_dicount_fee = #{orderDicountFee,jdbcType=BIGINT},
      </if>
      <if test="orderActFee != null" >
        order_act_fee = #{orderActFee,jdbcType=BIGINT},
      </if>
      <if test="orderTotalFee != null" >
        order_total_fee = #{orderTotalFee,jdbcType=BIGINT},
      </if>
      <if test="custType != null" >
        cust_type = #{custType,jdbcType=INTEGER},
      </if>
      <if test="custId != null" >
        cust_id = #{custId,jdbcType=VARCHAR},
      </if>
      <if test="terminalSource != null" >
        terminal_source = #{terminalSource,jdbcType=INTEGER},
      </if>
      <if test="acctType != null" >
        acct_type = #{acctType,jdbcType=INTEGER},
      </if>
      <if test="acctId != null" >
        acct_id = #{acctId,jdbcType=VARCHAR},
      </if>
      <if test="invoiceState != null">
        invoice_state = #{invoiceState,jdbcType=INTEGER},
      </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="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where 1=1
    and data_state = 1
    <if test="id != null" >
    	and id = #{id,jdbcType=BIGINT}
    </if>
    <if test="orderId != null" >
    	and order_id = #{orderId,jdbcType=VARCHAR}
    </if>
  </update>
  
</mapper>