Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intel_promotion_api
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyilin
intel_promotion_api
Commits
ba14e85e
Commit
ba14e85e
authored
Jan 11, 2025
by
罗林杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改首页查询
parent
e7285e0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
19 deletions
+58
-19
SysUnitMapper.xml
...esources/mapper/business/sysunit/mapper/SysUnitMapper.xml
+58
-19
No files found.
src/main/resources/mapper/business/sysunit/mapper/SysUnitMapper.xml
View file @
ba14e85e
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
</select>
</select>
<select
id=
"statistics"
resultType=
"org.rcisoft.business.sysunit.entity.SysUnit"
>
<select
id=
"statistics"
resultType=
"org.rcisoft.business.sysunit.entity.SysUnit"
>
SELECT su.*,
SELECT su.*,
IFNULL(suu.agentNum, 0) as agentNum,
IFNULL(suu
v.agentNum + suun
.agentNum, 0) as agentNum,
IFNULL(cunvv.videoNum, 0) as videoNum,
IFNULL(cunvv.videoNum, 0) as videoNum,
IFNULL(cunvv.videoViews, 0) as videoViews,
IFNULL(cunvv.videoViews, 0) as videoViews,
IFNULL(cunvn.articleNum, 0) as articleNum,
IFNULL(cunvn.articleNum, 0) as articleNum,
...
@@ -124,15 +124,32 @@
...
@@ -124,15 +124,32 @@
IFNULL( COUNT( DISTINCT cpc.user_id ), 0 ) AS agentNum
IFNULL( COUNT( DISTINCT cpc.user_id ), 0 ) AS agentNum
FROM
FROM
cms_price_click cpc
cms_price_click cpc
LEFT JOIN cms_video cv ON cpc.news_video_id = cv.business_id
WHERE
WHERE
1 = 1
1 = 1
and del_flag = 0
and cpc.type = 1
and cpc.del_flag = 0
AND cpc.unit_id = #{entity.businessId}
AND cpc.unit_id = #{entity.businessId}
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND cpc.update_date >= #{entity.startTime}
AND cv.release_time >= #{entity.startTime}
AND cpc.update_date
<
= #{entity.endTime}
AND cv.release_time
<
= #{entity.endTime}
</if>
) suuv ON suuv.unit_id = su.business_id
LEFT JOIN (SELECT
cpc.unit_id,
IFNULL( COUNT( DISTINCT cpc.user_id ), 0 ) AS agentNum
FROM
cms_price_click cpc
LEFT JOIN cms_news cn ON cpc.news_video_id = cn.business_id
WHERE
cpc.unit_id = #{entity.businessId}
AND cpc.type = 0
and cpc.del_flag = 0
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND cn.release_date >= #{entity.startTime}
AND cn.release_date
<
= #{entity.endTime}
</if>
</if>
) suu
ON suu
.unit_id = su.business_id
) suu
n ON suun
.unit_id = su.business_id
LEFT JOIN (SELECT
LEFT JOIN (SELECT
cpc.unit_id,
cpc.unit_id,
COUNT( DISTINCT cpc.news_video_id ) AS videoNum,
COUNT( DISTINCT cpc.news_video_id ) AS videoNum,
...
@@ -140,13 +157,14 @@
...
@@ -140,13 +157,14 @@
IFNULL( cpc.click_through_rate, 0 )) AS videoViews
IFNULL( cpc.click_through_rate, 0 )) AS videoViews
FROM
FROM
cms_price_click cpc
cms_price_click cpc
LEFT JOIN cms_video cv ON cpc.news_video_id = cv.business_id
WHERE
WHERE
cpc.unit_id = #{entity.businessId}
cpc.unit_id = #{entity.businessId}
AND cpc.type = 1
AND cpc.type = 1
and cpc.del_flag = 0
and cpc.del_flag = 0
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND c
pc.update_dat
e >= #{entity.startTime}
AND c
v.release_tim
e >= #{entity.startTime}
AND c
pc.update_dat
e
<
= #{entity.endTime}
AND c
v.release_tim
e
<
= #{entity.endTime}
</if>
</if>
) cunvv ON cunvv.unit_id = su.business_id
) cunvv ON cunvv.unit_id = su.business_id
LEFT JOIN (SELECT
LEFT JOIN (SELECT
...
@@ -156,13 +174,14 @@
...
@@ -156,13 +174,14 @@
IFNULL( cpc.click_through_rate, 0 )) AS articleViews
IFNULL( cpc.click_through_rate, 0 )) AS articleViews
FROM
FROM
cms_price_click cpc
cms_price_click cpc
LEFT JOIN cms_news cn ON cpc.news_video_id = cn.business_id
WHERE
WHERE
cpc.unit_id = #{entity.businessId}
cpc.unit_id = #{entity.businessId}
AND cpc.type = 0
AND cpc.type = 0
and cpc.del_flag = 0
and cpc.del_flag = 0
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND c
pc.updat
e_date >= #{entity.startTime}
AND c
n.releas
e_date >= #{entity.startTime}
AND c
pc.updat
e_date
<
= #{entity.endTime}
AND c
n.releas
e_date
<
= #{entity.endTime}
</if>
</if>
) cunvn ON cunvn.unit_id = su.business_id
) cunvn ON cunvn.unit_id = su.business_id
WHERE 1 = 1
WHERE 1 = 1
...
@@ -201,20 +220,40 @@
...
@@ -201,20 +220,40 @@
</select>
</select>
<select
id=
"statisticsByTypeBarChart"
resultType=
"org.rcisoft.business.sysunit.dto.StatisticsDto"
>
<select
id=
"statisticsByTypeBarChart"
resultType=
"org.rcisoft.business.sysunit.dto.StatisticsDto"
>
SELECT su.`name`,
SELECT su.`name`,
SUM(CASE WHEN cpc.type = 0 THEN cpc.click_through_rate ELSE 0 END) AS newsRate,
SUM(CASE WHEN cpc.type = 0
SUM(CASE WHEN cpc.type = 1 THEN cpc.click_through_rate ELSE 0 END) AS videoRate
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND cn.release_date >= #{entity.startTime}
AND cn.release_date
<
= #{entity.endTime}
</if>
THEN cpc.click_through_rate ELSE 0 END) AS newsRate,
SUM(CASE WHEN cpc.type = 1
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND cv.release_time >= #{entity.startTime}
AND cv.release_time
<
= #{entity.endTime}
</if>
THEN cpc.click_through_rate ELSE 0 END) AS videoRate
FROM cms_price_click cpc
FROM cms_price_click cpc
LEFT JOIN sys_user su ON su.business_id = cpc.user_id
LEFT JOIN sys_user su ON su.business_id = cpc.user_id
LEFT JOIN cms_news cn ON cpc.news_video_id = cn.business_id
LEFT JOIN cms_video cv ON cpc.news_video_id = cv.business_id
WHERE 1 = 1
WHERE 1 = 1
AND cpc.del_flag = 0
AND cpc.del_flag = 0
AND cpc.flag = 1
AND cpc.flag = 1
and cpc.unit_id = #{entity.businessId}
and cpc.unit_id = #{entity.businessId}
GROUP BY su.business_id
ORDER BY
SUM(CASE WHEN cpc.type = 1
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND c
pc.update_dat
e >= #{entity.startTime}
AND c
v.release_tim
e >= #{entity.startTime}
AND c
pc.update_dat
e
<
= #{entity.endTime}
AND c
v.release_tim
e
<
= #{entity.endTime}
</if>
</if>
GROUP BY su.business_id
THEN cpc.click_through_rate ELSE 0 END) +
ORDER BY SUM(cpc.click_through_rate + cpc.click_through_rate) DESC
SUM(CASE WHEN cpc.type = 0
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND cn.release_date >= #{entity.startTime}
AND cn.release_date
<
= #{entity.endTime}
</if>
THEN cpc.click_through_rate ELSE 0 END) DESC
limit 0 ,10
limit 0 ,10
</select>
</select>
<select
id=
"statisticsByTypePieChart"
resultType=
"org.rcisoft.business.sysunit.dto.StatisticsDto"
>
<select
id=
"statisticsByTypePieChart"
resultType=
"org.rcisoft.business.sysunit.dto.StatisticsDto"
>
...
@@ -274,8 +313,8 @@
...
@@ -274,8 +313,8 @@
AND cpc.del_flag = 0
AND cpc.del_flag = 0
AND cpc.flag = 1
AND cpc.flag = 1
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND c
pc.updat
e_date >= #{entity.startTime}
AND c
n.releas
e_date >= #{entity.startTime}
AND c
pc.updat
e_date
<
= #{entity.endTime}
AND c
n.releas
e_date
<
= #{entity.endTime}
</if>
</if>
GROUP BY cn.business_id
GROUP BY cn.business_id
order by SUM(cpc.click_through_rate)
order by SUM(cpc.click_through_rate)
...
@@ -294,8 +333,8 @@
...
@@ -294,8 +333,8 @@
AND cpc.del_flag = 0
AND cpc.del_flag = 0
AND cpc.flag = 1
AND cpc.flag = 1
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
<if
test=
"entity.startTime !=null and entity.startTime != '' and entity.endTime !=null and entity.endTime != '' "
>
AND c
pc.update_dat
e >= #{entity.startTime}
AND c
v.release_tim
e >= #{entity.startTime}
AND c
pc.update_dat
e
<
= #{entity.endTime}
AND c
v.release_tim
e
<
= #{entity.endTime}
</if>
</if>
GROUP BY cv.business_id
GROUP BY cv.business_id
order by SUM(cpc.click_through_rate)
order by SUM(cpc.click_through_rate)
...
...
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