36 lines
1.3 KiB
XML
Raw Normal View History

<?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>