| | |
| | | |
| | | /** |
| | | * 住户-标签 自定义新增或修改 |
| | | * |
| | | * @param householdLabel |
| | | * @return |
| | | */ |
| | |
| | | householdLabel.setLabelName(labelEntity.getLabelName()); |
| | | // 判断同一个住户同一个标签是否已存在,已存在则更新,不存在则新增 |
| | | QueryWrapper<UserHouseLabelEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("household_id",householdLabel.getHouseholdId()) |
| | | .eq("label_id",householdLabel.getLabelId()); |
| | | queryWrapper.eq("household_id", householdLabel.getHouseholdId()) |
| | | .eq("label_id", householdLabel.getLabelId()); |
| | | UserHouseLabelEntity one = getOne(queryWrapper); |
| | | if (null != one){ |
| | | if (null != one) { |
| | | householdLabel.setId(one.getId()); |
| | | // 更新 |
| | | return updateById(householdLabel); |
| | |
| | | public IPage<HouseholdLabelVO> statisticalLabels(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel) { |
| | | return page.setRecords(baseMapper.statisticalLabels(page, householdLabel)); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HouseholdLabelVO> getCommunityStatisticalLabels(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel) { |
| | | return page.setRecords(baseMapper.getCommunityStatisticalLabels(page, householdLabel)); |
| | | } |
| | | |
| | | /** |
| | | * 房屋-标签 房屋自定义新增或修改 |
| | | * |
| | | * @param userHouseLabelEntity |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean saveOrUpdateHouseLabel(UserHouseLabelEntity userHouseLabelEntity) { |
| | | // 查询标签名称 |
| | | LabelEntity labelEntity = labelService.getById(userHouseLabelEntity.getLabelId()); |
| | | if (labelEntity != null) { |
| | | userHouseLabelEntity.setLabelName(labelEntity.getLabelName()); |
| | | } |
| | | // 先删除之前的房屋绑定的标签 |
| | | QueryWrapper<UserHouseLabelEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("house_code", userHouseLabelEntity.getHouseCode()) |
| | | .eq("lable_type", 2); |
| | | // 删除 |
| | | remove(queryWrapper); |
| | | // 插入 |
| | | return save(userHouseLabelEntity); |
| | | } |
| | | } |