Commit 62160636 authored by Quxl's avatar Quxl

x

parent bc9e4a9d
......@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminUserService;
......@@ -158,7 +159,36 @@ public class AdminUserServiceImpl implements AdminUserService {
@Override
public List<Map<String, Object>> getReviewUserList(Integer review_id, Integer review_round) {
String sql = "select u.uid, u.username, u.realname, u.group_id, ug.group_name from fc_user u left join fc_user_group ug on ug.group_id = u.group_id, fc_user_group_round ugr, fc_user_group_enroll uge, fc_review r where u.group_id = ugr.group_id and u.group_id = uge.group_id and ugr.review_round = ? and uge.enroll_type_id = r.enroll_type_id and r.id = ?";
return jdbcTemplate.queryForList(sql, review_round, review_id);
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, review_round, review_id);
List<String> ids = new ArrayList<String>();
for(Map<String, Object> map : list) {
ids.add(map.get("uid").toString());
}
String sql2 = ""
+ "select "
+ "rr.user_id, "
+ "count(rr.id) count_record, "
+ "count(case when review_state is not null then rr.id end) count_review_record "
+ "from "
+ "fc_review_record rr "
+ "where "
+ "rr.user_id in (" + StringUtil.join(", ", "", "", "''", ids) + ") "
+ "group by "
+ "rr.user_id";
List<Map<String, Object>> countList = jdbcTemplate.queryForList(sql2);
Map<String, Map<String, Object>> countMM = Util.listToMM(countList, "user_id");
for(Map<String, Object> map : list) {
String userid = map.get("uid").toString();
Map<String, Object> countMap = countMM.get(userid);
if(countMap != null) {
map.put("count_record", countMap.get("count_record"));
map.put("count_review_record", countMap.get("count_review_record"));
} else {
map.put("count_record", 0);
map.put("count_review_record", 0);
}
}
return list;
}
@Override
......
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