|
@@ -2,14 +2,14 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.dayou.mapper.AssetsStatisticalStatementMapper">
|
|
|
|
|
|
- <!--获取资产台账-->
|
|
|
- <select id="getAssetsLedgerVO" resultType="com.dayou.vo.AssetsLedgerVO">
|
|
|
+ <!--资产太差查询SQL-->
|
|
|
+ <sql id="assetsLedgerQuery">
|
|
|
SELECT (@i := @i + 1) AS id,
|
|
|
assets.id AS assetsId,
|
|
|
- assets.order_id AS orderId,
|
|
|
+ assets.order_id AS orderId,
|
|
|
statement.production_no AS statementNo,
|
|
|
report.production_no AS reportNo,
|
|
|
- report.production_type AS productionType,
|
|
|
+ CASE report.production_type WHEN 'LETTER' THEN '意见函' WHEN 'CONSULT' THEN '咨询报告' WHEN 'REPORT' THEN '评估报告' ELSE '-' END AS productionType,
|
|
|
report.valuation_basis_date AS valuationBasisDate,
|
|
|
report.create_production_date AS createReportDate,
|
|
|
COALESCE(report.assets_name, statement.assets_name, assets.name) AS projectName,
|
|
@@ -38,39 +38,39 @@
|
|
|
(SELECT customer_company.name FROM customer_company WHERE customer_company.id = clientele_sub_id) AS customerSubName,
|
|
|
assets.bailor AS bailor,
|
|
|
assets.bailor_contact_tel AS bailorContactTel,
|
|
|
- GROUP_CONCAT(target.id SEPARATOR ', ') AS targetId,
|
|
|
- GROUP_CONCAT(target.purpose_name SEPARATOR ', ') AS purposeName,
|
|
|
- GROUP_CONCAT(target.type_name SEPARATOR ', ') AS valueTypeName,
|
|
|
- GROUP_CONCAT(target.targetTypename SEPARATOR ', ') AS targetTypename,
|
|
|
- GROUP_CONCAT(target.secTargetTypaName SEPARATOR ', ') AS secTargetTypaName,
|
|
|
- GROUP_CONCAT(target.evaluation_method_id SEPARATOR ', ') AS evaluationMethodId,
|
|
|
- GROUP_CONCAT(target.defined_evaluation_method SEPARATOR ', ') AS definedEvaluationMethod,
|
|
|
- GROUP_CONCAT(target.choice_evaluation_method_id SEPARATOR ', ') AS choiceEvaluationMethodId,
|
|
|
- GROUP_CONCAT(target.choice_defined_evaluation_method SEPARATOR ', ') AS choiceDefinedEvaluationMethod,
|
|
|
- GROUP_CONCAT(target.estimated_value SEPARATOR ', ') AS estimatedValue,
|
|
|
- fund.should_amount AS shouldAmount,
|
|
|
- fund.real_amount AS realAmount,
|
|
|
- report.signatory AS signatory,
|
|
|
- report.repertory_out_time AS repertoryOutTime,
|
|
|
+ GROUP_CONCAT(target.id SEPARATOR '; ') AS targetId,
|
|
|
+ GROUP_CONCAT(target.purpose_name SEPARATOR '; ') AS purposeName,
|
|
|
+ GROUP_CONCAT(target.type_name SEPARATOR '; ') AS valueTypeName,
|
|
|
+ GROUP_CONCAT(target.targetTypename SEPARATOR '; ') AS targetTypename,
|
|
|
+ GROUP_CONCAT(target.secTargetTypaName SEPARATOR '; ') AS secTargetTypaName,
|
|
|
+ GROUP_CONCAT(target.evaluation_method_id SEPARATOR ', ') AS evaluationMethods,
|
|
|
+ GROUP_CONCAT(target.defined_evaluation_method SEPARATOR '; ') AS definedEvaluationMethod,
|
|
|
+ GROUP_CONCAT(target.choice_evaluation_method_id SEPARATOR ', ') AS choiceEvaluationMethods,
|
|
|
+ GROUP_CONCAT(target.choice_defined_evaluation_method SEPARATOR '; ') AS choiceDefinedEvaluationMethod,
|
|
|
+ GROUP_CONCAT(target.estimated_value SEPARATOR '; ') AS estimatedValue,
|
|
|
+ fund.should_amount AS shouldAmount,
|
|
|
+ fund.real_amount AS realAmount,
|
|
|
+ report.signatory AS signatory,
|
|
|
+ report.repertory_out_time AS repertoryOutTime,
|
|
|
(
|
|
|
- SELECT user.name
|
|
|
- FROM work_flow_node_instance AS instance,
|
|
|
- work_task_record AS record,
|
|
|
- work_node AS node,
|
|
|
- user
|
|
|
- WHERE instance.id = record.instance_id
|
|
|
- AND record.handler_id = user.id
|
|
|
- AND node.id = instance.node_id
|
|
|
- AND instance.business_id = assets.id
|
|
|
- AND instance.business_sub_id = statement.production_no
|
|
|
- AND node.code = 'REVIEW_STATEMENT'
|
|
|
- AND instance.deleted = 0
|
|
|
+ SELECT user.name
|
|
|
+ FROM work_flow_node_instance AS instance,
|
|
|
+ work_task_record AS record,
|
|
|
+ work_node AS node,
|
|
|
+ user
|
|
|
+ WHERE instance.id = record.instance_id
|
|
|
+ AND record.handler_id = user.id
|
|
|
+ AND node.id = instance.node_id
|
|
|
+ AND instance.business_id = assets.id
|
|
|
+ AND instance.business_sub_id = statement.production_no
|
|
|
+ AND node.code = 'REVIEW_STATEMENT'
|
|
|
+ AND instance.deleted = 0
|
|
|
) AS statementCheckerName,
|
|
|
(
|
|
|
SELECT user.name
|
|
|
FROM work_flow_node_instance AS instance,
|
|
|
- work_task_record AS record,
|
|
|
- work_node AS node,
|
|
|
+ work_task_record AS record,
|
|
|
+ work_node AS node,
|
|
|
user
|
|
|
WHERE instance.id = record.instance_id
|
|
|
AND record.handler_id = user.id
|
|
@@ -83,8 +83,8 @@
|
|
|
(
|
|
|
SELECT user.name
|
|
|
FROM work_flow_node_instance AS instance,
|
|
|
- work_task_record AS record,
|
|
|
- work_node AS node,
|
|
|
+ work_task_record AS record,
|
|
|
+ work_node AS node,
|
|
|
user
|
|
|
WHERE instance.id = record.instance_id
|
|
|
AND record.handler_id = user.id
|
|
@@ -97,8 +97,8 @@
|
|
|
(
|
|
|
SELECT user.name
|
|
|
FROM work_flow_node_instance AS instance,
|
|
|
- work_task_record AS record,
|
|
|
- work_node AS node,
|
|
|
+ work_task_record AS record,
|
|
|
+ work_node AS node,
|
|
|
user
|
|
|
WHERE instance.id = record.instance_id
|
|
|
AND record.handler_id = user.id
|
|
@@ -111,8 +111,8 @@
|
|
|
(
|
|
|
SELECT user.name
|
|
|
FROM work_flow_node_instance AS instance,
|
|
|
- work_task_record AS record,
|
|
|
- work_node AS node,
|
|
|
+ work_task_record AS record,
|
|
|
+ work_node AS node,
|
|
|
user
|
|
|
WHERE instance.id = record.instance_id
|
|
|
AND record.handler_id = user.id
|
|
@@ -122,31 +122,31 @@
|
|
|
AND node.code = 'FOURTH_CHECK_REPORT'
|
|
|
) AS reportFourthCheckerName
|
|
|
FROM (SELECT @i := 0) AS sort,assets
|
|
|
- LEFT JOIN (
|
|
|
- SELECT target.id,
|
|
|
- target.assets_id,
|
|
|
- purpose_name,
|
|
|
- vType.type_name,
|
|
|
- evaluation_method_id,
|
|
|
- defined_evaluation_method,
|
|
|
- choice_evaluation_method_id,
|
|
|
- choice_defined_evaluation_method,
|
|
|
- type.type_name AS targetTypename,
|
|
|
- secType.type_name AS secTargetTypaName,
|
|
|
- estimated_value,
|
|
|
- statement_no,
|
|
|
- report_no
|
|
|
- FROM assets_evaluation_target AS target
|
|
|
- LEFT JOIN assets_evaluation_target_purpose AS purpose ON evaluation_purpose_id = purpose.id
|
|
|
- LEFT JOIN assets_evaluation_target_type AS type ON evaluation_type_id = type.id
|
|
|
- LEFT JOIN assets_evaluation_target_type AS secType ON evaluation_type_sec_id = type.id
|
|
|
- LEFT JOIN assets_value_type AS vType ON assets_value_id = vType.id
|
|
|
- ) AS target ON assets.id = target.assets_id
|
|
|
- LEFT JOIN assets_production AS report ON report_no = report.production_no
|
|
|
- LEFT JOIN assets_production AS statement ON statement_no = statement.production_no
|
|
|
- LEFT JOIN user AS manager ON manager.id = assets.client_manager_id
|
|
|
- LEFT JOIN user AS principal ON principal.id = assets.principal_id
|
|
|
- LEFT JOIN order_fund AS fund ON fund.business_id = assets.id AND fund.business_type = 'ASSET_BUSINESS'
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT target.id,
|
|
|
+ target.assets_id,
|
|
|
+ purpose_name,
|
|
|
+ vType.type_name,
|
|
|
+ evaluation_method_id,
|
|
|
+ defined_evaluation_method,
|
|
|
+ choice_evaluation_method_id,
|
|
|
+ choice_defined_evaluation_method,
|
|
|
+ type.type_name AS targetTypename,
|
|
|
+ secType.type_name AS secTargetTypaName,
|
|
|
+ estimated_value,
|
|
|
+ statement_no,
|
|
|
+ report_no
|
|
|
+ FROM assets_evaluation_target AS target
|
|
|
+ LEFT JOIN assets_evaluation_target_purpose AS purpose ON evaluation_purpose_id = purpose.id
|
|
|
+ LEFT JOIN assets_evaluation_target_type AS type ON evaluation_type_id = type.id
|
|
|
+ LEFT JOIN assets_evaluation_target_type AS secType ON evaluation_type_sec_id = type.id
|
|
|
+ LEFT JOIN assets_value_type AS vType ON assets_value_id = vType.id
|
|
|
+ ) AS target ON assets.id = target.assets_id
|
|
|
+ LEFT JOIN assets_production AS report ON report_no = report.production_no
|
|
|
+ LEFT JOIN assets_production AS statement ON statement_no = statement.production_no
|
|
|
+ LEFT JOIN user AS manager ON manager.id = assets.client_manager_id
|
|
|
+ LEFT JOIN user AS principal ON principal.id = assets.principal_id
|
|
|
+ LEFT JOIN order_fund AS fund ON fund.business_id = assets.id AND fund.business_type = 'ASSET_BUSINESS'
|
|
|
WHERE assets.deleted = 0
|
|
|
<if test="dto != null and dto.keyWord != null and dto.keyWord != '' ">
|
|
|
AND (
|
|
@@ -171,6 +171,16 @@
|
|
|
AND assets.assets_business_gener = #{dto.assetsBusinessGener}
|
|
|
</if>
|
|
|
GROUP BY statementNo,
|
|
|
- reportNo
|
|
|
+ reportNo
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--获取资产台账-->
|
|
|
+ <select id="getAssetsLedgerVO" resultType="com.dayou.vo.AssetsLedgerVO">
|
|
|
+ <include refid="assetsLedgerQuery" />
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--资产台账导出-->
|
|
|
+ <select id="assetsLedgerVOExport" resultType="com.dayou.vo.AssetsLedgerVO">
|
|
|
+ <include refid="assetsLedgerQuery" />
|
|
|
+ </select>
|
|
|
</mapper>
|