📖 CRM:code review 合同金额排行榜、回款金额排行榜

This commit is contained in:
YunaiV
2024-01-30 09:24:42 +08:00
parent 278f220cef
commit 52a68e1838
13 changed files with 92 additions and 22 deletions

View File

@@ -7,6 +7,7 @@
resultType="cn.iocoder.yudao.module.bi.controller.admin.ranking.vo.BiContractRanKingRespVO">
SELECT IFNULL(SUM(t.price), 0) AS price, su.nickname, t.owner_user_id, dept.name AS deptName
FROM crm_contract t
<!-- TODO @anhaohaosystem_users、system_dept 是不是没用到?尽量不连这 2 个表,微服务下会是独立仓库;如果显示需要,可以在 service 读取后拼接; -->
LEFT JOIN system_users AS su ON su.id = t.owner_user_id
LEFT JOIN system_dept AS dept ON dept.id = su.dept_id
WHERE t.deleted = 0
@@ -17,10 +18,12 @@
#{item}
</foreach>
</if>
<!-- TODO @anhaohao在某个区间的时间这么做有点浪费性能一般做法是 beginTime 是开始时间00:00:00finalTime 是结束时间23:59:59这样实现的 -->
AND DATE_FORMAT(t.order_date,'${sqlDateFormat}') between #{beginTime} and #{finalTime}
GROUP BY t.owner_user_id
ORDER BY price DESC
</select>
<select id="receivablesRanKing"
resultType="cn.iocoder.yudao.module.bi.controller.admin.ranking.vo.BiReceivablesRanKingRespVO">
SELECT IFNULL(SUM(t.price), 0) AS price, su.nickname, t.owner_user_id, dept.name AS deptName