CRM:优化合同金额排行、回款金额排行
parent
1fd731a90a
commit
e9a29e6dd4
@ -1,9 +0,0 @@
|
|||||||
### 合同金额排行榜
|
|
||||||
GET {{baseUrl}}/crm/bi-ranking/contract-ranKing
|
|
||||||
Authorization: Bearer {{token}}
|
|
||||||
tenant-id: {{adminTenentId}}
|
|
||||||
|
|
||||||
### 回款金额排行榜
|
|
||||||
GET {{baseUrl}}/crm/bi-ranking/receivables-ranKing
|
|
||||||
Authorization: Bearer {{token}}
|
|
||||||
tenant-id: {{adminTenentId}}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.bi;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.service.bi.BiRankingService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 排行榜")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/crm/bi-ranking")
|
|
||||||
@Validated
|
|
||||||
public class BiRankingController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private BiRankingService biRankingService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合同金额排行榜
|
|
||||||
*/
|
|
||||||
@GetMapping("/contract-ranking")
|
|
||||||
@Operation(summary = "合同金额排行榜")
|
|
||||||
@PreAuthorize("@ss.hasPermission('bi:ranking:query')")
|
|
||||||
public CommonResult<List<BiRanKingRespVO>> contractAmountRanking(BiRankingReqVO biRankingReqVO) {
|
|
||||||
return success(biRankingService.contractRanKing(biRankingReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回款金额排行榜
|
|
||||||
*/
|
|
||||||
@GetMapping("/receivables-ranking")
|
|
||||||
@Operation(summary = "回款金额排行榜")
|
|
||||||
@PreAuthorize("@ss.hasPermission('bi:ranking:query')")
|
|
||||||
public CommonResult<List<BiRanKingRespVO>> receivablesRanKing(BiRankingReqVO biRankingReqVO) {
|
|
||||||
return success(biRankingService.receivablesRanKing(biRankingReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
### 合同金额排行榜
|
||||||
|
GET {{baseUrl}}/crm/bi-rank/get-contract-price-rank?deptId=100×[0]=2022-12-12 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 回款金额排行榜
|
||||||
|
GET {{baseUrl}}/crm/bi-rank/get-receivable-price-rank?deptId=100×[0]=2022-12-12 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.bi;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.bi.CrmBiRankingService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - CRM BI 排行榜")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crm/bi-rank")
|
||||||
|
@Validated
|
||||||
|
public class CrmBiRankController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmBiRankingService rankingService;
|
||||||
|
|
||||||
|
@GetMapping("/get-contract-price-rank")
|
||||||
|
@Operation(summary = "获得合同金额排行榜")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
|
||||||
|
public CommonResult<List<CrmBiRanKRespVO>> getContractPriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
|
||||||
|
return success(rankingService.getContractPriceRank(rankingReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-receivable-price-rank")
|
||||||
|
@Operation(summary = "获得回款金额排行榜")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
|
||||||
|
public CommonResult<List<CrmBiRanKRespVO>> getReceivablePriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
|
||||||
|
return success(rankingService.getReceivablePriceRank(rankingReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理后台 - 排行榜 Request VO
|
|
||||||
*
|
|
||||||
* @author anhaohao
|
|
||||||
*/
|
|
||||||
@Schema(description = "管理后台 - 排行榜 Request VO")
|
|
||||||
@Data
|
|
||||||
public class BiRankingReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-12-12 00:00:00")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime startTime;
|
|
||||||
|
|
||||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-12-12 23:59:59")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime endTime;
|
|
||||||
|
|
||||||
@Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1")
|
|
||||||
private List<Long> userIds;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.dal.mysql.bi;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author anhaohao
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BiRankingMapper extends BaseMapperX {
|
|
||||||
/**
|
|
||||||
* 合同金额排行榜
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
* @return List<BiContractAmountRankingRespVO>
|
|
||||||
*/
|
|
||||||
List<BiRanKingRespVO> contractRanKing(BiRankingReqVO biRankingReqVO);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回款金额排行榜
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
* @return List<BiContractAmountRankingRespVO>
|
|
||||||
*/
|
|
||||||
List<BiRanKingRespVO> receivablesRanKing(BiRankingReqVO biRankingReqVO);
|
|
||||||
}
|
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.bi;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM BI 排行榜 Mapper
|
||||||
|
*
|
||||||
|
* @author anhaohao
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmBiRankingMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询合同金额排行榜
|
||||||
|
*
|
||||||
|
* @param rankReqVO 参数
|
||||||
|
* @return 合同金额排行榜
|
||||||
|
*/
|
||||||
|
List<CrmBiRanKRespVO> selectContractPriceRank(CrmBiRankReqVO rankReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询回款金额排行榜
|
||||||
|
*
|
||||||
|
* @param rankReqVO 参数
|
||||||
|
* @return 回款金额排行榜
|
||||||
|
*/
|
||||||
|
List<CrmBiRanKRespVO> selectReceivablePriceRank(CrmBiRankReqVO rankReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.bi;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BI 排行榜 Service 接口
|
|
||||||
*
|
|
||||||
* @author anhaohao
|
|
||||||
*/
|
|
||||||
public interface BiRankingService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合同金额排行榜
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
* @return List<BiContractAmountRankingRespVO>
|
|
||||||
*/
|
|
||||||
List<BiRanKingRespVO> contractRanKing(BiRankingReqVO biRankingReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回款金额排行榜
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
* @return List<BiContractAmountRankingRespVO>
|
|
||||||
*/
|
|
||||||
List<BiRanKingRespVO> receivablesRanKing(BiRankingReqVO biRankingReqVO);
|
|
||||||
}
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.bi;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.bi.BiRankingMapper;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service(value = "biRankingService")
|
|
||||||
@Validated
|
|
||||||
public class BiRankingServiceImpl implements BiRankingService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private BiRankingMapper biRankingMapper;
|
|
||||||
@Resource
|
|
||||||
private AdminUserApi adminUserApi;
|
|
||||||
@Resource
|
|
||||||
private DeptApi deptApi;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BiRanKingRespVO> contractRanKing(BiRankingReqVO biRankingReqVO) {
|
|
||||||
return processRanking(biRankingReqVO, biRankingMapper::contractRanKing);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BiRanKingRespVO> receivablesRanKing(BiRankingReqVO biRankingReqVO) {
|
|
||||||
return processRanking(biRankingReqVO, biRankingMapper::receivablesRanKing);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理排行榜
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
* @param rankingFunction 排行榜方法
|
|
||||||
* @return List<BiRanKingRespVO>
|
|
||||||
*/
|
|
||||||
private List<BiRanKingRespVO> processRanking(BiRankingReqVO biRankingReqVO, Function<BiRankingReqVO, List<BiRanKingRespVO>> rankingFunction) {
|
|
||||||
analyzeAuth(biRankingReqVO);
|
|
||||||
if (biRankingReqVO.getUserIds().isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<BiRanKingRespVO> biRanKingRespVOS = rankingFunction.apply(biRankingReqVO);
|
|
||||||
return setName(biRanKingRespVOS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置用户名称
|
|
||||||
*
|
|
||||||
* @param biRanKingRespVOS 排行榜数据
|
|
||||||
* @return List<BiRanKingRespVO>
|
|
||||||
*/
|
|
||||||
private List<BiRanKingRespVO> setName(List<BiRanKingRespVO> biRanKingRespVOS) {
|
|
||||||
List<Long> userIds = biRanKingRespVOS.stream().map(BiRanKingRespVO::getOwnerUserId).collect(Collectors.toList());
|
|
||||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
|
||||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(userMap.values().stream().map(AdminUserRespDTO::getDeptId).collect(Collectors.toList()));
|
|
||||||
for (BiRanKingRespVO biRanKingRespVO : biRanKingRespVOS) {
|
|
||||||
AdminUserRespDTO adminUserRespDTO = userMap.get(biRanKingRespVO.getOwnerUserId());
|
|
||||||
if (adminUserRespDTO != null) {
|
|
||||||
biRanKingRespVO.setNickname(adminUserRespDTO.getNickname());
|
|
||||||
DeptRespDTO deptRespDTO = deptMap.get(adminUserRespDTO.getDeptId());
|
|
||||||
if (deptRespDTO != null) {
|
|
||||||
biRanKingRespVO.setDeptName(deptRespDTO.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return biRanKingRespVOS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分析权限
|
|
||||||
*
|
|
||||||
* @param biRankingReqVO 参数
|
|
||||||
*/
|
|
||||||
public void analyzeAuth(BiRankingReqVO biRankingReqVO) {
|
|
||||||
Long deptId = biRankingReqVO.getDeptId() == null ? adminUserApi.getUser(SecurityFrameworkUtils.getLoginUserId()).getDeptId() : biRankingReqVO.getDeptId();
|
|
||||||
List<Long> deptIds = deptApi.getChildDeptList(deptId).stream().map(DeptRespDTO::getId).collect(Collectors.toList());
|
|
||||||
deptIds.add(deptId);
|
|
||||||
biRankingReqVO.setUserIds(adminUserApi.getUserListByDeptIds(deptIds).stream().map(AdminUserRespDTO::getId).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.bi;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM BI 排行榜 Service 接口
|
||||||
|
*
|
||||||
|
* @author anhaohao
|
||||||
|
*/
|
||||||
|
public interface CrmBiRankingService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得合同金额排行榜
|
||||||
|
*
|
||||||
|
* @param rankReqVO 排行参数
|
||||||
|
* @return 合同金额排行榜
|
||||||
|
*/
|
||||||
|
List<CrmBiRanKRespVO> getContractPriceRank(CrmBiRankReqVO rankReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得回款金额排行榜
|
||||||
|
*
|
||||||
|
* @param rankReqVO 排行参数
|
||||||
|
* @return 回款金额排行榜
|
||||||
|
*/
|
||||||
|
List<CrmBiRanKRespVO> getReceivablePriceRank(CrmBiRankReqVO rankReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?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.CrmBiRankingMapper">
|
||||||
|
|
||||||
|
<select id="selectContractPriceRank"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
|
||||||
|
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
and owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY owner_user_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReceivablePriceRank"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
|
||||||
|
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
|
||||||
|
FROM crm_receivable
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
and owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND return_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY owner_user_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue