|
@@ -2,4 +2,88 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.RepaymentInfoMapper">
|
|
|
|
|
|
+
|
|
|
+ <!-- 获得垫付还款结算总数 -->
|
|
|
+ <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(r.id)
|
|
|
+ FROM hy_repayment_info r
|
|
|
+ LEFT JOIN hy_order_info o on r.order_id = o.id and o.delete_flag = 0
|
|
|
+ LEFT JOIN hy_cargo_owner_info c on c.common_id = r.common_id and c.delete_flag = 0
|
|
|
+ WHERE
|
|
|
+ r.delete_flag = '0'
|
|
|
+ <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
+ AND (lower(c.name) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower(o.order_no) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
+ </if>
|
|
|
+ <if test="searchType != null and searchType != ''">
|
|
|
+ <if test="searchType == 1">
|
|
|
+ AND (r.status_key = '1' OR r.status_key = '3')
|
|
|
+ </if>
|
|
|
+ <if test="searchType == 2">
|
|
|
+ AND r.status_key = '5'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND (DATE_FORMAT(r.repayment_date,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND (DATE_FORMAT(r.repayment_date,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 垫付还款结算列表查询 -->
|
|
|
+ <select id="getListByCondition" parameterType="Map"
|
|
|
+ resultType="com.yh.saas.plugin.yiliangyiyun.entity.RepaymentInfo">
|
|
|
+ SELECT
|
|
|
+ r.id,
|
|
|
+ r.order_id as orderId,
|
|
|
+ r.common_id as commonId,
|
|
|
+ r.freight_id as freightId,
|
|
|
+ o.order_no as orderNo,
|
|
|
+ c.name as cargoOwnerName,
|
|
|
+ c.phone as accountNumber,
|
|
|
+ o.comp_name as affiliatedEnterprise,
|
|
|
+ r.freight,
|
|
|
+ r.overdue_fee as overdueFee,
|
|
|
+ r.service_charge as serviceCharge,
|
|
|
+ r.total_repayable as totalRepayable,
|
|
|
+ r.already_repaid as alreadyRepaid,
|
|
|
+ r.not_repaid as notRepaid,
|
|
|
+ r.status_key as statusKey,
|
|
|
+ r.status,
|
|
|
+ r.repayment_date as repaymentDate,
|
|
|
+ r.create_date as createDate
|
|
|
+ FROM hy_repayment_info r
|
|
|
+ LEFT JOIN hy_order_info o on r.order_id = o.id and o.delete_flag = 0
|
|
|
+ LEFT JOIN hy_cargo_owner_info c on c.common_id = r.common_id and c.delete_flag = 0
|
|
|
+ WHERE
|
|
|
+ r.delete_flag = '0'
|
|
|
+ <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
+ AND (lower(c.name) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower(o.order_no) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
+ </if>
|
|
|
+ <if test="searchType != null and searchType != ''">
|
|
|
+ <if test="searchType == 1">
|
|
|
+ AND (r.status_key = '1' OR r.status_key = '3')
|
|
|
+ </if>
|
|
|
+ <if test="searchType == 2">
|
|
|
+ AND r.status_key = '5'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND (DATE_FORMAT(r.repayment_date,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND (DATE_FORMAT(r.repayment_date,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ ORDER BY r.status_key ASC,r.repayment_date DESC
|
|
|
+ <if test="currentPage != null and currentPage != ''">
|
|
|
+ LIMIT ${startRecord}, ${pageSize}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|