|
@@ -19,6 +19,7 @@ import com.minto.core.common.AppContext;
|
|
|
import com.minto.core.dao.BaseDaoImpl;
|
|
|
import com.minto.core.ds.enums.DSEnum;
|
|
|
import com.minto.core.util.CollectionUtil;
|
|
|
+import com.minto.core.util.DateUtil;
|
|
|
import com.minto.core.util.ParameterUtil;
|
|
|
import com.minto.core.util.StringUtil;
|
|
|
import com.minto.tap.performmance.dto.TaskScoreParam;
|
|
@@ -2048,4 +2049,29 @@ hql.append("AND EXISTS (\n" +
|
|
|
param.put("orgAccountId", orgAccountId);
|
|
|
return getHibernateTpl().queryBySql(sql, param);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> findTypeScopeCount(Map<String, Object> params){
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
+ sql.append(" SELECT te.value AS name, COUNT(1) as count ");
|
|
|
+// sql.append(" SUM(CASE WHEN typeScore.base_score IS NULL THEN 0 ELSE typeScore.base_score END) AS scope1");
|
|
|
+// sql.append(" SUM(CASE WHEN typeScore.eval_score IS NULL THEN 0 ELSE typeScore.eval_score END) AS scope2");
|
|
|
+ sql.append(" sum(IFNULL(typeScore.base_score, 0)) AS scope1 ");
|
|
|
+ sql.append(" sum(IFNULL(typeScore.eval_score, 0)) AS scope2 ");
|
|
|
+ sql.append(" sum(IFNULL(typeScore.base_score, 0) + IFNULL(typeScore.eval_score, 0)) AS scope ");
|
|
|
+ sql.append(" FROM ");
|
|
|
+ sql.append(" (SELECT * FROM tip_enum WHERE type IN ( ");
|
|
|
+ sql.append(" SELECT id FROM tip_enum WHERE key = 'matter_type_settings' ");
|
|
|
+ sql.append(" )) te ");
|
|
|
+ sql.append(" LEFT JOIN dm_dtab_basic_extend ddbe ON ddbe.type_setting LIKE CONCAT('%', te.id, '%') ");
|
|
|
+ sql.append(" LEFT JOIN task_summary ts ON ddbe.reference_id = ts.id ");
|
|
|
+ sql.append(" LEFT JOIN type_setting_score typeScore ON typeScore.enum_id = te.id AND typeScore.year = :year ");
|
|
|
+ sql.append(" GROUP BY te.value ");
|
|
|
+ String order = ParameterUtil.getString(params,"order","count");
|
|
|
+ Integer asc = ParameterUtil.getInteger(params,"asc",0);
|
|
|
+ sql.append(" ORDER BY ").append(order).append(asc == 1 ? " ASC " : " DESC ");
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("year", ParameterUtil.getInteger(params, "year", DateUtil.getYear()));
|
|
|
+ return getHibernateTpl().queryBySql(sql.toString(), param);
|
|
|
+ }
|
|
|
}
|