<?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.leromro.core.mapper.VolunteerTakeRecordMapper">
    
    <resultMap type="VolunteerTakeRecord" id="VolunteerTakeRecordResult">
        <result property="volunteerTakeRecordId"    column="volunteer_take_record_id"    />
        <result property="takeSn"    column="take_sn"    />
        <result property="volunteerAccountId"    column="volunteer_account_id"    />
        <result property="volunteerUserId"    column="volunteer_user_id"    />
        <result property="takeAmount"    column="take_amount"    />
        <result property="shoudAmount"    column="shoud_amount"    />
        <result property="taxAmount"    column="tax_amount"    />
        <result property="receiveAmount"    column="receive_amount"    />
        <result property="payType"    column="pay_type"    />
        <result property="bankName"    column="bank_name"    />
        <result property="bankCode"    column="bank_code"    />
        <result property="bankCardUser"    column="bank_card_user"    />
        <result property="bankCardSn"    column="bank_card_sn"    />
        <result property="bankCardAddress"    column="bank_card_address"    />
        <result property="payTime"    column="pay_time"    />
        <result property="payNote"    column="pay_note"    />
        <result property="payName"    column="pay_name"    />
        <result property="isPay"    column="is_pay"    />
        <result property="paySn"    column="pay_sn"    />
        <result property="payVoucherPics"    column="pay_voucher_pics"    />
        <result property="deleted"    column="deleted"    />
        <result property="alipayAccountNo"    column="alipay_account_no"    />
        <result property="alipayName"    column="alipay_name"    />
        <result property="paymentRecordId"    column="payment_record_id"    />
        <result property="lastTime"    column="last_time"    />
        <result property="payCode"    column="pay_code"    />
        <result property="appTime"    column="app_time"    />
        <result property="appStatus"    column="app_status"    />
        <result property="appUserId"    column="app_user_id"    />
        <result property="appUserName"    column="app_user_name"    />
        <result property="rejectReason"    column="reject_reason"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectVolunteerTakeRecordVo">
        select * from l_volunteer_take_record
    </sql>

    <select id="selectVolunteerTakeRecordList" parameterType="VolunteerTakeRecord" resultMap="VolunteerTakeRecordResult">
        <include refid="selectVolunteerTakeRecordVo"/>
        <where>  
            <if test="takeSn != null  and takeSn != ''"> and take_sn = #{takeSn}</if>
            <if test="volunteerAccountId != null "> and volunteer_account_id = #{volunteerAccountId}</if>
            <if test="volunteerUserId != null "> and volunteer_user_id = #{volunteerUserId}</if>
            <if test="takeAmount != null "> and take_amount = #{takeAmount}</if>
            <if test="shoudAmount != null "> and shoud_amount = #{shoudAmount}</if>
            <if test="taxAmount != null "> and tax_amount = #{taxAmount}</if>
            <if test="receiveAmount != null "> and receive_amount = #{receiveAmount}</if>
            <if test="payType != null  and payType != ''"> and pay_type = #{payType}</if>
            <if test="bankName != null  and bankName != ''"> and bank_name like concat('%', #{bankName}, '%')</if>
            <if test="bankCode != null  and bankCode != ''"> and bank_code = #{bankCode}</if>
            <if test="bankCardUser != null  and bankCardUser != ''"> and bank_card_user = #{bankCardUser}</if>
            <if test="bankCardSn != null  and bankCardSn != ''"> and bank_card_sn = #{bankCardSn}</if>
            <if test="bankCardAddress != null  and bankCardAddress != ''"> and bank_card_address = #{bankCardAddress}</if>
            <if test="payTime != null "> and pay_time = #{payTime}</if>
            <if test="payNote != null  and payNote != ''"> and pay_note = #{payNote}</if>
            <if test="payName != null  and payName != ''"> and pay_name like concat('%', #{payName}, '%')</if>
            <if test="isPay != null  and isPay != ''"> and is_pay = #{isPay}</if>
            <if test="paySn != null  and paySn != ''"> and pay_sn = #{paySn}</if>
            <if test="payVoucherPics != null  and payVoucherPics != ''"> and pay_voucher_pics = #{payVoucherPics}</if>
            <if test="deleted != null  and deleted != ''"> and deleted = #{deleted}</if>
            <if test="alipayAccountNo != null  and alipayAccountNo != ''"> and alipay_account_no = #{alipayAccountNo}</if>
            <if test="alipayName != null  and alipayName != ''"> and alipay_name like concat('%', #{alipayName}, '%')</if>
            <if test="paymentRecordId != null "> and payment_record_id = #{paymentRecordId}</if>
            <if test="lastTime != null "> and last_time = #{lastTime}</if>
            <if test="payCode != null  and payCode != ''"> and pay_code = #{payCode}</if>
            <if test="rejectReason != null  and rejectReason != ''"> and reject_reason = #{rejectReason}</if>
            <if test="appStatus != null and appStatus != ''">and app_status = #{appStatus}</if>
        </where>
    </select>
    
    <select id="selectVolunteerTakeRecordByVolunteerTakeRecordId" parameterType="Long" resultMap="VolunteerTakeRecordResult">
        <include refid="selectVolunteerTakeRecordVo"/>
        where volunteer_take_record_id = #{volunteerTakeRecordId}
    </select>

    <insert id="insertVolunteerTakeRecord" parameterType="VolunteerTakeRecord">
        insert into l_volunteer_take_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="volunteerTakeRecordId != null">volunteer_take_record_id,</if>
            <if test="takeSn != null">take_sn,</if>
            <if test="volunteerAccountId != null">volunteer_account_id,</if>
            <if test="volunteerUserId != null">volunteer_user_id,</if>
            <if test="takeAmount != null">take_amount,</if>
            <if test="shoudAmount != null">shoud_amount,</if>
            <if test="taxAmount != null">tax_amount,</if>
            <if test="receiveAmount != null">receive_amount,</if>
            <if test="payType != null">pay_type,</if>
            <if test="bankName != null">bank_name,</if>
            <if test="bankCode != null">bank_code,</if>
            <if test="bankCardUser != null">bank_card_user,</if>
            <if test="bankCardSn != null">bank_card_sn,</if>
            <if test="bankCardAddress != null">bank_card_address,</if>
            <if test="payTime != null">pay_time,</if>
            <if test="payNote != null">pay_note,</if>
            <if test="payName != null">pay_name,</if>
            <if test="isPay != null">is_pay,</if>
            <if test="paySn != null">pay_sn,</if>
            <if test="payVoucherPics != null">pay_voucher_pics,</if>
            <if test="deleted != null">deleted,</if>
            <if test="alipayAccountNo != null">alipay_account_no,</if>
            <if test="alipayName != null">alipay_name,</if>
            <if test="paymentRecordId != null">payment_record_id,</if>
            <if test="lastTime != null">last_time,</if>
            <if test="payCode != null">pay_code,</if>
            <if test="checkTime != null">check_time,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="checkUserId != null">check_user_id,</if>
            <if test="checkUserName != null">check_user_name,</if>
            <if test="rejectReason != null">reject_reason,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="volunteerTakeRecordId != null">#{volunteerTakeRecordId},</if>
            <if test="takeSn != null">#{takeSn},</if>
            <if test="volunteerAccountId != null">#{volunteerAccountId},</if>
            <if test="volunteerUserId != null">#{volunteerUserId},</if>
            <if test="takeAmount != null">#{takeAmount},</if>
            <if test="shoudAmount != null">#{shoudAmount},</if>
            <if test="taxAmount != null">#{taxAmount},</if>
            <if test="receiveAmount != null">#{receiveAmount},</if>
            <if test="payType != null">#{payType},</if>
            <if test="bankName != null">#{bankName},</if>
            <if test="bankCode != null">#{bankCode},</if>
            <if test="bankCardUser != null">#{bankCardUser},</if>
            <if test="bankCardSn != null">#{bankCardSn},</if>
            <if test="bankCardAddress != null">#{bankCardAddress},</if>
            <if test="payTime != null">#{payTime},</if>
            <if test="payNote != null">#{payNote},</if>
            <if test="payName != null">#{payName},</if>
            <if test="isPay != null">#{isPay},</if>
            <if test="paySn != null">#{paySn},</if>
            <if test="payVoucherPics != null">#{payVoucherPics},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="alipayAccountNo != null">#{alipayAccountNo},</if>
            <if test="alipayName != null">#{alipayName},</if>
            <if test="paymentRecordId != null">#{paymentRecordId},</if>
            <if test="lastTime != null">#{lastTime},</if>
            <if test="payCode != null">#{payCode},</if>
            <if test="checkTime != null">#{checkTime},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="checkUserId != null">#{checkUserId},</if>
            <if test="checkUserName != null">#{checkUserName},</if>
            <if test="rejectReason != null">#{rejectReason},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateVolunteerTakeRecord" parameterType="VolunteerTakeRecord">
        update l_volunteer_take_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="takeSn != null">take_sn = #{takeSn},</if>
            <if test="volunteerAccountId != null">volunteer_account_id = #{volunteerAccountId},</if>
            <if test="volunteerUserId != null">volunteer_user_id = #{volunteerUserId},</if>
            <if test="takeAmount != null">take_amount = #{takeAmount},</if>
            <if test="shoudAmount != null">shoud_amount = #{shoudAmount},</if>
            <if test="taxAmount != null">tax_amount = #{taxAmount},</if>
            <if test="receiveAmount != null">receive_amount = #{receiveAmount},</if>
            <if test="payType != null">pay_type = #{payType},</if>
            <if test="bankName != null">bank_name = #{bankName},</if>
            <if test="bankCode != null">bank_code = #{bankCode},</if>
            <if test="bankCardUser != null">bank_card_user = #{bankCardUser},</if>
            <if test="bankCardSn != null">bank_card_sn = #{bankCardSn},</if>
            <if test="bankCardAddress != null">bank_card_address = #{bankCardAddress},</if>
            <if test="payTime != null">pay_time = #{payTime},</if>
            <if test="payNote != null">pay_note = #{payNote},</if>
            <if test="payName != null">pay_name = #{payName},</if>
            <if test="isPay != null">is_pay = #{isPay},</if>
            <if test="paySn != null">pay_sn = #{paySn},</if>
            <if test="payVoucherPics != null">pay_voucher_pics = #{payVoucherPics},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="alipayAccountNo != null">alipay_account_no = #{alipayAccountNo},</if>
            <if test="alipayName != null">alipay_name = #{alipayName},</if>
            <if test="paymentRecordId != null">payment_record_id = #{paymentRecordId},</if>
            <if test="lastTime != null">last_time = #{lastTime},</if>
            <if test="payCode != null">pay_code = #{payCode},</if>
            <if test="checkTime != null">check_time = #{checkTime},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="checkUserId != null">check_user_id = #{checkUserId},</if>
            <if test="checkUserName != null">check_user_name = #{checkUserName},</if>
            <if test="rejectReason != null">reject_reason = #{rejectReason},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where volunteer_take_record_id = #{volunteerTakeRecordId}
    </update>

    <delete id="deleteVolunteerTakeRecordByVolunteerTakeRecordId" parameterType="Long">
        delete from l_volunteer_take_record where volunteer_take_record_id = #{volunteerTakeRecordId}
    </delete>

    <delete id="deleteVolunteerTakeRecordByVolunteerTakeRecordIds" parameterType="String">
        delete from l_volunteer_take_record where volunteer_take_record_id in 
        <foreach item="volunteerTakeRecordId" collection="array" open="(" separator="," close=")">
            #{volunteerTakeRecordId}
        </foreach>
    </delete>
</mapper>