TActivityThirdDiscountSMapper.xml 3.75 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.bill.mapper.smapper.TActivityThirdDiscountSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TActivityThirdDiscount">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="disc_no" jdbcType="VARCHAR" property="discNo" />
    <result column="disc_name" jdbcType="VARCHAR" property="discName" />
    <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="pay_type" jdbcType="INTEGER" property="payType" />
    <result column="day_limit_num" jdbcType="INTEGER" property="dayLimitNum" />
    <result column="month_limit_num" jdbcType="INTEGER" property="monthLimitNum" />
    <result column="all_limit_fee" jdbcType="BIGINT" property="allLimitFee" />
    <result column="residue_limit_fee" jdbcType="BIGINT" property="residueLimitFee" />
    <result column="order_min_fee" jdbcType="BIGINT" property="orderMinFee" />
    <result column="order_max_fee" jdbcType="BIGINT" property="orderMaxFee" />
    <result column="order_fee" jdbcType="BIGINT" property="orderFee" />
    <result column="disc_type" jdbcType="INTEGER" property="discType" />
    <result column="third_disc" jdbcType="INTEGER" property="thirdDisc" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="disc_state" jdbcType="INTEGER" property="discState" />
    <result column="auditor_status" jdbcType="INTEGER" property="auditorStatus" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
    <result column="create_name" jdbcType="VARCHAR" property="createName" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modify_emp_id" jdbcType="VARCHAR" property="modifyEmpId" />
    <result column="modify_name" jdbcType="VARCHAR" property="modifyName" />
    <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
    <result column="no_pass_pay_switch" jdbcType="INTEGER" property="noPassPaySwitch" />
    <result column="app_pay_switch" jdbcType="INTEGER" property="appPaySwitch" />
    <result column="h5_pay_switch" jdbcType="INTEGER" property="h5PaySwitch" />
  </resultMap>
  <sql id="Base_Column_List">
    id, disc_no, disc_name, begin_time, end_time, pay_type, day_limit_num, month_limit_num,
    all_limit_fee, residue_limit_fee, order_min_fee, order_max_fee, order_fee, disc_type,
    third_disc, org_id, disc_state, auditor_status, remarks, data_state, create_emp_id,
    create_name, create_date, modify_emp_id, modify_name, modify_date, no_pass_pay_switch,
    app_pay_switch, h5_pay_switch
  </sql>

  <!--  -->
  <select id="queryUseActivityThirdDiscount" parameterType="com.zteits.clouds.api.dto.bill.param.TActivityThirdDiscountRequest" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_activity_third_discount
    where data_state = 1
    and disc_state = 1
    and auditor_status = 2
    <![CDATA[and begin_time <= #{nowTime}]]>
    <![CDATA[and end_time >=#{nowTime}]]>
    and pay_type = #{payType}
    and org_id = #{orgId}
    and residue_limit_fee > (#{payFee} - order_fee)*third_disc/100
  </select>

  <update id="upateThirdDiscountResidueFee" parameterType="com.zteits.clouds.api.dto.bill.param.TActivityThirdDiscountRequest">
    update t_activity_third_discount
    set residue_limit_fee = residue_limit_fee - #{payFee},
    modify_date = #{nowTime}
    where disc_no = #{discNo}
  </update>

</mapper>