|
@@ -466,7 +466,7 @@
|
|
|
p.save_file_date,
|
|
|
o.id as orderFundId,
|
|
|
fi.invoiceAmount,
|
|
|
- (SELECT IF(COUNT(id) > 0, TRUE, FALSE) FROM personal_production WHERE deleted = 0 AND target_id = pt.id) AS harReport
|
|
|
+ pp.productions
|
|
|
from
|
|
|
personal p
|
|
|
LEFT JOIN personal_target pt ON pt.personal_id = p.id
|
|
@@ -478,6 +478,7 @@
|
|
|
LEFT JOIN user u3 ON u3.id = p.pricing_staff
|
|
|
left join (select id,business_id,real_amount,should_amount from order_fund where business_type='PERSONAL_BUSINESS' and deleted = 0) o on o.business_id = p.id
|
|
|
left join (select sum(real_amount) as invoiceAmount,order_fund_id from finance_invoice where state ='已开票' and deleted = 0 GROUP BY order_fund_id) fi on fi.order_fund_id = o.id
|
|
|
+ LEFT JOIN ( SELECT target_id, GROUP_CONCAT( case production when 'STATEMENT' then '意见书' when 'FINAL' then '结果报告' when 'TECHNIC' then '技术报告' when 'LETTER' then '复评函' end )as productions FROM personal_production WHERE deleted = 0 AND production_time IS NOT NULL GROUP BY target_id ) pp on pp.target_id = pt.id
|
|
|
where
|
|
|
p.deleted = 0 and p.client_manager_id = #{personal.clientManagerId}
|
|
|
<if test="keyword!=null and keyword!='' ">
|
|
@@ -529,6 +530,9 @@
|
|
|
<if test="personal!=null and personal.clientSubName!=null and personal.clientSubName!=''">
|
|
|
and cc2.NAME like concat('%',#{personal.clientSubName},'%')
|
|
|
</if>
|
|
|
+ <if test="personal!=null and personal.productions!=null and personal.productions!='' ">
|
|
|
+ and pp.productions like concat('%',#{personal.productions},'%')
|
|
|
+ </if>
|
|
|
ORDER BY
|
|
|
<if test="personal!=null and personal.invoiceAmount!=null">
|
|
|
fi.invoiceAmount=${personal.invoiceAmount} desc,
|
|
@@ -616,7 +620,8 @@
|
|
|
pt.acreage,
|
|
|
pt.price,
|
|
|
pt.amount,
|
|
|
- ps.created AS valueTiming,
|
|
|
+ (select created from work_flow_log where instance_id =
|
|
|
+ (select id from work_flow_node_instance where business_type = 'PERSONAL_BUSINESS' and deleted = 0 and business_id = p.id and node_id = 100 ) order by created desc limit 1) AS valueTiming,
|
|
|
found.real_amount,
|
|
|
cc1.NAME AS clientName,
|
|
|
cc2.NAME AS clientSubName,
|
|
@@ -628,11 +633,11 @@
|
|
|
u3.NAME AS pricingStaffName,
|
|
|
p.created,
|
|
|
p.created as xCreated,
|
|
|
- pt.productions,
|
|
|
+ pp.productions,
|
|
|
p.evaluate_aim
|
|
|
FROM
|
|
|
personal p
|
|
|
- LEFT JOIN (select personal_id,acreage,price,amount,created,productions from personal_target where deleted = 0) pt ON pt.personal_id = p.id
|
|
|
+ LEFT JOIN (select id, personal_id,acreage,price,amount,created from personal_target where deleted = 0) pt ON pt.personal_id = p.id
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
f.business_id,
|
|
@@ -643,7 +648,6 @@
|
|
|
f.business_type = 'PERSONAL_BUSINESS'
|
|
|
AND f.deleted = 0
|
|
|
) found ON found.business_id = p.id
|
|
|
- left join (select personal_id, created from personal_scene) ps on ps.personal_id = p.id
|
|
|
LEFT JOIN (select id,name from customer_company where deleted=0) cc1 ON cc1.id = p.clientele_id
|
|
|
LEFT JOIN (select id,name from customer_company where deleted=0) cc2 ON cc2.id = p.clientele_sub_id
|
|
|
LEFT JOIN (select id,name,mobile from customer_linkman where deleted = 0) cl1 ON cl1.id = p.clientele_contact_id
|
|
@@ -651,6 +655,7 @@
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u1 ON u1.id = p.outward_staff
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u2 ON u2.id = p.inward_staff
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u3 ON u3.id = p.pricing_staff
|
|
|
+ LEFT JOIN ( SELECT target_id, GROUP_CONCAT( case production when 'STATEMENT' then '意见书' when 'FINAL' then '结果报告' when 'TECHNIC' then '技术报告' end )as productions FROM personal_production WHERE deleted = 0 AND production_time IS NOT NULL GROUP BY target_id ) pp on pp.target_id = pt.id
|
|
|
WHERE
|
|
|
p.deleted = 0
|
|
|
<if test="keyword!=null and keyword!='' ">
|
|
@@ -701,7 +706,7 @@
|
|
|
and u4.name like concat('%',#{personal.handlerName},'%')
|
|
|
</if>
|
|
|
<if test="personal!=null and personal.productions!=null and personal.productions!='' ">
|
|
|
- and pt.productions like concat('%',#{personal.productions},'%')
|
|
|
+ and pp.productions like concat('%',#{personal.productions},'%')
|
|
|
</if>
|
|
|
<if test="personal!=null and personal.evaluateAim!=null and personal.evaluateAim!='' ">
|
|
|
and p.evaluate_aim = #{personal.evaluateAim}
|
|
@@ -714,7 +719,7 @@
|
|
|
count(1)
|
|
|
FROM
|
|
|
personal p
|
|
|
- LEFT JOIN (select personal_id,acreage,price,amount,created from personal_target where deleted = 0) pt ON pt.personal_id = p.id
|
|
|
+ LEFT JOIN (select id, personal_id,acreage,price,amount,created from personal_target where deleted = 0) pt ON pt.personal_id = p.id
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
f.business_id,
|
|
@@ -733,6 +738,7 @@
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u1 ON u1.id = p.outward_staff
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u2 ON u2.id = p.inward_staff
|
|
|
LEFT JOIN (select id,name from user where deleted = 0) u3 ON u3.id = p.pricing_staff
|
|
|
+ LEFT JOIN ( SELECT target_id, GROUP_CONCAT( case production when 'STATEMENT' then '意见书' when 'FINAL' then '结果报告' when 'TECHNIC' then '技术报告' when 'LETTER' then '复评函' end )as productions FROM personal_production WHERE deleted = 0 AND production_time IS NOT NULL GROUP BY target_id ) pp on pp.target_id = pt.id
|
|
|
WHERE
|
|
|
p.deleted = 0
|
|
|
<if test="keyword!=null and keyword!='' ">
|
|
@@ -785,6 +791,9 @@
|
|
|
<if test="personal!=null and personal.evaluateAim!=null and personal.evaluateAim!='' ">
|
|
|
and p.evaluate_aim = #{personal.evaluateAim}
|
|
|
</if>
|
|
|
+ <if test="personal!=null and personal.productions!=null and personal.productions!='' ">
|
|
|
+ and pp.productions like concat('%',#{personal.productions},'%')
|
|
|
+ </if>
|
|
|
order by p.created desc
|
|
|
</select>
|
|
|
</mapper>
|