<?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="payeeReceiveInfoServiceDaoImpl">
|
|
<!-- 保存对方收款单位信息 -->
|
<insert id="savePayeeReceiveInfo" parameterType="Map">
|
insert into payee_receive_info(
|
caller_name, contact_info, payee_info, invoice_no, invoice_date,
|
receipt_no, receipt_date, receipt_note, receipt_note_date, image_file,
|
our_company_receive_date, attachment_file, owner_id, room_id, callable_id
|
) values (
|
#{callerName}, #{contactInfo}, #{payeeInfo}, #{invoiceNo}, #{invoiceDate},
|
#{receiptNo}, #{receiptDate}, #{receiptNote}, #{receiptNoteDate}, #{imageFile},
|
#{ourCompanyReceiveDate}, #{attachmentFile}, #{ownerId}, #{roomId}, #{callableId}
|
)
|
</insert>
|
|
<!-- 批量保存对方收款单位信息 -->
|
<insert id="batchSavePayeeReceiveInfo" parameterType="Map">
|
insert into payee_receive_info(
|
caller_name, contact_info, payee_info, invoice_no, invoice_date,
|
receipt_no, receipt_date, receipt_note, receipt_note_date, image_file,
|
our_company_receive_date, attachment_file, owner_id, room_id
|
) values
|
<foreach collection="payeeReceiveList" item="item" separator=",">
|
( #{item.callerName}, #{item.contactInfo}, #{item.payeeInfo}, #{item.invoiceNo}, #{item.invoiceDate},
|
#{item.receiptNo}, #{item.receiptDate}, #{item.receiptNote}, #{item.receiptNoteDate}, #{item.imageFile},
|
#{item.ourCompanyReceiveDate}, #{item.attachmentFile}, #{item.ownerId}, #{item.roomId} )
|
</foreach>
|
</insert>
|
|
<!-- 查询对方收款单位信息 -->
|
<select id="getPayeeReceiveInfo" parameterType="Map" resultType="Map">
|
select
|
t.id,
|
t.caller_name callerName,
|
t.contact_info contactInfo,
|
t.payee_info payeeInfo,
|
t.invoice_no invoiceNo,
|
t.invoice_date invoiceDate,
|
t.receipt_no receiptNo,
|
t.receipt_date receiptDate,
|
t.receipt_note receiptNote,
|
t.receipt_note_date receiptNoteDate,
|
t.image_file imageFile,
|
t.our_company_receive_date ourCompanyReceiveDate,
|
t.attachment_file attachmentFile,
|
t.create_time createTime,
|
t.update_time updateTime,
|
t.owner_id ownerId,
|
t.room_id roomId
|
from payee_receive_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="callerName != null and callerName != ''">
|
and t.caller_name = #{callerName}
|
</if>
|
<if test="contactInfo != null and contactInfo != ''">
|
and t.contact_info = #{contactInfo}
|
</if>
|
<if test="payeeInfo != null and payeeInfo != ''">
|
and t.payee_info = #{payeeInfo}
|
</if>
|
<if test="invoiceNo != null and invoiceNo != ''">
|
and t.invoice_no = #{invoiceNo}
|
</if>
|
<if test="invoiceDate != null">
|
and t.invoice_date = #{invoiceDate}
|
</if>
|
<if test="receiptNo != null and receiptNo != ''">
|
and t.receipt_no = #{receiptNo}
|
</if>
|
<if test="receiptDate != null">
|
and t.receipt_date = #{receiptDate}
|
</if>
|
<if test="receiptNoteDate != null">
|
and t.receipt_note_date = #{receiptNoteDate}
|
</if>
|
<if test="ourCompanyReceiveDate != null">
|
and t.our_company_receive_date = #{ourCompanyReceiveDate}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
<!-- 时间范围查询 -->
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
<if test="startUpdateTime != null">
|
and t.update_time >= #{startUpdateTime}
|
</if>
|
<if test="endUpdateTime != null">
|
and t.update_time <= #{endUpdateTime}
|
</if>
|
order by t.id desc
|
<if test="page != -1 and page != null">
|
limit #{page}, #{row}
|
</if>
|
</select>
|
|
<!-- 更新对方收款单位信息 -->
|
<update id="updatePayeeReceiveInfo" parameterType="Map">
|
update payee_receive_info t
|
<set>
|
<if test="callerName != null and callerName != ''">
|
t.caller_name = #{callerName},
|
</if>
|
<if test="contactInfo != null and contactInfo != ''">
|
t.contact_info = #{contactInfo},
|
</if>
|
<if test="payeeInfo != null and payeeInfo != ''">
|
t.payee_info = #{payeeInfo},
|
</if>
|
<if test="invoiceNo != null and invoiceNo != ''">
|
t.invoice_no = #{invoiceNo},
|
</if>
|
<if test="invoiceDate != null">
|
t.invoice_date = #{invoiceDate},
|
</if>
|
<if test="receiptNo != null and receiptNo != ''">
|
t.receipt_no = #{receiptNo},
|
</if>
|
<if test="receiptDate != null">
|
t.receipt_date = #{receiptDate},
|
</if>
|
<if test="receiptNote != null and receiptNote != ''">
|
t.receipt_note = #{receiptNote},
|
</if>
|
<if test="receiptNoteDate != null">
|
t.receipt_note_date = #{receiptNoteDate},
|
</if>
|
<if test="imageFile != null and imageFile != ''">
|
t.image_file = #{imageFile},
|
</if>
|
<if test="ourCompanyReceiveDate != null">
|
t.our_company_receive_date = #{ourCompanyReceiveDate},
|
</if>
|
<if test="attachmentFile != null and attachmentFile != ''">
|
t.attachment_file = #{attachmentFile},
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
t.owner_id = #{ownerId},
|
</if>
|
<if test="roomId != null and roomId != ''">
|
t.room_id = #{roomId},
|
</if>
|
t.update_time = CURRENT_TIMESTAMP
|
</set>
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
</update>
|
|
<!-- 删除对方收款单位信息 -->
|
<delete id="deletePayeeReceiveInfo" parameterType="Map">
|
delete from payee_receive_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
</delete>
|
|
<!-- 查询对方收款单位记录数量 -->
|
<select id="queryPayeeReceiveInfoCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from payee_receive_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="callerName != null and callerName != ''">
|
and t.caller_name = #{callerName}
|
</if>
|
<if test="contactInfo != null and contactInfo != ''">
|
and t.contact_info = #{contactInfo}
|
</if>
|
<if test="payeeInfo != null and payeeInfo != ''">
|
and t.payee_info = #{payeeInfo}
|
</if>
|
<if test="invoiceNo != null and invoiceNo != ''">
|
and t.invoice_no = #{invoiceNo}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
<!-- 时间范围查询 -->
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
<if test="startUpdateTime != null">
|
and t.update_time >= #{startUpdateTime}
|
</if>
|
<if test="endUpdateTime != null">
|
and t.update_time <= #{endUpdateTime}
|
</if>
|
</select>
|
|
<!-- 查询对方收款单位统计信息 -->
|
<select id="queryPayeeReceiveInfoStatistics" parameterType="Map" resultType="Map">
|
select
|
count(1) as total_count,
|
min(t.create_time) as earliest_create_time,
|
max(t.create_time) as latest_create_time,
|
min(t.update_time) as earliest_update_time,
|
max(t.update_time) as latest_update_time
|
from payee_receive_info t
|
where 1 = 1
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
</select>
|
|
<!-- 按年月分组统计对方收款单位数量 -->
|
<select id="queryPayeeReceiveInfoByMonth" parameterType="Map" resultType="Map">
|
select
|
date_format(t.create_time, '%Y-%m') as month,
|
count(1) as count,
|
count(distinct t.owner_id) as owner_count
|
from payee_receive_info t
|
where 1 = 1
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<if test="roomId != null and roomId != ''">
|
and t.room_id = #{roomId}
|
</if>
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
group by date_format(t.create_time, '%Y-%m')
|
order by month desc
|
</select>
|
|
<!-- 根据owner_id查询最新的对方收款单位信息 -->
|
<select id="getLatestPayeeReceiveInfoByOwnerId" parameterType="Map" resultType="Map">
|
select
|
t.id,
|
t.caller_name callerName,
|
t.contact_info contactInfo,
|
t.payee_info payeeInfo,
|
t.invoice_no invoiceNo,
|
t.invoice_date invoiceDate,
|
t.receipt_no receiptNo,
|
t.receipt_date receiptDate,
|
t.receipt_note receiptNote,
|
t.receipt_note_date receiptNoteDate,
|
t.image_file imageFile,
|
t.our_company_receive_date ourCompanyReceiveDate,
|
t.attachment_file attachmentFile,
|
t.create_time createTime,
|
t.update_time updateTime,
|
t.owner_id ownerId,
|
t.room_id roomId
|
from payee_receive_info t
|
where t.owner_id = #{ownerId}
|
order by t.update_time desc
|
limit 1
|
</select>
|
|
</mapper>
|