Commit 3b9f814d authored by 赵啸非's avatar 赵啸非

添加代办员工评价次数

parent b4ca214d
......@@ -3,6 +3,8 @@ package com.mortals.xhx.module.staff.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.staff.model.StaffEntity;
import java.util.List;
import java.util.Map;
/**
* 代办帮办人员Dao
* 代办帮办人员 DAO接口
......@@ -14,6 +16,6 @@ import java.util.List;
public interface StaffDao extends ICRUDDao<StaffEntity,Long>{
Integer getPjTimesByAgent(Long agentUserId);
Map<String,Integer> getPjTimesByAgent(Long agentUserId);
}
......@@ -10,6 +10,7 @@ import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
import java.util.Map;
/**
* 代办帮办人员DaoImpl DAO接口
......@@ -22,7 +23,7 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity, Long> implemen
@Override
public Integer getPjTimesByAgent(Long agentUserId) {
public Map<String,Integer> getPjTimesByAgent(Long agentUserId) {
return getSqlSession().selectOne(getSqlId("getPjTimesByAgent"), agentUserId);
}
......
......@@ -18,6 +18,7 @@ import org.springframework.beans.BeanUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -69,8 +70,12 @@ public class StaffServiceImpl extends AbstractCRUDServiceImpl<StaffDao, StaffEnt
super.findAfter(params, pageInfo, context, list);
list.stream().forEach(item->{
Long userId = item.getUserId();
Integer pjTimesByAgent = dao.getPjTimesByAgent(userId);
item.setPjTimes(pjTimesByAgent);
Map<String, Integer> pjTimesByAgent = dao.getPjTimesByAgent(userId);
if(!ObjectUtils.isEmpty(pjTimesByAgent)){
item.setPjTimes(pjTimesByAgent.getOrDefault("times",0));
item.setTotalScore(pjTimesByAgent.getOrDefault("totalScore",0));
item.setTotalNum(pjTimesByAgent.getOrDefault("totalNum",0));
}
});
}
......
......@@ -2,9 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl">
<select id="getPjTimesByAgent" parameterType="Long" resultType="Integer">
<select id="getPjTimesByAgent" parameterType="Long" resultType="Map">
SELECT
count( b.score ) AS times
count( b.score ) AS times,
sum( b.score ) AS totalScore,
COUNT(a.agent_user_id) AS totalNum
FROM
mortals_agent_declare a
LEFT JOIN mortals_agent_evaluation_info b ON a.id = b.declare_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment