|
@@ -45,10 +45,10 @@
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
- id, project_id, mt_company_id, code, source, pay_mode, lift_num, moneys, type, status,
|
|
|
+ id, project_id, mt_company_id, code, source, pay_mode, lift_num, moneys, type, status,
|
|
|
given_date, given_user, star_date, end_date, create_date, next_id, previous_id, accessory_url, end_reason, remarks,
|
|
|
parts_rules
|
|
|
- </sql>
|
|
|
+ </sql>
|
|
|
|
|
|
<!-- 根据项目、合同号、合同类型、合同状态查询合同管理列表-->
|
|
|
<select id="findByCondition"
|
|
@@ -130,37 +130,6 @@
|
|
|
<!--合同金额-->
|
|
|
c.moneys as moneys,
|
|
|
|
|
|
- <!--合同来源-->
|
|
|
- case c.source when 1 then '商保新增' when 2 then '免保转签' when 3 then '续签' when 4 then '免保' else '暂无' end,
|
|
|
-
|
|
|
- <!--合同类型-->
|
|
|
- case c.type when 1 then '半包' when 2 then '半包' when 3 then '清包' when 4 then '全包' when 5 then '大修' else '暂无' end,
|
|
|
-
|
|
|
- <!--合同开始时间-->
|
|
|
- c.star_date as starDate,
|
|
|
-
|
|
|
- <!--合同结束时间-->
|
|
|
- c.end_date as endDate,
|
|
|
-
|
|
|
-
|
|
|
- <!--台量-->
|
|
|
- c.lift_num as liftNum,
|
|
|
-
|
|
|
-
|
|
|
- <!--金额=合同金额-->
|
|
|
- <!--签约时间-->
|
|
|
- c.given_date as givenDate,
|
|
|
-
|
|
|
- <!--签约人-->
|
|
|
- c.given_user as givenUser,
|
|
|
-
|
|
|
- <!--未收-->
|
|
|
- pay.plan_money - pay.work_money as NoPayMoney,
|
|
|
-
|
|
|
- <!--配件条款-->
|
|
|
- c.parts_rules as partsRules,
|
|
|
-
|
|
|
-
|
|
|
<!--应收日期-->
|
|
|
pay.plan_date as planDate,
|
|
|
|
|
@@ -240,6 +209,72 @@
|
|
|
erc.cost_money as nowMoney,
|
|
|
<!--合同金额-->
|
|
|
c.moneys as moneys,
|
|
|
+ <!--应收日期-->
|
|
|
+ erc.cost_date as planDate,
|
|
|
+ <!--期数-->
|
|
|
+ <!--收款责任人-->
|
|
|
+ erc.collection_man as collectionMan,
|
|
|
+ <!--区域-->
|
|
|
+ (select area_name from region where region.id=p.region_id) as regionName,
|
|
|
+ <!--帐龄-->
|
|
|
+ erc.pay_date - erc.cost_date as paymentDays,
|
|
|
+ <!--开票金额-->
|
|
|
+ erc.invoice_money as amountInvoice,
|
|
|
+ <!--开票时间-->
|
|
|
+ erc.invoice_date as billingDate,
|
|
|
+ <!--发票类型-->
|
|
|
+ erc.invoice_type as invoiceType,
|
|
|
+ <!--到账时间-->
|
|
|
+ erc.pay_date as workDate,
|
|
|
+ <!--到账金额-->
|
|
|
+ erc.pay_money as workMoney
|
|
|
+ <!--表关联-->
|
|
|
+ from er_record_cost erc
|
|
|
+ LEFT JOIN emergency_repair emr on erc.er_record_id=emr.id
|
|
|
+ LEFT JOIN project p on emr.project_id=p.id
|
|
|
+ left join contracts c on c.project_id=p.id
|
|
|
+ <!--筛选条件-->
|
|
|
+ WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ <if test="request.contractCode!=null and request.contractCode!=''">
|
|
|
+ AND c.code LIKE CONCAT('%',#{request.contractCode,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="request.contractType!=null and request.contractType!=''">
|
|
|
+ AND c.type = #{request.contractType,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="request.contractStatus!=null and request.contractStatus!=''">
|
|
|
+ AND c.status = #{request.contractStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="request.projectName!=null and request.projectName!=''">
|
|
|
+ AND p.project_name LIKE CONCAT('%',#{request.projectName,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <!--新增时间搜索-->
|
|
|
+ <!--开始时间-->
|
|
|
+ <if test="request.starDate!=null and request.starDate!=''">
|
|
|
+ AND c.star_date >=#{request.starDate}
|
|
|
+ </if>
|
|
|
+ <!--结束时间-->
|
|
|
+ <if test="request.endDate!=null and request.endDate!=''">
|
|
|
+ AND c.end_date >=#{request.endDate}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--导出合同管理数据-大修/维保数据-->
|
|
|
+ <select id="findAllContractsManageData"
|
|
|
+ parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.ContractRequest"
|
|
|
+ resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.ContractManageExportDto">
|
|
|
+ select
|
|
|
+
|
|
|
+ <!--项目名称-->
|
|
|
+ p.project_name as projectName,
|
|
|
+
|
|
|
+ <!--客户名称-->
|
|
|
+ (select name from property_company where id=p.pp_company_id) as memberName,
|
|
|
+
|
|
|
+ <!--区域-->
|
|
|
+ (select area_name from region where region.id=p.region_id) as regionName,
|
|
|
+
|
|
|
+ <!--合同编号-->
|
|
|
+ c.code as contractCode,
|
|
|
|
|
|
<!--合同来源-->
|
|
|
case c.source when 1 then '商保新增' when 2 then '免保转签' when 3 then '续签' when 4 then '免保' else '暂无' end,
|
|
@@ -256,38 +291,95 @@
|
|
|
<!--台量-->
|
|
|
c.lift_num as liftNum,
|
|
|
|
|
|
- <!--金额=合同金额-->
|
|
|
+ <!--合同金额-->
|
|
|
+ c.moneys as moneys,
|
|
|
+
|
|
|
<!--签约时间-->
|
|
|
c.given_date as givenDate,
|
|
|
|
|
|
<!--签约人-->
|
|
|
c.given_user as givenUser,
|
|
|
|
|
|
- <!--未收-->
|
|
|
- erc.cost_money - erc.pay_money as NoPayMoney,
|
|
|
+ <!--实收金额-->
|
|
|
+ pay.work_money as workMoney
|
|
|
|
|
|
+ <!--未收-->
|
|
|
+ pay.plan_money - pay.work_money as NoPayMoney,
|
|
|
<!--配件条款-->
|
|
|
- c.parts_rules as partsRules,
|
|
|
+ c.parts_rules as partsRules
|
|
|
+ <!--表关联-->
|
|
|
+ from project p
|
|
|
+ LEFT JOIN
|
|
|
+ contracts c on c.project_id=p.id
|
|
|
+ left join payment pay on pay.contracts_id=c.id
|
|
|
+ <!--筛选条件-->
|
|
|
+ WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ <if test="request.contractCode!=null and request.contractCode!=''">
|
|
|
+ AND c.code LIKE CONCAT('%',#{request.contractCode,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="request.contractType!=null and request.contractType!=''">
|
|
|
+ AND c.type = #{request.contractType,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="request.contractStatus!=null and request.contractStatus!=''">
|
|
|
+ AND c.status = #{request.contractStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="request.projectName!=null and request.projectName!=''">
|
|
|
+ AND p.project_name LIKE CONCAT('%',#{request.projectName,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <!--新增时间搜索-->
|
|
|
+ <!--开始时间-->
|
|
|
+ <if test="request.starDate!=null and request.starDate!=''">
|
|
|
+ AND c.star_date >=#{request.starDate}
|
|
|
+ </if>
|
|
|
+ <!--结束时间-->
|
|
|
+ <if test="request.endDate!=null and request.endDate!=''">
|
|
|
+ AND c.end_date >=#{request.endDate}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
- <!--应收日期-->
|
|
|
- erc.cost_date as planDate,
|
|
|
- <!--期数-->
|
|
|
- <!--收款责任人-->
|
|
|
- erc.collection_man as collectionMan,
|
|
|
+ <!--急修合同合同数据-->
|
|
|
+ <select id="findAllErContractsManageData"
|
|
|
+ parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.ContractRequest"
|
|
|
+ resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.ContractManageExportDto">
|
|
|
+ <!--项目名称-->
|
|
|
+ p.project_name as projectName,
|
|
|
+ <!--客户名称-->
|
|
|
+ (select name from property_company where id=p.pp_company_id) as memberName,
|
|
|
<!--区域-->
|
|
|
(select area_name from region where region.id=p.region_id) as regionName,
|
|
|
- <!--帐龄-->
|
|
|
- erc.pay_date - erc.cost_date as paymentDays,
|
|
|
- <!--开票金额-->
|
|
|
- erc.invoice_money as amountInvoice,
|
|
|
- <!--开票时间-->
|
|
|
- erc.invoice_date as billingDate,
|
|
|
- <!--发票类型-->
|
|
|
- erc.invoice_type as invoiceType,
|
|
|
- <!--到账时间-->
|
|
|
- erc.pay_date as workDate,
|
|
|
+ <!--合同编号-->
|
|
|
+ c.code as contractCode,
|
|
|
+ <!--合同来源-->
|
|
|
+ case c.source when 1 then '商保新增' when 2 then '免保转签' when 3 then '续签' when 4 then '免保' else '暂无' end,
|
|
|
+
|
|
|
+ <!--合同类型-->
|
|
|
+ case c.type when 1 then '半包' when 2 then '半包' when 3 then '清包' when 4 then '全包' when 5 then '大修' else '暂无' end,
|
|
|
+
|
|
|
+ <!--合同开始时间-->
|
|
|
+ c.star_date as starDate,
|
|
|
+
|
|
|
+ <!--合同结束时间-->
|
|
|
+ c.end_date as endDate,
|
|
|
+
|
|
|
+ <!--台量-->
|
|
|
+ c.lift_num as liftNum,
|
|
|
+ <!--合同金额-->
|
|
|
+ c.moneys as moneys,
|
|
|
+ <!--签约时间-->
|
|
|
+ c.given_date as givenDate,
|
|
|
+
|
|
|
+ <!--签约人-->
|
|
|
+ c.given_user as givenUser,
|
|
|
+
|
|
|
<!--到账金额-->
|
|
|
erc.pay_money as workMoney
|
|
|
+
|
|
|
+ <!--未收-->
|
|
|
+ erc.cost_money - erc.pay_money as NoPayMoney,
|
|
|
+
|
|
|
+ <!--配件条款-->
|
|
|
+ c.parts_rules as partsRules
|
|
|
+
|
|
|
<!--表关联-->
|
|
|
from er_record_cost erc
|
|
|
LEFT JOIN emergency_repair emr on erc.er_record_id=emr.id
|