修改:CRM 商业智能,合并模块到 crm,优化查询

This commit is contained in:
安浩浩
2024-01-31 23:35:27 +08:00
parent acb8d3f23b
commit 46e01e07a8
37 changed files with 278 additions and 715 deletions

View File

@@ -0,0 +1,35 @@
<?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="cn.iocoder.yudao.module.crm.dal.mysql.bi.BiRankingMapper">
<select id="contractRanKing"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO">
SELECT IFNULL(SUM(t.price), 0) AS price, t.owner_user_id
FROM crm_contract t
WHERE t.deleted = 0
AND t.audit_status = 20
and t.owner_user_id in
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND t.order_date between #{startTime} and #{endTime}
GROUP BY t.owner_user_id
ORDER BY price DESC
</select>
<select id="receivablesRanKing"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO">
SELECT IFNULL(SUM(t.price), 0) AS price, t.owner_user_id
FROM crm_receivable t
WHERE t.deleted = 0
AND t.audit_status = 20
and t.owner_user_id in
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND t.return_time between #{startTime} and #{endTime}
GROUP BY t.owner_user_id
ORDER BY price DESC
</select>
</mapper>