OrderVipcardSmapper.xml 6.02 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.OrderVipcardSmapper" >
   <resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderVipcard">
    <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="terminal_source" jdbcType="INTEGER" property="terminalSource" />
    <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="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="qeual_type" jdbcType="INTEGER" property="qeualType" />
    <result column="diff_type" jdbcType="INTEGER" property="diffType" />
    <result column="diff_compare_date" jdbcType="TIMESTAMP" property="diffCompareDate" />
    <result column="trade_service_fee" jdbcType="BIGINT" property="tradeServiceFee" />
    <result column="platform_service_fee" jdbcType="BIGINT" property="platformServiceFee" />
    <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, terminal_source, order_dicount_fee, order_act_fee, 
    order_total_fee, data_state, create_emp_id, create_emp_name, create_date, modfiy_emp_id, 
    modfiy_emp_name, modfiy_date, remark, qeual_type, diff_type, diff_compare_date, trade_service_fee, 
    platform_service_fee, org_id, org_name
  </sql>
  <!-- 通过会员卡订单ID or 主键查询会员卡对象 -->
  <select id="queryOrderVipcardByOrderIdOrId" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.order.vipcardorder.param.OrderVipcardQueryByOrderIdReq" >
    select 
    <include refid="Base_Column_List" />
    from order_vipcard
    where 1=1
     <if test="id != null ">
        and id = #{id,jdbcType=BIGINT}
     </if> 
     <if test="orderId != null and orderId !='' ">
        and order_id = #{orderId,jdbcType=VARCHAR}
     </if> 
     <choose>
      <when test="dataState != null">
        and data_state = #{dataState,jdbcType=INTEGER}
      </when>
      <otherwise>
        and data_state = 1
      </otherwise>
     </choose>
  </select>
  
  <!-- 通过订单Id修改会员卡 -->
  <update id="updateOrderVipCardByOrderId" parameterType="com.zteits.order.domain.OrderVipcard" >
    update order_vipcard
    <set >
      <if test="orderType != null" >
        order_type = #{orderType,jdbcType=INTEGER},
      </if>
      <if test="orderState != null" >
        order_state = #{orderState,jdbcType=INTEGER},
      </if>
      <if test="terminalSource != null" >
        terminal_source = #{terminalSource,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="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>
       <if test="qeualType != null">
        qeual_type = #{qeualType,jdbcType=INTEGER},
      </if>
      <if test="diffType != null">
        diff_type = #{diffType,jdbcType=INTEGER},
      </if>
      <if test="diffCompareDate != null">
        diff_compare_date = #{diffCompareDate,jdbcType=TIMESTAMP},
      </if>
      <if test="tradeServiceFee != null">
        trade_service_fee = #{tradeServiceFee,jdbcType=BIGINT},
      </if>
      <if test="platformServiceFee != null">
        platform_service_fee = #{platformServiceFee,jdbcType=BIGINT},
      </if>
    </set>
    where order_id = #{orderId,jdbcType=VARCHAR}
  </update>
  <!--查询未对账的会员卡订单数据-->
  <select id="queryVipCardForList" resultMap="BaseResultMap">
     select 
    <include refid="Base_Column_List" />
    from order_vipcard
    where 1=1
      AND DATE_FORMAT(create_date,'%Y-%m-%d') =#{createTime}
      AND qeual_type = 0 /**平账类型  -1:帐未平, 0:未开始平账 1:账已平*/
      and data_state = 1
      and order_state in(40,50) /**订单状态 10:待核算、20:待支付、30:支付中,40:已支付、50:已完成*/
      <if test="modId != null and modId >=0">
            and id%#{threadNum}=#{modId}
        </if>
  </select>
</mapper>