Commit 0247c856 by songyinghui

feat: 统计活码 sql 修复

parent 1bb9b575
......@@ -115,15 +115,16 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
}
result.addAll(groupDtoPage.getResult());
List<Long> groupIds = result.stream().map(HmGroupDTO::getGroupId).collect(Collectors.toList());
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getEnterpriseId(),groupIds);
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getEnterpriseId(), groupIds);
Map<Integer, Integer> qrcodeGroupNumMap = Collections.emptyMap();
if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) {qrcodeGroupNumMap = qrcodeGroupNumBoList.stream()
if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) {
qrcodeGroupNumMap = qrcodeGroupNumBoList.stream()
.collect(Collectors.toMap(HmQrcodeGroupNumBO::getHmGroupId, HmQrcodeGroupNumBO::getNum, (v1, v2) -> v1));
}
for (HmGroupDTO groupDTO : result) {
Integer referNum = Optional.ofNullable(qrcodeGroupNumMap.get(groupDTO.getGroupId().intValue())).orElse(0);
groupDTO.setReferNum(referNum);
if (!DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())){
if (!DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())) {
groupDTO.setDefaultFlag(0);
}
}
......@@ -151,10 +152,10 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
}
HmGroupSettingBO groupSettingBo = groupService.queryGroupSettingDetail(groupDTO.getGroupId());
if (groupSettingBo == null
|| !HmGroupStatus.ENABLE.getCode().equals(groupSettingBo.getStatus())){
|| !HmGroupStatus.ENABLE.getCode().equals(groupSettingBo.getStatus())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
}
if (groupSettingBo.getReferNum() != null && groupSettingBo.getReferNum() > 0){
if (groupSettingBo.getReferNum() != null && groupSettingBo.getReferNum() > 0) {
return ServiceResponse.failure(HaoBanErrCode.ERR_100033.getCode(), HaoBanErrCode.ERR_100033.getMsg());
}
groupService.deleteGroupSetting(groupDTO);
......
......@@ -324,8 +324,8 @@
</select>
<select id="getGroupIdNumByEnterpriseId" resultType="com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO">
select hm_group_id,
COUNT(hm_id)
select hm_group_id as hmGroupId,
COUNT(hm_id) as num
from tab_haoban_hm_qrcode
where status_flag != 0
and enterprise_id = #{enterpriseId}
......
......@@ -71,7 +71,8 @@ public class HmPageServiceTest {
@Test
public void groupList(){
HmGroupQueryDTO groupQueryDTO = new HmGroupQueryDTO();
groupQueryDTO.setGroupName("默认");
//groupQueryDTO.setGroupName("默认");
groupQueryDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
ServiceResponse<Page<HmGroupDTO>> pageServiceResponse = groupService.queryHmGroupSettingList(groupQueryDTO);
System.out.println(JSON.toJSONString(pageServiceResponse));
}
......
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