This commit is contained in:
1073413548 2024-08-30 09:33:42 +08:00
parent e3b65935cd
commit 7823a412b9
4 changed files with 11 additions and 11 deletions

View File

@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="queryContractList" > <sql id="queryContractList" >
select info.*, select info.*,
(select apply_date from ps_contract_info pci where pci.custom_id = info.custom_id order by pci.apply_date limit 0,1) (select apply_date from ps_contract_info pci where pci.custom_id = info.custom_id and pci.is_cancel != '03' and pci.contract_status != '10' order by pci.apply_date limit 0,1)
as first_apply_date, as first_apply_date,
com.id com_id, com.id com_id,
com.company_name com_company_name, com.company_name com_company_name,

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select pay.id,pay.money return_money,pay.pay_mode,pay.gath_main,pay.pay_status,pay.pay_certification, select pay.id,pay.money return_money,pay.pay_mode,pay.gath_main,pay.pay_status,pay.pay_certification,
com.company_name,cus.custom_name,cus.custom_mobile,cus.custom_manager,info.contract_code,info.pdf_id, com.company_name,cus.custom_name,cus.custom_mobile,cus.custom_manager,info.contract_code,info.pdf_id,
(select GROUP_CONCAT(business.business_type SEPARATOR ',') (select GROUP_CONCAT(business.business_type SEPARATOR ',')
from ps_contract_business business where business.contract_code = info.contract_code) as business_type_name from ps_contract_business business where business.contract_code = info.contract_code and business.del_flag = '0') as business_type_name
from ps_contract_pay pay from ps_contract_pay pay
left join ps_contract_info info on pay.contract_code = info.contract_code and pay.pay_status in (1,2,3) and pay.business_type = 2 left join ps_contract_info info on pay.contract_code = info.contract_code and pay.pay_status in (1,2,3) and pay.business_type = 2
left join ps_company_info com on com.id = info.company_id left join ps_company_info com on com.id = info.company_id

View File

@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom.custom_name, custom.custom_name,
custom.custom_mobile, custom.custom_mobile,
(select GROUP_CONCAT(business.business_type SEPARATOR ',') (select GROUP_CONCAT(business.business_type SEPARATOR ',')
from ps_contract_business business where business.contract_code = con.contract_code) as business_type_name, from ps_contract_business business where business.contract_code = con.contract_code and business.del_flag = '0') as business_type_name,
(select max(start_date) from ps_task_main ptm where ptm.contract_code = con.contract_code and ptm.task_type='1' ) start_date, (select max(start_date) from ps_task_main ptm where ptm.contract_code = con.contract_code and ptm.task_type='1' ) start_date,
com.finance_account_no, com.finance_account_no,
custom.custom_manager, custom.custom_manager,
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
com.legal_person_idcard, com.legal_person_idcard,
com.legal_person_phone, com.legal_person_phone,
(select GROUP_CONCAT(appoint.executor SEPARATOR ',') (select GROUP_CONCAT(appoint.executor SEPARATOR ',')
from ps_task_appoint appoint where appoint.contract_code = con.contract_code) as executors, from ps_task_appoint appoint where appoint.contract_code = con.contract_code and appoint.appoint_status != '50' and appoint.del_flag = '0') as executors,
con.sign_desc, con.sign_desc,
con.contract_amount, con.contract_amount,
con.finish_date, con.finish_date,
@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from from
ps_custom_info custom ps_custom_info custom
left join left join
(select * from ps_contract_info info where info.create_time in (select max(pci.create_time) create_time from ps_contract_info pci group by pci.custom_id)) (select * from ps_contract_info info where info.create_time in (select max(pci.create_time) create_time from ps_contract_info pci where coninfo.contract_status != '10' and coninfo.is_cancel != '03' group by pci.custom_id))
con on con.custom_id = custom.id con on con.custom_id = custom.id
left join left join
ps_company_info com on com.id = con.company_id ps_company_info com on com.id = con.company_id

View File

@ -38,17 +38,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
cus.id cus_id, cus.id cus_id,
cus.custom_name cus_custom_name , cus.custom_name cus_custom_name ,
cus.custom_mobile cus_custom_mobile, cus.custom_mobile cus_custom_mobile,
(select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=1 order by id desc limit 0,1) as inAppo, (select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=1 and pta.appoint_status != '50' and pta.del_flag = '0' order by id desc limit 0,1) as inAppo,
(select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=2 order by id desc limit 0,1) as outAppo, (select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=2 and pta.appoint_status != '50' and pta.del_flag = '0' order by id desc limit 0,1) as outAppo,
(select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=3 order by id desc limit 0,1) as secAppo, (select pta.id from ps_task_appoint pta where pta.task_id=main.id and pta.appoint_type=3 and pta.appoint_status != '50' and pta.del_flag = '0' order by id desc limit 0,1) as secAppo,
(CASE WHEN (con.contract_amount - (CASE WHEN (con.contract_amount -
(select IFNULL(sum(money),0) from ps_contract_pay pay where pay.business_type =1 ) + (select IFNULL(sum(money),0) from ps_contract_pay pay where pay.business_type =1 ) +
(select IFNULL(sum(money),0) from ps_contract_pay cpay where cpay.business_type =2 ) (select IFNULL(sum(money),0) from ps_contract_pay cpay where cpay.business_type =2 )
) > 0 THEN '半款' ELSE '全款' END) as pay_stauts_desc, ) > 0 THEN '半款' ELSE '全款' END) as pay_stauts_desc,
(select GROUP_CONCAT(appoint.executor SEPARATOR ',') (select GROUP_CONCAT(appoint.executor SEPARATOR ',')
from ps_task_appoint appoint where appoint.task_id = main.id) as executors, from ps_task_appoint appoint where appoint.task_id = main.id and appoint.appoint_status != '50' and appoint.del_flag = '0') as executors,
(select GROUP_CONCAT(business.business_type SEPARATOR ',') (select GROUP_CONCAT(business.business_type SEPARATOR ',')
from ps_contract_business business where business.contract_code = con.contract_code) as business_type_name from ps_contract_business business where business.contract_code = con.contract_code and business.del_flag = '0') as business_type_name
from ps_task_main main from ps_task_main main
left join ps_contract_info con on main.contract_code = con.contract_code left join ps_contract_info con on main.contract_code = con.contract_code
left join ps_company_info com on con.company_id = com.id left join ps_company_info com on con.company_id = com.id
@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
appo.id, appo.id,
appo.task_desc, appo.task_desc,
(select GROUP_CONCAT(business.business_type SEPARATOR ',') (select GROUP_CONCAT(business.business_type SEPARATOR ',')
from ps_contract_business business where business.contract_code = con.contract_code) as business_type_name from ps_contract_business business where business.contract_code = con.contract_code and business.del_flag = '0') as business_type_name
from ps_task_appoint appo from ps_task_appoint appo
left join ps_task_main main on appo.task_id = main.id and appo.appoint_status != '50' left join ps_task_main main on appo.task_id = main.id and appo.appoint_status != '50'
left join ps_contract_info con on main.contract_code = con.contract_code left join ps_contract_info con on main.contract_code = con.contract_code