Commit b97b5d95 by 梅存智

项目列表增加统计人数

parent 4aed6792
......@@ -202,6 +202,15 @@ public class TrainingProjectVo extends Model<TrainingProjectVo> {
@ApiModelProperty(value = "上传图片")
private List<TrainingProjectDetailsImageVO> detailsImage;
@ApiModelProperty(value = "报名人数")
private String enrollCount;
@ApiModelProperty(value = "签到人数")
private String signCount;
@ApiModelProperty(value = "评论人数")
private String commentCount;
@Override
protected Serializable pkVal() {
return this.id;
......
......@@ -130,9 +130,15 @@
tp.enable_queue as enableQueue,
enroll.actual_price as actualPrice,
enroll.original_price as originalPrice,
enroll.enable_pay as enablePay
enroll.enable_pay as enablePay,
COUNT(DISTINCT enr.account_id) AS enrollCount,
COUNT(DISTINCT sre.account_id) AS signCount,
COUNT(DISTINCT comm.create_by_id) AS commentCount
FROM training_project tp
left join tr_enroll enroll on tp.id = enroll.training_project_id
left join tp_student_enroll_passed enr on tp.id=enr.training_project_id
left join tr_sign_record sre on tp.id=sre.training_project_id
left join tp_comment comm on tp.id=comm.training_project_id AND comm.biz_type=1
<where>
tp.deleted = 0
<if test="enableEnroll != null">
......@@ -159,6 +165,7 @@
</if>
</where>
GROUP BY tp.id
ORDER BY tp.`create_time` DESC
</select>
......
......@@ -800,12 +800,15 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
addViewRecord(accountId, context, project, now);
//获取投票ID和名称
if(project.getResearchId() != null){
ResearchVo researchVo = researchClient.viewInfo(project.getResearchId());
if(researchVo != null){
introductionVo.setResearchId(researchVo.getId());
introductionVo.setResearchName(researchVo.getName());
}
TpPlanActivity tpPlanActivity = new TpPlanActivity();
tpPlanActivity.setDeleted(0);
tpPlanActivity.setType(2);
tpPlanActivity.setTrainingProjectId(trainingProjectId);
EntityWrapper<TpPlanActivity> wrapper = new EntityWrapper<TpPlanActivity>(tpPlanActivity);
List<TpPlanActivity> planActivitys = tpPlanActivityMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(planActivitys)){
introductionVo.setResearchId(planActivitys.get(0).getRelationId());
introductionVo.setResearchName(planActivitys.get(0).getName());
}
/**
......
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