|
|
|
<?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.daqing.financial.guarantee.mapper.AlCollectionMapper">
|
|
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
|
<resultMap id="BaseResultMap" type="com.daqing.framework.domain.guarantee.AlCollection">
|
|
|
|
<id column="id" property="id" />
|
|
|
|
<result column="insurance_id" property="insuranceId" />
|
|
|
|
<result column="collection_method" property="collectionMethod" />
|
|
|
|
<result column="collection_time" property="collectionTime" />
|
|
|
|
<result column="collection_feedback" property="collectionFeedback" />
|
|
|
|
<result column="enclosure_file" property="enclosureFile" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<!-- 催收管理列表 -->
|
|
|
|
<select id="list" resultType="com.daqing.framework.domain.guarantee.po.AlCollectionPO">
|
|
|
|
SELECT i.id AS id,i.business_code AS code,i.customer_name AS name,i.phone AS phone,i.business_type AS type,
|
|
|
|
i.guarantee_amount AS amount,i.department AS department,i.payment_status AS status,COUNT(c.id) AS numberOfCollection
|
|
|
|
FROM al_insurance_list AS i
|
|
|
|
LEFT JOIN al_collection AS c
|
|
|
|
ON i.id = c.insurance_id
|
|
|
|
WHERE i.is_overdue = 0
|
|
|
|
<if test="status != null">
|
|
|
|
AND i.payment_status = #{status}
|
|
|
|
</if>
|
|
|
|
<if test="codeOrName != null and codeOrName != ''">
|
|
|
|
AND (i.customer_name like CONCAT('%',#{codeOrName},'%') OR i.business_code like CONCAT('%',#{codeOrName},'%'))
|
|
|
|
</if>
|
|
|
|
GROUP BY i.id
|
|
|
|
ORDER BY i.create_time DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 催收 -->
|
|
|
|
<insert id="collection" parameterType="com.daqing.framework.domain.guarantee.AlCollection">
|
|
|
|
INSERT INTO al_collection (insurance_id,collection_method,collection_time,collection_feedback,enclosure_file
|
|
|
|
,overdue_amount,overdue_interest,other_expenses,collection_user,overdue_periods)
|
|
|
|
VALUES (#{ac.insuranceId},#{ac.collectionMethod},#{ac.collectionTime},
|
|
|
|
#{ac.collectionFeedback},#{ac.enclosureFile},
|
|
|
|
#{ac.overdueAmount},#{ac.overdueInterest},#{ac.otherExpenses},
|
|
|
|
#{ac.collectionUser},#{ac.overduePeriods})
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<!--<select id="getOverdueDetailByInsuranceId" parameterType="integer" resultType="com.daqing.financial.guarantee.model.response.OverdueDetailResponse">
|
|
|
|
SELECT i.customer_name AS name,i.business_type AS type,i.business_code AS code,COUNT(c.id) AS number_of_collection
|
|
|
|
FROM al_insurance_list AS i
|
|
|
|
INNER JOIN al_collection AS c
|
|
|
|
ON i.id = c.insurance_id
|
|
|
|
WHERE i.id = #{insuranceId}
|
|
|
|
</select>-->
|
|
|
|
|
|
|
|
<!-- 催收时贷款记录 -->
|
|
|
|
<select id="getOverdueDetailByInsuranceId" parameterType="integer" resultType="com.daqing.financial.guarantee.model.response.OverdueDetailResponse">
|
|
|
|
SELECT customer_name AS name,business_type AS type,business_code AS code
|
|
|
|
FROM al_insurance_list WHERE id = #{insuranceId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据保后id查询催收的次数 -->
|
|
|
|
<select id="getCollectionCountByInsuranceId" parameterType="integer" resultType="integer">
|
|
|
|
SELECT COUNT(id) FROM al_collection WHERE insurance_id = #{insuranceId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 催收列表 -->
|
|
|
|
<select id="collectionList" parameterType="com.daqing.financial.guarantee.model.request.AlCollectionListRequest" resultType="com.daqing.framework.domain.guarantee.po.AlCollectionListPO">
|
|
|
|
SELECT c.id AS id,c.overdue_amount AS overdue_amount,c.overdue_interest AS overdue_interest,c.other_expenses AS other_expenses,
|
|
|
|
c.overdue_periods AS overdue_periods,c.collection_method AS collection_method,c.collection_user AS collection_user,
|
|
|
|
c.collection_time AS collection_time,c.collection_feedback AS collection_feedback,i.business_code AS code,
|
|
|
|
i.customer_name AS name
|
|
|
|
FROM al_collection AS c
|
|
|
|
INNER JOIN al_insurance_list AS i
|
|
|
|
ON i.id = c.insurance_id
|
|
|
|
WHERE c.insurance_id = #{acr.insuranceId}
|
|
|
|
<if test="acr.startTime != null and acr.endTime != null">
|
|
|
|
AND collection_time BETWEEN #{acr.startTime} AND #{acr.endTime}
|
|
|
|
</if>
|
|
|
|
ORDER BY c.collection_time DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="moreOverdueDetail" parameterType="integer" resultType="com.daqing.financial.guarantee.model.response.MoreOverdueDetailResponse">
|
|
|
|
SELECT collection_method,collection_time,collection_feedback,enclosure_file
|
|
|
|
FROM al_collection
|
|
|
|
WHERE id = #{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getInsuranceIdById" parameterType="integer" resultType="integer">
|
|
|
|
SELECT insurance_id FROM al_collection WHERE id = #{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 催收管理列表导出 -->
|
|
|
|
<select id="collectionListExcel" parameterType="list" resultType="com.daqing.framework.domain.guarantee.po.AlCollectionListPO">
|
|
|
|
SELECT c.id AS id,c.overdue_amount AS overdue_amount,c.overdue_interest AS overdue_interest,c.other_expenses AS other_expenses,
|
|
|
|
c.overdue_periods AS overdue_periods,c.collection_method AS collection_method,c.collection_user AS collection_user,
|
|
|
|
c.collection_time AS collection_time,c.collection_feedback AS collection_feedback,i.business_code AS code,
|
|
|
|
i.customer_name AS name
|
|
|
|
FROM al_collection AS c
|
|
|
|
INNER JOIN al_insurance_list AS i
|
|
|
|
ON i.id = c.insurance_id
|
|
|
|
WHERE c.id IN
|
|
|
|
<foreach collection="ids" open="(" separator="," close=")" item="id">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|