|
@@ -168,4 +168,94 @@
|
|
|
<select id="majorStatExport" parameterType="com.dayou.vo.RealFundMajorStatVO" resultType="com.dayou.vo.RealFundMajorStatVO">
|
|
|
<include refid="majorStatQuery" />
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--资产实收款统计-->
|
|
|
+ <sql id="assetsStatQuery">
|
|
|
+ SELECT
|
|
|
+ claim.real_fund_id,
|
|
|
+ claim.order_fund_id,
|
|
|
+ claim.production_fund_id,
|
|
|
+ claim.id,
|
|
|
+ prod.production_no AS reportNo,
|
|
|
+ assets.order_id AS orderId,
|
|
|
+ assets.`name` AS orderName,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ department.name
|
|
|
+ FROM
|
|
|
+ department,
|
|
|
+ post,
|
|
|
+ user_post,
|
|
|
+ `user`
|
|
|
+ WHERE
|
|
|
+ `user`.id = user_post.user_id
|
|
|
+ AND user_post.post_id = post.id
|
|
|
+ AND post.department_id = department.id
|
|
|
+ AND `user`.id = assets.client_manager_id
|
|
|
+ ) AS marketDepartment,
|
|
|
+ ( SELECT department.name FROM department WHERE department.id = assets.department_id ) AS evaluateDepartment,
|
|
|
+ managerUser.name AS clientManagerName,
|
|
|
+ principalUser.name AS principalName,
|
|
|
+ realFund.payer AS payer,
|
|
|
+ realFund.pay_datetime AS payDateTime,
|
|
|
+ order_fund.should_amount AS orderShouldAmount,
|
|
|
+ prodFund.production_should_amount AS prodShouldAmount,
|
|
|
+ claim.claim_amount AS claimAmount,
|
|
|
+ claimUser.name AS claimUser,
|
|
|
+ assets.assets_business_gener AS assetsBusinessGener,
|
|
|
+ ( SELECT customer_company.name FROM customer_company WHERE customer_company.id = assets.clientele_id ) AS clientName,
|
|
|
+ ( SELECT customer_company.name FROM customer_company WHERE customer_company.id = assets.clientele_sub_id ) AS clientSubName,
|
|
|
+ assets.bailor AS bailor,
|
|
|
+ prod.evaluate_amount,
|
|
|
+ prod.production_type AS productionType,
|
|
|
+ prod.if_save_file AS ifSaveFile
|
|
|
+ FROM
|
|
|
+ finance_claim AS claim
|
|
|
+ LEFT JOIN finance_real_fund AS realFund ON realFund.id = claim.real_fund_id
|
|
|
+ LEFT JOIN order_fund ON order_fund.id = claim.order_fund_id
|
|
|
+ LEFT JOIN production_fund AS prodFund ON prodFund.id = claim.production_fund_id
|
|
|
+ LEFT JOIN assets ON assets.id = order_fund.business_id
|
|
|
+ AND assets.order_id = order_fund.order_id
|
|
|
+ LEFT JOIN `user` AS managerUser ON managerUser.id = assets.client_manager_id
|
|
|
+ LEFT JOIN `user` AS principalUser ON principalUser.id = assets.principal_id
|
|
|
+ LEFT JOIN `user` AS claimUser ON claimUser.id = claim.claim_user_id
|
|
|
+ LEFT JOIN assets_production AS prod ON assets.id = prod.business_id AND prodFund.production_no = prod.production_no
|
|
|
+ WHERE order_fund.business_type = 'ASSET_BUSINESS'
|
|
|
+ <if test="dto != null and dto.orderId != null and dto.orderId != ''">
|
|
|
+ AND assets.order_id = #{dto.orderId}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.reportNo != null and dto.reportNo != ''">
|
|
|
+ AND prod.production_no = #{dto.reportNo}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.principalId != null and dto.principalId != ''">
|
|
|
+ AND assets.principal_id = #{dto.principalId}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.claimUserId != null and dto.claimUserId != ''">
|
|
|
+ AND claim.claim_user_id = #{dto.claimUserId}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.claimAmount != null and dto.claimAmount != ''">
|
|
|
+ AND claim.claim_amount = #{dto.claimAmount}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.assetsBusinessGener != null and dto.assetsBusinessGener != ''">
|
|
|
+ AND assets.assets_business_gener = #{dto.assetsBusinessGener}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.ifSaveFile != null and dto.ifSaveFile != ''">
|
|
|
+ AND prod.if_save_file = #{dto.ifSaveFile}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.startTime != null and dto.endTime!= null">
|
|
|
+ AND (claim.claim_datetime BETWEEN #{dto.startTime} AND #{dto.endTime})
|
|
|
+ </if>
|
|
|
+ ORDER BY claim.claim_datetime DESC
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--查询资产实收款统计-->
|
|
|
+ <select id="assetsSate" parameterType="com.dayou.dto.RealFundAssetsStatDTO" resultType="com.dayou.vo.RealFundAssetsStatVO">
|
|
|
+ <include refid="assetsStatQuery" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--资产实收款统计导出-->
|
|
|
+ <select id="assetsSateExport" resultType="com.dayou.vo.RealFundAssetsStatVO">
|
|
|
+ <include refid="assetsStatQuery" />
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|