统计各类资源申请数目
This commit is contained in:
parent
1abc8a883e
commit
77628f982b
|
@ -134,4 +134,21 @@ public class CensusController {
|
|||
all.join();
|
||||
return new Result<List<Map<String, Object>>>().ok(result);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/apply_amount")
|
||||
@ApiOperation("各类资源申请成功数目")
|
||||
public Result<List<Map<String, Object>>> applyAmount() {
|
||||
List<Map<String, Object>> dbAmount = tAbilityApplicationService.getAmountGroupByType();
|
||||
List<String> temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList());
|
||||
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型
|
||||
Map<String, Object> nullMap = new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", 0);
|
||||
put("type", index);
|
||||
}
|
||||
};
|
||||
dbAmount.add(nullMap);
|
||||
});
|
||||
return new Result<List<Map<String, Object>>>().ok(dbAmount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import io.renren.common.dao.BaseDao;
|
|||
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 能力申请表单
|
||||
*
|
||||
|
@ -19,4 +22,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
|
|||
TAbilityApplicationEntity getByBusinessKey(String businessKey);
|
||||
|
||||
Long countApplyAll();
|
||||
|
||||
List<Map<String, Object>> getAmountGroupByType();
|
||||
}
|
|
@ -4,6 +4,9 @@ import io.renren.common.service.CrudService;
|
|||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 能力申请表单
|
||||
*
|
||||
|
@ -25,4 +28,6 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
|
|||
TAbilityApplicationDTO getByBusinessKey(String businessKey);
|
||||
|
||||
Long countApplyAll();
|
||||
|
||||
List<Map<String, Object>> getAmountGroupByType();
|
||||
}
|
|
@ -10,6 +10,7 @@ import io.renren.modules.processForm.service.TAbilityApplicationService;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -57,5 +58,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
|
|||
return baseDao.countApplyAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getAmountGroupByType() {
|
||||
return baseDao.getAmountGroupByType();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -32,4 +32,16 @@
|
|||
WHERE
|
||||
approve_status = '通过'
|
||||
</select>
|
||||
<select id="getAmountGroupByType" resultType="java.util.Map">
|
||||
SELECT
|
||||
tbr.type AS type,
|
||||
COUNT( taa.id ) AS amount
|
||||
FROM
|
||||
t_ability_application AS taa
|
||||
INNER JOIN tb_data_resource AS tbr ON taa.resource_id = tbr.id
|
||||
WHERE
|
||||
taa.approve_status = '通过'
|
||||
GROUP BY
|
||||
tbr.type
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue