<?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.hzya.frame.seeyon.zxbank.dao.impl.ZxBankDaoImpl">
	<resultMap id="get-ZxBankEntity-result" type="com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity">
		<result property="sourceFlowNumber" column="sourceFlowNumber" />
		<result property="documentNo" column="documentNo" />
		<result property="companyCode" column="companyCode" />
		<result property="fundType" column="fundType" />
		<result property="digest" column="digest" />
		<result property="payAccountNum" column="payAccountNum" />
		<result property="payAccountName" column="payAccountName" />
		<result property="recAccountNum" column="recAccountNum" />
		<result property="recAccountName" column="recAccountName" />
		<result property="recBankCode" column="recBankCode" />
		<result property="settleAccountType" column="settleAccountType" />
		<result property="payChannel" column="payChannel" />
		<result property="currency" column="currency" />
		<result property="transAmount" column="transAmount" />
		<result property="payDate" column="payDate" />
		<result property="toPublic" column="toPublic" />
		<result property="purpose" column="purpose" />
		<result property="submitUser" column="submitUser" />
		<result property="tabName" column="tabName" />
		<result property="dataId" column="dataId" />
		<result property="payResultField" column="payResultField" />
		<result property="payDateField" column="payDateField" />
		<result property="receiptFiled" column="receiptFiled" />
		<result property="pushStatusField" column="pushStatusField" />
		<result property="payResult" column="payResult" />
		<result property="receipt" column="receipt" />
		<result property="pushStatus" column="pushStatus" />
		<result property="summaryId" column="summaryId" />

	</resultMap>

	<sql id="ZxBankEntity_Base_Column_List">
		 data_id as dataId
		,source_flow_number as sourceFlowNumber
		,document_no as documentNo
		,company_code as companyCode
		,fund_type as fundType
		,digest as digest
		,pay_account_num as payAccountNum
		,pay_account_name as payAccountName
		,rec_account_num as recAccountNum
		,rec_account_name as recAccountName
		,rec_bank_code as recBankCode
		,settle_account_type as settleAccountType
		,pay_channel as payChannel
		,currency as currency
		,trans_amount as transAmount
		,pay_date as payDate
		,to_public as toPublic
		,purpose as purpose
		,submit_user as submitUser
		,tab_name as tabName
		,pay_result_field as payResultField
		,pay_date_field as payDateField
		,receipt_filed as receiptFiled
		,push_status_field as pushStatusField
		,pay_result as payResult
		,receipt as receipt
		,push_status as pushStatus
		,summary_id as summaryId

	</sql>



	<select id="queryZxBank" resultMap="get-ZxBankEntity-result" parameterType="com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity">
		select
		<include refid="ZxBankEntity_Base_Column_List" />
		from v_hzya_pay where push_status is null
	</select>

	<select id="queryResultIsNullZX" resultMap="get-ZxBankEntity-result" parameterType="com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity">
		select
		<include refid="ZxBankEntity_Base_Column_List" />
		from v_hzya_pay where push_status is not null and (pay_result is null or pay_result='支付中')
	</select>

	<select id="queryElecIsNullZX" resultMap="get-ZxBankEntity-result" parameterType="com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity">
		select
		<include refid="ZxBankEntity_Base_Column_List" />
		from v_hzya_pay where  pay_result='已支付' and receipt is null
	</select>

	<!--通过主键修改方法-->
	<update id="updatePushStatusZX" parameterType = "com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity" >
		update ${tabName} set ${pushStatusField} =#{pushStatus} where id=#{id}
	</update>

	<!--通过主键修改方法-->
	<update id="updateResultStatus" parameterType = "com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity" >
		update ${tabName} set ${payResultField} =#{payResult} where id=#{id}
	</update>

	<!--通过主键修改方法-->
	<update id="updateElecStatusZX" parameterType = "com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity" >
		update ${tabName} set ${receiptFiled} =#{receipt} where id=#{dataId}
	</update>


</mapper>

