2024-08-09 15:27:34 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.pusong.business.mapper.PsTaskMainMapper" >
<resultMap id= "taskMainResult" type= "com.pusong.business.domain.vo.PsTaskMainVo" >
<id column= "id" property= "id" > </id>
<collection columnPrefix= "con_" property= "contractVo" ofType= "com.pusong.business.domain.vo.TaskContractVo" >
</collection>
<collection columnPrefix= "com_" property= "companyInfoVo" ofType= "com.pusong.business.domain.vo.PsCompanyInfoVo" >
</collection>
<collection columnPrefix= "cus_" property= "customInfoVo" ofType= "com.pusong.business.domain.vo.PsCustomInfoVo" >
</collection>
</resultMap>
<select id= "queryTaskPageList" resultMap= "taskMainResult" >
select main.id,
main.task_type,
main.start_date,
main.task_status,
main.contract_code,
2024-08-26 11:20:24 +08:00
main.invoice,
2024-08-09 15:27:34 +08:00
con.is_proxy con_is_proxy,
con.custom_scene con_custom_scene,
con.custom_manager con_custom_manager,
2024-08-22 18:05:53 +08:00
usr.nick_name con_custom_manager_name,
2024-08-09 15:27:34 +08:00
con.sign_desc con_sign_desc,
2024-08-22 18:05:53 +08:00
com.id com_id,
2024-08-09 15:27:34 +08:00
com.company_adress com_company_adress,
com.company_name com_company_name,
com.legal_person_name com_legal_person_name,
com.legal_person_idcard com_legal_person_idcard,
com.legal_person_phone com_legal_person_phone,
com.customer_num com_customer_num,
com.customer_cert com_customer_cert,
2024-08-22 18:05:53 +08:00
cus.id cus_id,
2024-08-09 15:27:34 +08:00
cus.custom_name cus_custom_name ,
cus.custom_mobile cus_custom_mobile,
2024-08-30 09:33:42 +08:00
(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 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 and pta.appoint_status != '50' and pta.del_flag = '0' order by id desc limit 0,1) as secAppo,
2024-08-22 18:05:53 +08:00
(CASE WHEN (con.contract_amount -
2024-08-09 15:27:34 +08:00
(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 )
) > 0 THEN '半款' ELSE '全款' END) as pay_stauts_desc,
(select GROUP_CONCAT(appoint.executor SEPARATOR ',')
2024-08-30 09:33:42 +08:00
from ps_task_appoint appoint where appoint.task_id = main.id and appoint.appoint_status != '50' and appoint.del_flag = '0') as executors,
2024-08-22 18:05:53 +08:00
(select GROUP_CONCAT(business.business_type SEPARATOR ',')
2024-08-30 09:33:42 +08:00
from ps_contract_business business where business.contract_code = con.contract_code and business.del_flag = '0') as business_type_name
2024-08-09 15:27:34 +08:00
from ps_task_main main
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_custom_info cus on con.custom_id = cus.id
left join sys_user usr on con.custom_manager = usr.user_id
${ew.getCustomSqlSegment}
</select>
2024-08-20 09:30:51 +08:00
<select id= "queryChildTaskPageList" resultMap= "taskMainResult" >
2024-08-09 15:27:34 +08:00
select
main.task_type,
main.start_date,
main.task_status,
main.contract_code,
2024-08-23 18:08:56 +08:00
main.id main_id,
2024-08-09 15:27:34 +08:00
con.is_proxy con_is_proxy,
con.custom_scene con_custom_scene,
con.custom_manager con_custom_manager,
2024-08-22 18:05:53 +08:00
usr.nick_name con_custom_manager_name,
2024-08-09 15:27:34 +08:00
con.sign_desc con_sign_desc,
2024-08-22 18:05:53 +08:00
com.id com_id,
2024-08-09 15:27:34 +08:00
com.company_adress com_company_adress,
com.company_name com_company_name,
com.legal_person_name com_legal_person_name,
com.legal_person_idcard com_legal_person_idcard,
com.legal_person_phone com_legal_person_phone,
com.customer_num com_customer_num,
com.customer_cert com_customer_cert,
2024-08-22 18:05:53 +08:00
com.finance_account_no com_finance_account_no,
cus.id cus_id,
2024-08-09 15:27:34 +08:00
cus.custom_name cus_custom_name ,
cus.custom_mobile cus_custom_mobile,
2024-08-22 18:05:53 +08:00
(CASE WHEN (con.contract_amount -
2024-08-09 15:27:34 +08:00
(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 )
) > 0 THEN '半款' ELSE '全款' END) as pay_stauts_desc,
appo.executor as executors,
appo.appoint_status,
appo.id,
2024-08-26 18:08:49 +08:00
appo.task_desc,
2024-08-09 15:27:34 +08:00
(select GROUP_CONCAT(business.business_type SEPARATOR ',')
2024-08-30 09:33:42 +08:00
from ps_contract_business business where business.contract_code = con.contract_code and business.del_flag = '0') as business_type_name
2024-08-09 15:27:34 +08:00
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_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_custom_info cus on con.custom_id = cus.id
left join sys_user usr on con.custom_manager = usr.user_id
${ew.getCustomSqlSegment}
</select>
</mapper>