过滤非叶子节点
This commit is contained in:
@@ -83,7 +83,8 @@ public enum ErrorCodeEnum {
|
||||
GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误!", null),
|
||||
NEW_MOBILE_HAS_EXIST(600002,"加盟商用户信息已存在",null),
|
||||
INSPECTION_USER_OCCUPY(600002,"当前稽核人已经配置其他战区",null),
|
||||
INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null)
|
||||
INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null),
|
||||
OPEN_AREA_NULL(600006,"归属地区不能为空",null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -116,4 +116,17 @@ public class HyOpenAreaInfoDAO {
|
||||
public List<HyOpenAreaInfoDO> getAllOpenArea(){
|
||||
return hyOpenAreaInfoMapper.getAllOpenArea();
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤叶子节点
|
||||
* @param openAreaIds
|
||||
* @return 叶子节点id
|
||||
*/
|
||||
public List<Long> filterLeafNode(List<Long> openAreaIds){
|
||||
if(CollectionUtils.isEmpty(openAreaIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyOpenAreaInfoMapper.filterLeafNode(openAreaIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,5 +111,11 @@ public interface HyOpenAreaInfoMapper {
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> getAllOpenArea();
|
||||
|
||||
/**
|
||||
* 过滤叶子节点
|
||||
* @param openAreaIds
|
||||
* @return
|
||||
*/
|
||||
List<Long> filterLeafNode(@Param("openAreaIds") List<Long> openAreaIds);
|
||||
|
||||
}
|
||||
@@ -285,4 +285,13 @@
|
||||
select <include refid="Base_Column_List"/> from hy_open_area_info
|
||||
</select>
|
||||
|
||||
<select id="filterLeafNode" resultType="long">
|
||||
select
|
||||
id
|
||||
from
|
||||
hy_open_area_info
|
||||
where
|
||||
deleted = '0' and province_city_flag = '0' and id in <foreach collection="openAreaIds" item="openAreaId" separator="," open="(" close=")">#{openAreaId}</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -79,13 +79,16 @@ public class InspectionSettingServiceImpl implements InspectionSettingService {
|
||||
if(CollectionUtils.isNotEmpty(inspectionUserSetting)){
|
||||
throw new ServiceException(ErrorCodeEnum.INSPECTION_USER_OCCUPY);
|
||||
}
|
||||
List<Long> openAreaMappingIds = hyOpenAreaInfoDAO.filterLeafNode(param.getOpenAreaMappingIds());
|
||||
if(CollectionUtils.isEmpty(openAreaMappingIds)){
|
||||
throw new ServiceException(ErrorCodeEnum.OPEN_AREA_NULL);
|
||||
}
|
||||
HyInspectionSettingDO inspectionSetting = new HyInspectionSettingDO();
|
||||
inspectionSetting.setInspectionUserId(param.getInspectionUserId());
|
||||
inspectionSetting.setZoneName(param.getZoneName());
|
||||
inspectionSetting.setCreateUserId(userId);
|
||||
inspectionSetting.setCreateTime(new Date());
|
||||
Long inspectionSettingId = hyInspectionSettingDAO.addInspectionSetting(inspectionSetting);
|
||||
List<Long> openAreaMappingIds = param.getOpenAreaMappingIds();
|
||||
hyInspectionSettingMappingDAO.addInspectionSettingMapping(inspectionSettingId, openAreaMappingIds);
|
||||
return inspectionSettingId;
|
||||
}
|
||||
@@ -97,6 +100,10 @@ public class InspectionSettingServiceImpl implements InspectionSettingService {
|
||||
if(CollectionUtils.isNotEmpty(inspectionUserSetting)){
|
||||
throw new ServiceException(ErrorCodeEnum.INSPECTION_USER_OCCUPY);
|
||||
}
|
||||
List<Long> openAreaMappingIds = hyOpenAreaInfoDAO.filterLeafNode(param.getOpenAreaMappingIds());
|
||||
if(CollectionUtils.isEmpty(openAreaMappingIds)){
|
||||
throw new ServiceException(ErrorCodeEnum.OPEN_AREA_NULL);
|
||||
}
|
||||
HyInspectionSettingDO inspectionSetting = new HyInspectionSettingDO();
|
||||
inspectionSetting.setId(param.getInspectionSettingId());
|
||||
inspectionSetting.setInspectionUserId(param.getInspectionUserId());
|
||||
@@ -104,7 +111,6 @@ public class InspectionSettingServiceImpl implements InspectionSettingService {
|
||||
inspectionSetting.setUpdateUserId(userId);
|
||||
inspectionSetting.setUpdateTime(new Date());
|
||||
hyInspectionSettingDAO.updateInspectionSetting(inspectionSetting);
|
||||
List<Long> openAreaMappingIds = param.getOpenAreaMappingIds();
|
||||
return hyInspectionSettingMappingDAO.updateInspectionSettingMapping(param.getInspectionSettingId(), openAreaMappingIds);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user