Commit 1715d1a0 authored by kongfm's avatar kongfm

修复BUG2217

parent 04ddc68d
......@@ -91,9 +91,12 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
List<FireTeamZhDto> getFireTeamCountList();
/**
* 根据teamId 返回队伍底下人员数量
* @param teamId
* @return
*/
Integer getFighterNumByTeamId(Long teamId);
}
......@@ -36,8 +36,7 @@
a.NAME,
a.contact_user contactUser,
a.contact_phone contactPhone,
a.address,
( SELECT count( 1 ) FROM cb_firefighters WHERE fire_team_id = a.sequence_nbr AND is_delete = 0 ) fighterNum
a.address
FROM
cb_fire_team a
WHERE
......@@ -136,14 +135,15 @@
</select>
<select id="getFighterNumByTeamId" resultType="Integer">
SELECT
count(1)
FROM
cb_firefighters
WHERE
fire_team_id = #{teamId}
AND is_delete = 0
</select>
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -21,6 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException;
......@@ -100,6 +102,8 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
fireTeamList.forEach(t -> {
if (!ValidationUtil.isEmpty(finalTeamCarCountMap.get(t.getSequenceNbr().toString()))) {
t.setCarNum(finalTeamCarCountMap.get(t.getSequenceNbr().toString()).intValue());
//递归查找全部战备人数 BUG2217 bykongfm
t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr()));
}
});
fireTeamListPage.setRecords(fireTeamList);
......@@ -271,4 +275,25 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return list;
}
public Integer getFightNumByTeamId(Long teamId) {
Integer count = 0;
// 获取自己的数据
count += fireTeamMapper.getFighterNumByTeamId(teamId);
// 获取下部分数据
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent,teamId).eq(FireTeam::getIsDelete,false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if(fireTeamList.size() == 0) {
return count;
} else {
for(FireTeam t : fireTeamList) {
count += getFightNumByTeamId(t.getSequenceNbr());
}
}
// 获取子集数据
return count;
}
}
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