Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
d01d96f7
Commit
d01d96f7
authored
Apr 28, 2022
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分公司和营业部分开2
parent
3d2a9787
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
6 deletions
+53
-6
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
+53
-6
No files found.
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
View file @
d01d96f7
...
...
@@ -328,17 +328,64 @@
and YEAR(o.underwriting_date) = YEAR(now())
</otherwise>
</choose>
and p.insurer_branch_id is not null
group by p.insurer_branch_id
union all
<include
refid=
"statisticsSalesYDShangHaiDept"
/>
order by 4 desc
</select>
<sql
id=
"statisticsSalesYDShangHaiDept"
>
select
'上海营业部' as typeName,
b.id as typeId,
'' as level,
if(GROUP_CONCAT(DISTINCT o.id) is null, 0,
(select sum(t.order_price) from ag_po_order t where FIND_IN_SET(t.id, GROUP_CONCAT(DISTINCT o.id SEPARATOR ',')))
) as fyp,
concat(ifnull(sum(o.fyc_amount*lip.achievements_rate/100),0),'') as fyc,
ifnull(count(DISTINCT o.id),0) as pieces
from ag_acl_practitioner p
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
INNER JOIN ag_po_order o ON o.policy_no = lip.policy_no
left join ag_product prd on prd.id = o.product_id
left join ag_product_category c1 on c1.id = prd.product_category_id
left join ag_product_plan a on o.plan_id = a.id
left join ag_product aa on aa.id = a.product_id
left join ag_product_category c2 on c2.id = aa.product_category_id
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
where o.status = 3 and o.payment_status=3
and p.is_active = 1
and p.dept_id = (SELECT id from ag_acl_insurer_branch_dept where insurer_id=888 and name='上海营业部')
<choose>
<when
test=
"type.equalsIgnoreCase('B')"
>
group by p.insurer_branch_id
<when
test=
"category.equalsIgnoreCase('life')"
>
and (c1.id in (2,5,8) or c2.id in (2,5,8))
</when>
<when
test=
"category.equalsIgnoreCase('pc')"
>
and (c1.id not in (2,5,8) or c2.id not in (2,5,8))
</when>
</choose>
<choose>
<when
test=
"time.equalsIgnoreCase('D')"
>
and TO_DAYS(o.underwriting_date) = TO_DAYS(now())
</when>
<when
test=
"time.equalsIgnoreCase('W')"
>
and YEARWEEK(DATE_FORMAT(o.underwriting_date,'%Y-%m-%d')) = YEARWEEK(NOW())
</when>
<when
test=
"time.equalsIgnoreCase('M')"
>
and DATE_FORMAT(o.underwriting_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when
test=
"time.equalsIgnoreCase('Q')"
>
and QUARTER(o.underwriting_date) = QUARTER(NOW()) AND year(o.underwriting_date)=year(now())
</when>
<otherwise>
and p.subordinate_system_id is not null
group by p.subordinate_system_id
and YEAR(o.underwriting_date) = YEAR(now())
</otherwise>
</choose>
order by 4 desc
</select>
</sql>
<select
id=
"statisticsSalesTeam"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsSalesInfo"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
" union all "
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment