<?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="litigationInfoServiceDaoImpl">
|
|
<!-- 保存讼诉情况信息 -->
|
<insert id="saveLitigationInfo" parameterType="Map">
|
insert into litigation_info(
|
litigation_date, arrears_period, arrears_amount, late_fee,
|
acceptance_fee, other_fee, submitter, owner_id
|
) values (
|
#{litigationDate}, #{arrearsPeriod}, #{arrearsAmount}, #{lateFee},
|
#{acceptanceFee}, #{otherFee}, #{submitter}, #{ownerId}
|
)
|
</insert>
|
|
<!-- 批量保存讼诉情况信息 -->
|
<insert id="batchSaveLitigationInfo" parameterType="Map">
|
insert into litigation_info(
|
litigation_date, arrears_period, arrears_amount, late_fee,
|
acceptance_fee, other_fee, submitter, owner_id
|
) values
|
<foreach collection="litigationList" item="item" separator=",">
|
( #{item.litigationDate}, #{item.arrearsPeriod}, #{item.arrearsAmount}, #{item.lateFee},
|
#{item.acceptanceFee}, #{item.otherFee}, #{item.submitter}, #{item.ownerId} )
|
</foreach>
|
</insert>
|
|
<!-- 查询讼诉情况信息 -->
|
<select id="getLitigationInfo" parameterType="Map" resultType="Map">
|
select
|
t.id,
|
t.litigation_date litigationDate,
|
t.arrears_period arrearsPeriod,
|
t.arrears_amount arrearsAmount,
|
t.late_fee lateFee,
|
t.acceptance_fee acceptanceFee,
|
t.other_fee otherFee,
|
t.total_amount totalAmount,
|
t.submitter submitter,
|
t.owner_id ownerId,
|
t.create_time createTime,
|
t.update_time updateTime
|
from litigation_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="litigationDate != null">
|
and t.litigation_date = #{litigationDate}
|
</if>
|
<if test="arrearsPeriod != null and arrearsPeriod != ''">
|
and t.arrears_period = #{arrearsPeriod}
|
</if>
|
<if test="arrearsAmount != null">
|
and t.arrears_amount = #{arrearsAmount}
|
</if>
|
<if test="submitter != null and submitter != ''">
|
and t.submitter = #{submitter}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<!-- 金额范围查询 -->
|
<if test="minArrearsAmount != null">
|
and t.arrears_amount >= #{minArrearsAmount}
|
</if>
|
<if test="maxArrearsAmount != null">
|
and t.arrears_amount <= #{maxArrearsAmount}
|
</if>
|
<if test="minTotalAmount != null">
|
and t.total_amount >= #{minTotalAmount}
|
</if>
|
<if test="maxTotalAmount != null">
|
and t.total_amount <= #{maxTotalAmount}
|
</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="updateLitigationInfo" parameterType="Map">
|
update litigation_info t
|
<set>
|
<if test="litigationDate != null">
|
t.litigation_date = #{litigationDate},
|
</if>
|
<if test="arrearsPeriod != null and arrearsPeriod != ''">
|
t.arrears_period = #{arrearsPeriod},
|
</if>
|
<if test="arrearsAmount != null">
|
t.arrears_amount = #{arrearsAmount},
|
</if>
|
<if test="lateFee != null">
|
t.late_fee = #{lateFee},
|
</if>
|
<if test="acceptanceFee != null">
|
t.acceptance_fee = #{acceptanceFee},
|
</if>
|
<if test="otherFee != null">
|
t.other_fee = #{otherFee},
|
</if>
|
<if test="submitter != null and submitter != ''">
|
t.submitter = #{submitter},
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
t.owner_id = #{ownerId},
|
</if>
|
t.update_time = CURRENT_TIMESTAMP
|
</set>
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
</update>
|
|
<!-- 删除讼诉情况信息 -->
|
<delete id="deleteLitigationInfo" parameterType="Map">
|
delete from litigation_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="litigationDate != null">
|
and t.litigation_date = #{litigationDate}
|
</if>
|
<if test="submitter != null and submitter != ''">
|
and t.submitter = #{submitter}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
</delete>
|
|
<!-- 查询讼诉情况记录数量 -->
|
<select id="queryLitigationInfoCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from litigation_info t
|
where 1 = 1
|
<if test="id != null">
|
and t.id = #{id}
|
</if>
|
<if test="litigationDate != null">
|
and t.litigation_date = #{litigationDate}
|
</if>
|
<if test="arrearsPeriod != null and arrearsPeriod != ''">
|
and t.arrears_period = #{arrearsPeriod}
|
</if>
|
<if test="arrearsAmount != null">
|
and t.arrears_amount = #{arrearsAmount}
|
</if>
|
<if test="submitter != null and submitter != ''">
|
and t.submitter = #{submitter}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
<!-- 金额范围查询 -->
|
<if test="minArrearsAmount != null">
|
and t.arrears_amount >= #{minArrearsAmount}
|
</if>
|
<if test="maxArrearsAmount != null">
|
and t.arrears_amount <= #{maxArrearsAmount}
|
</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="queryLitigationInfoStatistics" parameterType="Map" resultType="Map">
|
select
|
count(1) as total_count,
|
sum(t.arrears_amount) as total_arrears_amount,
|
sum(t.late_fee) as total_late_fee,
|
sum(t.acceptance_fee) as total_acceptance_fee,
|
sum(t.other_fee) as total_other_fee,
|
sum(t.total_amount) as total_total_amount,
|
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 litigation_info t
|
where 1 = 1
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
<if test="litigationDate != null">
|
and t.litigation_date = #{litigationDate}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
</select>
|
|
<!-- 按年月分组统计讼诉情况数量和金额 -->
|
<select id="queryLitigationInfoByMonth" parameterType="Map" resultType="Map">
|
select
|
date_format(t.create_time, '%Y-%m') as month,
|
count(1) as count,
|
sum(t.arrears_amount) as total_arrears_amount,
|
sum(t.total_amount) as total_total_amount
|
from litigation_info t
|
where 1 = 1
|
<if test="startCreateTime != null">
|
and t.create_time >= #{startCreateTime}
|
</if>
|
<if test="endCreateTime != null">
|
and t.create_time <= #{endCreateTime}
|
</if>
|
<if test="submitter != null and submitter != ''">
|
and t.submitter = #{submitter}
|
</if>
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
group by date_format(t.create_time, '%Y-%m')
|
order by month desc
|
</select>
|
|
<!-- 根据送诉日期查询最新的讼诉情况 -->
|
<select id="getLatestLitigationInfoByLitigationDate" parameterType="Map" resultType="Map">
|
select
|
t.id,
|
t.litigation_date litigationDate,
|
t.arrears_period arrearsPeriod,
|
t.arrears_amount arrearsAmount,
|
t.late_fee lateFee,
|
t.acceptance_fee acceptanceFee,
|
t.other_fee otherFee,
|
t.total_amount totalAmount,
|
t.submitter submitter,
|
t.owner_id ownerId,
|
t.create_time createTime,
|
t.update_time updateTime
|
from litigation_info t
|
where t.litigation_date = #{litigationDate}
|
<if test="ownerId != null and ownerId != ''">
|
and t.owner_id = #{ownerId}
|
</if>
|
order by t.update_time desc
|
limit 1
|
</select>
|
|
</mapper>
|