IMStoreAccountOrderCheckingMapper.xml 5.9 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.sibu.orderHelper.integral.web.dao.IMWebStoreAccountOrderCheckingDao">

	<sql id="column">
		order_checking_id,
		supplier_id,
		supplier_name,
		settle_start_date,
		settle_end_date,
		business_money,
		reality_business_money,
		coupon_money,
		refund_money,
		service_charge,
		receivable_service_charge,
		discount_rate,
		profits,
		audit_status,
		create_sys_user_id,
		create_dt,
		audit_sys_user_id,
		audit_dt,
		affirm_sys_user_id,
		affirm_dt,
		deduction_vb,
		deduction_vb_price,
		lose_dt,
		refund_vb_price,
		refund_vb
	</sql>

	<resultMap type="com.sibu.orderHelper.integral.model.StoreAccountOrderChecking" id="accountOrderChecking">
		<id column="order_checking_id" property="orderCheckingId" />
		<result column="supplier_id" property="supplierId" />
		<result column="supplier_name" property="supplierName"></result>
		<result column="settle_start_date" property="settleStartDate" />
		<result column="settle_end_date" property="settleEndDate" />
		<result column="business_money" property="businessMoney" />
		<result column="reality_business_money" property="realityBusinessMoney" />
		<result column="coupon_money" property="couponMoney" />
		<result column="refund_money" property="refundMoney" />
		<result column="service_charge" property="serviceCharge" />
		<result column="receivable_service_charge" property="receivableServiceCharge" />
		<result column="discount_rate" property="discountRate" />
		<result column="profits" property="profits" />
		<result column="audit_status" property="auditStatus" />
		<result column="create_sys_user_id" property="createSysUserId" />
		<result column="create_dt" property="createDt" />
		<result column="audit_sys_user_id" property="auditSysUserId" />
		<result column="audit_dt" property="auditDt" />
		<result column="deduction_vb_price" property="deductionVbPrice" />
		<result column="deduction_vb" property="deductionVb" />
		<result column="affirm_sys_user_id" property="affirmSysUserId" />
		<result column="affirm_dt" property="affirmDt" />
		<result column="lose_dt" property="loseDt" />
		<result column="refund_vb_price" property="refundVbPrice" />
		<result column="refund_vb" property="refundVb" />
	</resultMap>

	<resultMap type="com.sibu.orderHelper.integral.model.ExportExcelAccountOrderChecking" id="exportAccountOrderChecking">
		<id column="order_checking_id" property="orderCheckingId" />
		<result column="supplier_id" property="supplierId" />
		<result column="supplier_name" property="supplierName"></result>
		<result column="settle_start_date" property="settleStartDate" />
		<result column="settle_end_date" property="settleEndDate" />
		<result column="business_money" property="businessMoney" />
		<result column="reality_business_money" property="realityBusinessMoney" />
		<result column="coupon_money" property="couponMoney" />
		<result column="refund_money" property="refundMoney" />
		<result column="service_charge" property="serviceCharge" />
		<result column="receivable_service_charge" property="receivableServiceCharge" />
		<result column="discount_rate" property="discountRate" />
		<result column="profits" property="profits" />
		<result column="audit_status" property="auditStatus" />
		<result column="create_sys_user_id" property="createSysUserId" />
		<result column="create_dt" property="createDt" />
		<result column="audit_sys_user_id" property="auditSysUserId" />
		<result column="audit_dt" property="auditDt" />
		<result column="deduction_vb_price" property="deductionVbPrice" />
		<result column="deduction_vb" property="deductionVb" />
		<result column="affirm_sys_user_id" property="affirmSysUserId" />
		<result column="affirm_dt" property="affirmDt" />
		<result column="lose_dt" property="loseDt" />
		<result column="refund_vb_price" property="refundVbPrice" />
		<result column="refund_vb" property="refundVb" />
	</resultMap>

   	<!-- 对账单列表查询-->
   	<select id="listAccountOrder" parameterType="map" resultMap="accountOrderChecking">
	 	select <include refid="column"></include>
	 	from acc_order_checking  acc
		where 1=1
			and acc.supplier_id = #{supplierId}
			and acc.audit_status in(3,4,5)
		<if test="auditStatus !=null and auditStatus!=''">
			and acc.audit_status = #{auditStatus}
		</if>
		<if test="settleStartDate != null and settleStartDate !=''">
			and acc.settle_end_date >= #{settleStartDate}
		</if>
		<if test="settleEndDate != null and settleEndDate != ''">
			<![CDATA[
		   and acc.settle_end_date <= #{settleEndDate}
		  ]]>
		</if>
	 	limit ${pageNow}, ${pageSize}
   	</select>

	<!-- 查询对账单数量 -->
   	<select id="countAccountOrder" parameterType="map" resultType="int">
   		select count(1) as number
		from acc_order_checking  acc
		where 1=1
			and acc.supplier_id = #{supplierId}
		    and acc.audit_status in(3,4,5)
		<if test="auditStatus !=null and auditStatus!=''">
			and acc.audit_status = #{auditStatus}
		</if>
		<if test="settleStartDate != null and settleStartDate !=''">
			and acc.settle_end_date >= #{settleStartDate}
		</if>
		<if test="settleEndDate != null and settleEndDate != ''">
			<![CDATA[
		   and acc.settle_end_date <= #{settleEndDate}
		  ]]>
		</if>
   	</select>

	<!-- 确认对账单 -->
	<update id="passOrder" parameterType="map">
		UPDATE acc_order_checking  acc
		<trim prefix="SET" suffixOverrides=",">
			audit_status = 4,affirm_dt=now(),
		</trim>
		WHERE order_checking_id = #{orderCheckingId} and acc.supplier_id = #{supplierId}
	</update>

	<!-- 通过id导出对账单-->
	<select id="exportAccountOrderById"  resultMap="exportAccountOrderChecking">
		select <include refid="column"></include>
		from acc_order_checking
		where 1=1
		<if test="orderCheckingId !=null and orderCheckingId!=''">
			and order_checking_id = #{orderCheckingId}
		</if>
		<if test="supplierId !=null and supplierId!=''">
			and supplier_id = #{supplierId}
		</if>
	</select>
</mapper>